Skip to content

Commit 2365866

Browse files
authored
Fix M1 jenkins startup issue (#46)
* Fix M1 Jenkins startup issue
1 parent 741a2b8 commit 2365866

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

.circleci/config.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ jobs:
2020
sudo apt-get update
2121
sudo apt-get install -y qemu qemu-user-static
2222
docker buildx create --name mybuilder --use --bootstrap
23+
2324
cd gitlab && docker buildx build --load --tag cidersecurity/goat-gitlab:latest . && cd ..
2425
cd gitlab-runner && docker buildx build --load --tag cidersecurity/goat-gitlab-runner:latest . && cd ..
2526
cd prod && docker buildx build --load --tag cidersecurity/goat-prod:latest . && cd ..
26-
docker-compose -f docker-compose-dev.yaml up -d gitlab gitlab-runner prod
27-
docker-compose -f docker-compose-dev.yaml up -d --build gitea ctfd jenkins-server jenkins-agent localstack docker
27+
cd jenkins-server && docker buildx build --load --tag cidersecurity/goat-jenkins-server:latest . && cd ..
28+
29+
docker-compose -f docker-compose-dev.yaml up -d gitlab gitlab-runner prod jenkins-server
30+
docker-compose -f docker-compose-dev.yaml up -d --build gitea ctfd jenkins-agent localstack docker
2831
- run:
2932
name: Install testing dependencies
3033
command: |
@@ -56,28 +59,29 @@ jobs:
5659
sudo apt-get install -y qemu qemu-user-static
5760
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
5861
docker buildx create --name mybuilder --use --bootstrap
62+
5963
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 ..
6064
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 ..
6165
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 ..
62-
docker-compose -f docker-compose-dev.yaml build --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 gitea ctfd jenkins-server jenkins-agent
63-
docker-compose -f docker-compose-dev.yaml push gitea ctfd jenkins-server jenkins-agent
66+
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 ..
67+
68+
docker-compose -f docker-compose-dev.yaml build --build-arg VERSION=$VERSION --build-arg COMMIT_SHA=$CIRCLE_SHA1 gitea ctfd jenkins-agent
69+
docker-compose -f docker-compose-dev.yaml push gitea ctfd jenkins-agent
6470
- run:
6571
name: Push version
6672
command: |
67-
echo "version: $VERSION"
68-
docker tag $ORG/goat-jenkins-server:latest $ORG/goat-jenkins-server:$VERSION
6973
docker tag $ORG/goat-jenkins-agent:latest $ORG/goat-jenkins-agent:$VERSION
7074
docker tag $ORG/goat-gitea:latest $ORG/goat-gitea:$VERSION
7175
docker tag $ORG/goat-ctfd:latest $ORG/goat-ctfd:$VERSION
7276
73-
docker push $ORG/goat-jenkins-server:$VERSION
7477
docker push $ORG/goat-jenkins-agent:$VERSION
7578
docker push $ORG/goat-gitea:$VERSION
7679
docker push $ORG/goat-ctfd:$VERSION
7780
7881
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 ..
7982
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 ..
8083
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 ..
84+
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 ..
8185
8286
workflows:
8387
version: 2

gitea/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ COPY Pipfile* /setup/
2222
RUN cd /setup && pipenv install --system --deploy
2323

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

28-
ENTRYPOINT ["/setup/run"]
28+
ENTRYPOINT ["/setup/run.sh"]
2929

3030

File renamed without changes.

jenkins-agent/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ RUN curl -OL https://go.dev/dl/go1.18.linux-amd64.tar.gz && \
2323
cd terraform && \
2424
go install || true
2525
# Install Python packages
26-
RUN python3 -m pip install --user --no-cache-dir -U pylint pytest checkov awscli-local
26+
RUN python3 -m pip install --user --no-cache-dir -U pylint pytest checkov awscli-local virtualenv
2727

2828
FROM jenkins/ssh-agent:4.1.0-jdk11
2929
RUN apt-get update && \
30-
apt-get -y --no-install-recommends install unzip python3 virtualenv npm git curl jq make && \
30+
apt-get -y --no-install-recommends install unzip python3 npm git curl jq make && \
3131
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
3232
unzip awscliv2.zip && \
3333
apt-get -y purge unzip && \

jenkins-server/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ ENV JAVA_OPTS "-Djenkins.install.runSetupWizard=false"
1616
ENV SECRETS_FILE /var/jenkins_home/secrets.properties
1717

1818
COPY --chown=jenkins:jenkins flag5.txt /var/jenkins_home/flag5.txt
19-
COPY --chown=jenkins:jenkins cleanup /var/jenkins_home/cleanup
19+
COPY --chown=jenkins:jenkins run.sh /var/jenkins_home/run.sh
2020
COPY --chown=jenkins:jenkins plugins.txt /usr/share/jenkins/ref/plugins.txt
2121
RUN jenkins-plugin-cli --clean-download-directory -f /usr/share/jenkins/ref/plugins.txt && \
22-
chmod 755 /var/jenkins_home/cleanup
22+
chmod 755 /var/jenkins_home/run.sh
2323
COPY --chown=jenkins:jenkins secrets.properties /var/jenkins_home/secrets.properties
2424
COPY --chown=jenkins:jenkins jenkins.yaml /var/jenkins_home/jenkins.yaml
2525
COPY --chown=jenkins:jenkins jobdsl/ /var/jenkins_home/jobdsl/
26-
ENTRYPOINT ["/var/jenkins_home/cleanup"]
26+
ENTRYPOINT ["/var/jenkins_home/run.sh"]

jenkins-server/cleanup

Lines changed: 0 additions & 3 deletions
This file was deleted.

jenkins-server/run.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
/usr/bin/tini -- /usr/local/bin/jenkins.sh &
3+
while true
4+
do
5+
jenkins_status_code=$(curl --write-out %{http_code} --silent --output /dev/null localhost/login )
6+
if [ "$jenkins_status_code" -eq 200 ]; then
7+
break
8+
fi
9+
sleep 5
10+
done
11+
rm -rf /var/jenkins_home/jobdsl
12+
rm /var/jenkins_home/secrets.properties
13+
rm /var/jenkins_home/jenkins.yaml
14+
fg

0 commit comments

Comments
 (0)