Skip to content

Commit

Permalink
Run build and test jobs in a docker container (#840) (#844)
Browse files Browse the repository at this point in the history
Co-authored-by: btoll <[email protected]>
  • Loading branch information
tsachiherman and btoll authored Feb 21, 2020
1 parent 1c41d91 commit 38ad53d
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 8 deletions.
15 changes: 14 additions & 1 deletion scripts/release/build/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ pipeline {
AWS_SECRET_ACCESS_KEY = credentials("prod-s3-aws-secret-access-key")
}

agent any
agent {
dockerfile {
filename 'scripts/release/common/docker/setup.Dockerfile'
/*
args '-v /etc/passwd:/etc/passwd'
*/
}
}

/*
triggers {
cron('* * * * *')
}
*/

stages {
stage("create ec2 instance") {
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/build/stage/build/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else
fi

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

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"

Expand Down
4 changes: 2 additions & 2 deletions scripts/release/build/stage/setup/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
set -ex

# Path(s) are relative to the root of the Jenkins workspace.

INSTANCE=$(cat scripts/release/common/ec2/tmp/instance)
BRANCH="$1"

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

2 changes: 1 addition & 1 deletion scripts/release/build/stage/upload/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ssh -i ReleaseBuildInstanceKey.pem -A ubuntu@"$INSTANCE" bash go/src/github.com/
scp -i ReleaseBuildInstanceKey.pem -o StrictHostKeyChecking=no -r ubuntu@"$INSTANCE":~/node_pkg/* pkg/"$FULLVERSION"/

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

5 changes: 5 additions & 0 deletions scripts/release/common/docker/setup.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM ubuntu:18.04
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y awscli jq ssh
#RUN adduser --uid $(grep jenkins /etc/passwd | awk -F: '{ print $3 }') ubuntu
RUN adduser --uid 111 ubuntu

3 changes: 2 additions & 1 deletion scripts/release/prod/rpm/run_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ set -ex

. "${HOME}"/build_env

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

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"

6 changes: 5 additions & 1 deletion scripts/release/test/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ pipeline {
AWS_SECRET_ACCESS_KEY = credentials("prod-s3-aws-secret-access-key")
}

agent any
agent {
dockerfile {
filename 'scripts/release/common/docker/setup.Dockerfile'
}
}

stages {
stage("create ec2 instance") {
Expand Down
3 changes: 2 additions & 1 deletion scripts/release/test/rpm/run_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ echo
date "+build_release begin TEST stage %Y%m%d_%H%M%S"
echo

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

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

0 comments on commit 38ad53d

Please sign in to comment.