Skip to content

Commit

Permalink
Fix M1 jenkins startup issue (#46)
Browse files Browse the repository at this point in the history
* Fix M1 Jenkins startup issue
  • Loading branch information
TupleType authored Dec 27, 2022
1 parent 741a2b8 commit 2365866
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
18 changes: 11 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ jobs:
sudo apt-get update
sudo apt-get install -y qemu qemu-user-static
docker buildx create --name mybuilder --use --bootstrap
cd gitlab && docker buildx build --load --tag cidersecurity/goat-gitlab:latest . && cd ..
cd gitlab-runner && docker buildx build --load --tag cidersecurity/goat-gitlab-runner:latest . && cd ..
cd prod && docker buildx build --load --tag cidersecurity/goat-prod:latest . && cd ..
docker-compose -f docker-compose-dev.yaml up -d gitlab gitlab-runner prod
docker-compose -f docker-compose-dev.yaml up -d --build gitea ctfd jenkins-server jenkins-agent localstack docker
cd jenkins-server && docker buildx build --load --tag cidersecurity/goat-jenkins-server:latest . && cd ..
docker-compose -f docker-compose-dev.yaml up -d gitlab gitlab-runner prod jenkins-server
docker-compose -f docker-compose-dev.yaml up -d --build gitea ctfd jenkins-agent localstack docker
- run:
name: Install testing dependencies
command: |
Expand Down Expand Up @@ -56,28 +59,29 @@ jobs:
sudo apt-get install -y qemu qemu-user-static
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
docker buildx create --name mybuilder --use --bootstrap
cd gitlab && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-gitlab:latest . && cd ..
cd gitlab-runner && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-gitlab-runner:latest . && cd ..
cd prod && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-prod:latest . && cd ..
docker-compose -f docker-compose-dev.yaml build --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 gitea ctfd jenkins-server jenkins-agent
docker-compose -f docker-compose-dev.yaml push gitea ctfd jenkins-server jenkins-agent
cd jenkins-server && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-jenkins-server:latest . && cd ..
docker-compose -f docker-compose-dev.yaml build --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 gitea ctfd jenkins-agent
docker-compose -f docker-compose-dev.yaml push gitea ctfd jenkins-agent
- run:
name: Push version
command: |
echo "version: $VERSION"
docker tag $ORG/goat-jenkins-server:latest $ORG/goat-jenkins-server:$VERSION
docker tag $ORG/goat-jenkins-agent:latest $ORG/goat-jenkins-agent:$VERSION
docker tag $ORG/goat-gitea:latest $ORG/goat-gitea:$VERSION
docker tag $ORG/goat-ctfd:latest $ORG/goat-ctfd:$VERSION
docker push $ORG/goat-jenkins-server:$VERSION
docker push $ORG/goat-jenkins-agent:$VERSION
docker push $ORG/goat-gitea:$VERSION
docker push $ORG/goat-ctfd:$VERSION
cd gitlab && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-gitlab:$VERSION . && cd ..
cd gitlab-runner && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-gitlab-runner:$VERSION . && cd ..
cd prod && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-prod:$VERSION . && cd ..
cd jenkins-server && docker buildx build --push --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 --platform linux/amd64,linux/arm64/v8 --tag cidersecurity/goat-jenkins-server:$VERSION . && cd ..
workflows:
version: 2
Expand Down
4 changes: 2 additions & 2 deletions gitea/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ COPY Pipfile* /setup/
RUN cd /setup && pipenv install --system --deploy

COPY . /setup/
RUN /setup/check_git.py && chmod 755 /setup/giteacasc/askpass.py /setup/run
RUN /setup/check_git.py && chmod 755 /setup/giteacasc/askpass.py /setup/run.sh
COPY --chown=git:git app.ini /data/gitea/conf/

ENTRYPOINT ["/setup/run"]
ENTRYPOINT ["/setup/run.sh"]


File renamed without changes.
4 changes: 2 additions & 2 deletions jenkins-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ RUN curl -OL https://go.dev/dl/go1.18.linux-amd64.tar.gz && \
cd terraform && \
go install || true
# Install Python packages
RUN python3 -m pip install --user --no-cache-dir -U pylint pytest checkov awscli-local
RUN python3 -m pip install --user --no-cache-dir -U pylint pytest checkov awscli-local virtualenv

FROM jenkins/ssh-agent:4.1.0-jdk11
RUN apt-get update && \
apt-get -y --no-install-recommends install unzip python3 virtualenv npm git curl jq make && \
apt-get -y --no-install-recommends install unzip python3 npm git curl jq make && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
apt-get -y purge unzip && \
Expand Down
6 changes: 3 additions & 3 deletions jenkins-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ ENV JAVA_OPTS "-Djenkins.install.runSetupWizard=false"
ENV SECRETS_FILE /var/jenkins_home/secrets.properties

COPY --chown=jenkins:jenkins flag5.txt /var/jenkins_home/flag5.txt
COPY --chown=jenkins:jenkins cleanup /var/jenkins_home/cleanup
COPY --chown=jenkins:jenkins run.sh /var/jenkins_home/run.sh
COPY --chown=jenkins:jenkins plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli --clean-download-directory -f /usr/share/jenkins/ref/plugins.txt && \
chmod 755 /var/jenkins_home/cleanup
chmod 755 /var/jenkins_home/run.sh
COPY --chown=jenkins:jenkins secrets.properties /var/jenkins_home/secrets.properties
COPY --chown=jenkins:jenkins jenkins.yaml /var/jenkins_home/jenkins.yaml
COPY --chown=jenkins:jenkins jobdsl/ /var/jenkins_home/jobdsl/
ENTRYPOINT ["/var/jenkins_home/cleanup"]
ENTRYPOINT ["/var/jenkins_home/run.sh"]
3 changes: 0 additions & 3 deletions jenkins-server/cleanup

This file was deleted.

14 changes: 14 additions & 0 deletions jenkins-server/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
/usr/bin/tini -- /usr/local/bin/jenkins.sh &
while true
do
jenkins_status_code=$(curl --write-out %{http_code} --silent --output /dev/null localhost/login )
if [ "$jenkins_status_code" -eq 200 ]; then
break
fi
sleep 5
done
rm -rf /var/jenkins_home/jobdsl
rm /var/jenkins_home/secrets.properties
rm /var/jenkins_home/jenkins.yaml
fg

0 comments on commit 2365866

Please sign in to comment.