Skip to content

Commit 38ad53d

Browse files
tsachihermanbtoll
and
btoll
authored
Run build and test jobs in a docker container (#840) (#844)
Co-authored-by: btoll <[email protected]>
1 parent 1c41d91 commit 38ad53d

File tree

9 files changed

+32
-8
lines changed

9 files changed

+32
-8
lines changed

scripts/release/build/Jenkinsfile

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ pipeline {
88
AWS_SECRET_ACCESS_KEY = credentials("prod-s3-aws-secret-access-key")
99
}
1010

11-
agent any
11+
agent {
12+
dockerfile {
13+
filename 'scripts/release/common/docker/setup.Dockerfile'
14+
/*
15+
args '-v /etc/passwd:/etc/passwd'
16+
*/
17+
}
18+
}
19+
20+
/*
21+
triggers {
22+
cron('* * * * *')
23+
}
24+
*/
1225

1326
stages {
1427
stage("create ec2 instance") {

scripts/release/build/stage/build/task.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else
3131
fi
3232

3333
# Run RPM build in Centos7 Docker container
34-
sg docker "docker build -t algocentosbuild - < $HOME/go/src/github.com/algorand/go-algorand/scripts/release/common/centos-build.Dockerfile"
34+
sg docker "docker build -t algocentosbuild - < $HOME/go/src/github.com/algorand/go-algorand/scripts/release/common/docker/centos.Dockerfile"
3535

3636
sg docker "docker run --rm --mount type=bind,src=${HOME},dst=/root/subhome algocentosbuild /root/subhome/go/src/github.com/algorand/go-algorand/scripts/release/build/rpm/build.sh"
3737

scripts/release/build/stage/setup/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
set -ex
55

66
# Path(s) are relative to the root of the Jenkins workspace.
7-
87
INSTANCE=$(cat scripts/release/common/ec2/tmp/instance)
8+
BRANCH="$1"
99

1010
aws s3 cp s3://algorand-devops-misc/tools/gnupg2.2.9_centos7_amd64.tar.bz2 .
1111
scp -i ReleaseBuildInstanceKey.pem -o StrictHostKeyChecking=no -r scripts/release/common/setup.sh gnupg2.2.9_centos7_amd64.tar.bz2 ubuntu@"$INSTANCE":
12-
ssh -i ReleaseBuildInstanceKey.pem -A ubuntu@"$INSTANCE" bash setup.sh "$1"
12+
ssh -i ReleaseBuildInstanceKey.pem -A ubuntu@"$INSTANCE" bash setup.sh "$BRANCH"
1313

scripts/release/build/stage/upload/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ssh -i ReleaseBuildInstanceKey.pem -A ubuntu@"$INSTANCE" bash go/src/github.com/
1616
scp -i ReleaseBuildInstanceKey.pem -o StrictHostKeyChecking=no -r ubuntu@"$INSTANCE":~/node_pkg/* pkg/"$FULLVERSION"/
1717

1818
# Create the buildlog file.
19-
scp -i ReleaseBuildInstanceKey.pem -o StrictHostKeyChecking=no ubuntu@"$INSTANCE":~/build_status_"$CHANNEL"_*.asc.gz pkg/
19+
scp -i ReleaseBuildInstanceKey.pem -o StrictHostKeyChecking=no ubuntu@"$INSTANCE":~/build_status_"$CHANNEL"_*.asc.gz pkg/"$FULLVERSION"
2020
#aws s3 sync --exclude dev* --exclude master* --exclude nightly* --exclude stable* --acl public-read pkg/"$FULLVERSION" s3://"$BUCKET_LOCATION"/"$CHANNEL"/"$FULLVERSION"/
2121
aws s3 sync --exclude dev* --exclude master* --exclude nightly* --exclude stable* --acl public-read pkg/"$FULLVERSION" s3://ben-test-2.0.3/"$CHANNEL"/"$FULLVERSION"/
2222

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM ubuntu:18.04
2+
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y awscli jq ssh
3+
#RUN adduser --uid $(grep jenkins /etc/passwd | awk -F: '{ print $3 }') ubuntu
4+
RUN adduser --uid 111 ubuntu
5+

scripts/release/prod/rpm/run_centos.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ set -ex
55

66
. "${HOME}"/build_env
77

8-
sg docker "docker build -t algocentosbuild - < ${HOME}/go/src/github.com/algorand/go-algorand/scripts/release/common/centos-build.Dockerfile"
8+
# Run RPM build in Centos7 Docker container
9+
sg docker "docker build -t algocentosbuild - < ${HOME}/go/src/github.com/algorand/go-algorand/scripts/release/common/docker/centos.Dockerfile"
910

1011
sg docker "docker run --rm --env-file ${HOME}/build_env_docker --mount type=bind,src=/run/user/1000/gnupg/S.gpg-agent,dst=/root/S.gpg-agent --mount type=bind,src=${HOME}/prodrepo,dst=/root/prodrepo --mount type=bind,src=${HOME}/keys,dst=/root/keys --mount type=bind,src=${HOME},dst=/root/subhome algocentosbuild /root/subhome/go/src/github.com/algorand/go-algorand/scripts/release/prod/rpm/snapshot.sh"
1112

scripts/release/test/Jenkinsfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ pipeline {
1212
AWS_SECRET_ACCESS_KEY = credentials("prod-s3-aws-secret-access-key")
1313
}
1414

15-
agent any
15+
agent {
16+
dockerfile {
17+
filename 'scripts/release/common/docker/setup.Dockerfile'
18+
}
19+
}
1620

1721
stages {
1822
stage("create ec2 instance") {

scripts/release/test/rpm/run_centos.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ echo
99
date "+build_release begin TEST stage %Y%m%d_%H%M%S"
1010
echo
1111

12-
sg docker "docker build -t algocentosbuild - < ${HOME}/go/src/github.com/algorand/go-algorand/scripts/release/common/centos-build.Dockerfile"
12+
# Run RPM build in Centos7 Docker container
13+
sg docker "docker build -t algocentosbuild - < ${HOME}/go/src/github.com/algorand/go-algorand/scripts/release/common/docker/centos.Dockerfile"
1314

1415
cat <<EOF>"${HOME}"/dummyrepo/algodummy.repo
1516
[algodummy]

0 commit comments

Comments
 (0)