diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/FirestormLinux/Dockerfile b/FirestormLinux/Dockerfile index 5d2b9a4..6e23a35 100644 --- a/FirestormLinux/Dockerfile +++ b/FirestormLinux/Dockerfile @@ -3,6 +3,8 @@ FROM ubuntu:jammy LABEL author="Tara Piccari" maintainer="tarapiccari@gmail.com" SHELL [ "/bin/bash", "-c" ] +ENV AGENT NAN + ENV DOCKER 1 ENV DEBIAN_FRONTEND=noninteractive @@ -32,11 +34,12 @@ WORKDIR /firestorm RUN echo "#!/bin/bash" >> installables.sh RUN echo "autobuild installables edit fmodstudio platform=linux64 hash=$(md5sum linux-fmod.tar.bz2) url=file:///firestorm/linux-fmod.tar.bz2" >> installables.sh - -ADD agent.secret /agent.secret - WORKDIR / +ADD ./entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + + RUN curl -sO https://ci.zontreck.com/jnlpJars/agent.jar -ENTRYPOINT [ "java", "-Dfile.encoding=UTF-8", "-Dsun.jnu.encoding=UTF-8", "-jar", "/agent.jar", "-url", "https://ci.zontreck.com", "-secret", "@/agent.secret", "-name", "LinuxFS", "-workDir", "/builder" ] +ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] diff --git a/FirestormLinux/entrypoint.sh b/FirestormLinux/entrypoint.sh new file mode 100644 index 0000000..82aa1b6 --- /dev/null +++ b/FirestormLinux/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +java -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -jar /agent.jar -url "https://ci.zontreck.com" -secret "$AGENT" -name "Linux" -workDir "/builder" diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..b991ac8 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,178 @@ +pipeline { + agent any + + options { + buildDiscarder( + logRotator( + numToKeepStr: '5' + ) + ) + } + + stages { + stage("Clean Up Repo") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + git reset --hard + git clean -xfd + ''' + } + } + stage("Clean Docker Caches") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker system prune --volumes -f + ''' + } + } + + stage("Stop Workers") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + docker-compose down + + docker stop linuxbuilder || true + docker stop linuxfs || true + ''' + } + } + + stage("Build Debian Base") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker build -t git.zontreck.com/ariascreations/buildenvironments:debian DebianBase + docker push git.zontreck.com/ariascreations/buildenvironments:debian + ''' + } + } + + stage("Builder Debian Compiler") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + + docker build -t git.zontreck.com/ariascreations/buildenvironments:debianbuild DebianBuilder + docker push git.zontreck.com/ariascreations/buildenvironments:debianbuild + ''' + } + } + + stage("Build ADK") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker build -t git.zontreck.com/ariascreations/buildenvironments:adk AndroidSDK + docker push git.zontreck.com/ariascreations/buildenvironments:adk + ''' + } + } + + stage("Build Flutter") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker build -t git.zontreck.com/ariascreations/buildenvironments:flutter FlutterSdk + docker push git.zontreck.com/ariascreations/buildenvironments:flutter + ''' + } + } + + stage("Build AppImage Layer") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker build -t git.zontreck.com/ariascreations/buildenvironments:appimage AppImage + docker push git.zontreck.com/ariascreations/buildenvironments:appimage + ''' + } + } + + stage("Build Linux Node") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker build -t git.zontreck.com/ariascreations/buildenvironments:linux LinuxGeneralCompiler + docker push git.zontreck.com/ariascreations/buildenvironments:linux + ''' + } + } + + stage("Build Linux Firestorm Node") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker build -t git.zontreck.com/ariascreations/buildenvironments:linuxfs FirestormLinux + docker push git.zontreck.com/ariascreations/buildenvironments:linuxfs + ''' + } + } + + stage("Clean Docker Caches") { + agent { + label dockermain + } + + script { + sh ''' + #!/bin/bash + + docker system prune --volumes -f + ''' + } + } + } + +} \ No newline at end of file diff --git a/LinuxGeneralCompiler/Dockerfile b/LinuxGeneralCompiler/Dockerfile index 0bf7962..4991430 100644 --- a/LinuxGeneralCompiler/Dockerfile +++ b/LinuxGeneralCompiler/Dockerfile @@ -1,19 +1,16 @@ FROM git.zontreck.com/ariascreations/buildenvironments:appimage -COPY ./agent.secret /agent.secret +ENV PUB NAN +ENV AGENT NAN +ENV GRADLEPROP NAN +ENV PRIVKEY NAN +ENV PUBKEY NAN +WORKDIR / RUN curl -sO https://ci.zontreck.com/jnlpJars/agent.jar -ADD pub.secret / - -RUN cat /pub.secret | dart pub token add https://git.zontreck.com/api/packages/AriasCreations/pub - -WORKDIR /root/.ssh -ADD ./id_rsa ./id_rsa -ADD ./id_rsa.pub ./id_rsa.pub -RUN chmod 0600 id_rsa -WORKDIR /root/.gradle -ADD ./gradle.properties ./ WORKDIR / +ADD ./entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh -ENTRYPOINT [ "java", "-Dfile.encoding=UTF-8", "-Dsun.jnu.encoding=UTF-8", "-jar", "/agent.jar", "-url", "https://ci.zontreck.com", "-secret", "@/agent.secret", "-name", "Linux", "-workDir", "/builder" ] +ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] diff --git a/LinuxGeneralCompiler/entrypoint.sh b/LinuxGeneralCompiler/entrypoint.sh new file mode 100644 index 0000000..4680fff --- /dev/null +++ b/LinuxGeneralCompiler/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo $PUB | dart pub token add https://git.zontreck.com/api/packages/AriasCreations/pub + +mkdir -pv ~/.gradle +echo $GRADLEPROP | base64 -d > ~/.gradle/gradle.properties + +mkdir -pv ~/.ssh +echo "$PRIVKEY" | base64 -d > ~/.ssh/id_rsa +echo "$PUBKEY" | base64 -d > ~/.ssh/id_rsa.pub +chmod 0600 ~/.ssh/id_rsa + +java -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -jar /agent.jar -url "https://ci.zontreck.com" -secret "$AGENT" -name "Linux" -workDir "/builder" diff --git a/docker-compose.yml b/docker-compose.yml index 0d04cb4..8175a20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,12 +5,20 @@ services: image: git.zontreck.com/ariascreations/buildenvironments:linux container_name: linuxbuilder restart: unless-stopped + environment: + - AGENT=${AGENT} + - GRADLEPROP=${GRADLEPROP} + - PUB=${PUB} + - PRIVKEY=${PRIVKEY} + - PUBKEY=${PUBKEY} networks: - buildenv linuxfs: image: git.zontreck.com/ariascreations/buildenvironments:linuxfs container_name: linuxfs restart: unless-stopped + environment: + - AGENT=${FSAGENT} networks: - buildenv diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..0301a34 --- /dev/null +++ b/run.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +echo "AGENT=$AGENT" > .env + +echo -ne "GRADLEPROP=" >> .env +cat $GRADLEPROP | base64 >> .env + +echo "PUB=$PUB" >> .env + +echo -ne "PRIVKEY=" >> .env +cat $PRIVKEY | base64 >> .env + +echo -ne "PUBKEY=" >> .env +cat $PUBKEY | base64 >> .env + +echo "FSAGENT=$FSAGENT" >> .env + + + +docker-compose up -d \ No newline at end of file