Skip to content

Commit

Permalink
RTC-14144: Transition from GCP Container Registry (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgronberg authored Jan 23, 2024
1 parent 6b065be commit 7db2e21
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.163.1/containers/docker-existing-dockerfile
{
"name": "Docker from Image",
"image": "gcr.io/sym-dev-rtc/buildsmb-el7:latest",
"image": "europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-el7:latest",
"runArgs": [
"--security-opt",
"seccomp=unconfined"
Expand Down
12 changes: 6 additions & 6 deletions Jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ node('be-integration') {
env.VERSION=version
}

docker.image('gcr.io/sym-dev-rtc/buildsmb-el7:latest').inside {
docker.image('europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-el7:latest').inside {
stage('Build Centos 7') {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
Expand All @@ -48,7 +48,7 @@ node('be-integration') {
}
}

docker.image('gcr.io/sym-dev-rtc/buildsmb-el8:latest').inside {
docker.image('europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-el8:latest').inside {
stage('Build RHEL 8') {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
Expand All @@ -60,7 +60,7 @@ node('be-integration') {
}
}

docker.image('gcr.io/sym-dev-rtc/buildsmb-ubuntu-focal:latest').inside {
docker.image('europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-ubuntu-focal:latest').inside {
stage('Build Ubuntu Focal') {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
Expand All @@ -72,7 +72,7 @@ node('be-integration') {
}
}

docker.image('gcr.io/sym-dev-rtc/buildsmb-ubuntu-focal-deb:latest').inside {
docker.image('europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-ubuntu-focal-deb:latest').inside {
stage('Build Ubuntu Focal deb release') {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
Expand All @@ -84,7 +84,7 @@ node('be-integration') {
}
}

docker.image('gcr.io/sym-dev-rtc/buildsmb-aws-linux:latest').inside {
docker.image('europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-aws-linux:latest').inside {
stage('Build AWS linux2 release') {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
Expand All @@ -96,7 +96,7 @@ node('be-integration') {
}
}

docker.image('gcr.io/sym-dev-rtc/buildsmb-el7:latest').inside {
docker.image('europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-el7:latest').inside {
stage('Create archive') {
sh "zip -r ${baseName}-${version}.zip el7/smb/smb el7/smb/versioninfo.txt el7/smb/libs/ el8/smb/smb el8/smb/versioninfo.txt el8/smb/libs/ ubuntu-focal/smb/smb ubuntu-focal/smb/versioninfo.txt ubuntu-focal/smb/libs/ ubuntu-focal-deb/smb/*.tar.gz ubuntu-focal-deb/smb/*.deb aws-linux/smb/versioninfo.txt aws-linux/smb/libs/ aws-linux/smb/smb"
}
Expand Down
4 changes: 2 additions & 2 deletions Jenkins/PRUnitTestRunner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void prRunner(String cmakeBuildType, String platform, String dockerTag) {
}

stage("Build\n[$cmakeBuildType $platform]") {
docker.image("gcr.io/sym-dev-rtc/buildsmb-$platform:$dockerTag").inside {
docker.image("europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-$platform:$dockerTag").inside {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
sh "docker/$platform/buildscript.sh $cmakeBuildType"
Expand All @@ -19,7 +19,7 @@ void prRunner(String cmakeBuildType, String platform, String dockerTag) {
archiveArtifacts artifacts: "$platform/$cmakeBuildType/smb, $platform/$cmakeBuildType/smbobj.txt", allowEmptyArchive: true
}
stage("Test\n[$cmakeBuildType $platform]") {
docker.image("gcr.io/sym-dev-rtc/buildsmb-$platform:$dockerTag").inside {
docker.image("europe-west1-docker.pkg.dev/sym-dev-rtc/rtc-jenkins-tools/buildsmb-$platform:$dockerTag").inside {
env.GIT_COMMITTER_NAME = "Jenkins deployment job"
env.GIT_COMMITTER_EMAIL = "[email protected]"
sh "docker/$platform/runtests.sh"
Expand Down
51 changes: 27 additions & 24 deletions Jenkins/build-push-docker-loadtests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,35 @@
node {
cleanWs()
checkout scm
scmVars = checkout scm
git_hash = scmVars.GIT_COMMIT.substring(0,7)
def scmVars = checkout scm
def gitHash = scmVars.GIT_COMMIT.substring(0,7)
// Defaults to https://console.cloud.google.com/artifacts/docker/sym-dev-rtc/europe-west1/rtc-jenkins-tools?project=sym-dev-rtc
def gcpArtifactsProject = params.GCP_ARTIFACTS_PROJECT ?: "sym-dev-rtc"
def gcpArtifactsRegistry = params.GCP_ARTIFACTS_REGISTRY ?: "europe-west1-docker.pkg.dev"
def gcpArtifactsRepo = params.GCP_ARTIFACTS_REPOSITORY ?: "rtc-jenkins-tools"

dir("./") {
try {
stage("Build") {
sh "./docker/build_loadtest_container.sh"
}
stage("Push") {
gcloud_image_name="gcr.io/$params.GCE_PROJECT_ID/buildsmb-loadtests"
gcloud_image_name_with_ver="$gcloud_image_name:$git_hash"
sh "docker tag buildsmb-loadtests:latest $gcloud_image_name_with_ver"
if (params.GCE_KEY_FILE_PATH != null) {
sh "gcloud auth activate-service-account --key-file=$params.GCE_KEY_FILE_PATH"
}
// TODO: Remove the call for gcloud beta when https://warpdrive-lab.dev.symphony.com/jenkins has up to date gcloud tools
sh "gcloud auth configure-docker || gcloud beta auth configure-docker"
sh "docker push $gcloud_image_name_with_ver"
sh "gcloud container images add-tag -q $gcloud_image_name_with_ver '$gcloud_image_name:latest'"
sh "echo $gcloud_image_name_with_ver successfully uploaded"
}
} finally {
stage("Cleanup") {
sh "docker rmi buildsmb-loadtests || true"
cleanWs()
def imageName = params.IMAGE_NAME ?: "buildsmb-loadtests"
def gcpImageName="${gcpArtifactsRegistry}/${gcpArtifactsProject}/${gcpArtifactsRepo}/${imageName}"
def gcpImageNameWithVer="${gcpImageName}:${gitHash}"

try {
stage("Build") {
sh "./docker/build_loadtest_container.sh"
}
stage("Push") {
sh "docker tag ${imageName}:latest ${gcpImageNameWithVer}"
if (params.GCP_KEY_FILE_PATH != null) {
sh "gcloud auth activate-service-account --key-file=${params.GCP_KEY_FILE_PATH}"
}
sh "gcloud auth configure-docker ${gcpArtifactsRegistry} --quiet"
sh "docker push ${gcpImageNameWithVer}"
sh "gcloud container images add-tag -q ${gcpImageNameWithVer} '${gcpImageName}:latest'"
println "${gcpImageNameWithVer} successfully uploaded"
}
} finally {
stage("Cleanup") {
sh "docker rmi ${imageName}"
cleanWs()
}
}
}
36 changes: 22 additions & 14 deletions Jenkins/build-push-docker.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,40 @@
node {
cleanWs()
checkout scm
scmVars = checkout scm
git_hash = scmVars.GIT_COMMIT.substring(0,7)
def scmVars = checkout scm
def gitHash = scmVars.GIT_COMMIT.substring(0,7)
def gitBranch = scmVars.GIT_BRANCH.split('/')[-1]
// Defaults to https://console.cloud.google.com/artifacts/docker/sym-dev-rtc/europe-west1/rtc-jenkins-tools?project=sym-dev-rtc
def gcpArtifactsProject = params.GCP_ARTIFACTS_PROJECT ?: "sym-dev-rtc"
def gcpArtifactsRegistry = params.GCP_ARTIFACTS_REGISTRY ?: "europe-west1-docker.pkg.dev"
def gcpArtifactsRepo = params.GCP_ARTIFACTS_REPOSITORY ?: "rtc-jenkins-tools"

def imageName = "buildsmb-${params.OSVERSION}"
def gcpImageName="${gcpArtifactsRegistry}/${gcpArtifactsProject}/${gcpArtifactsRepo}/${imageName}"
def gcpImageNameWithVer="${gcpImageName}:${gitHash}"

currentBuild.displayName = "${params.OSVERSION}-${gitBranch}"

dir("./docker") {
try {
lock("jenkins-smb-image-build") {
stage("Build") {
sh "./prepdocker.sh $params.OSVERSION"
sh "./prepdocker.sh ${params.OSVERSION}"
}
stage("Push") {
gcloud_image_name="gcr.io/$params.GCE_PROJECT_ID/buildsmb-$params.OSVERSION"
gcloud_image_name_with_ver="$gcloud_image_name:$git_hash"
sh "docker tag buildsmb-$params.OSVERSION:latest $gcloud_image_name_with_ver"
if (params.GCE_KEY_FILE_PATH != null) {
sh "gcloud auth activate-service-account --key-file=$params.GCE_KEY_FILE_PATH"
sh "docker tag ${imageName}:latest ${gcpImageNameWithVer}"
if (params.GCP_KEY_FILE_PATH != null) {
sh "gcloud auth activate-service-account --key-file=${params.GCP_KEY_FILE_PATH}"
}
// TODO: Remove the call for gcloud beta when https://warpdrive-lab.dev.symphony.com/jenkins has up to date gcloud tools
sh "gcloud auth configure-docker || gcloud beta auth configure-docker"
sh "docker push $gcloud_image_name_with_ver"
sh "gcloud container images add-tag -q $gcloud_image_name_with_ver '$gcloud_image_name:latest'"
sh "echo $gcloud_image_name_with_ver successfully uploaded"
sh "gcloud auth configure-docker ${gcpArtifactsRegistry} --quiet"
sh "docker push ${gcpImageNameWithVer}"
sh "gcloud container images add-tag -q ${gcpImageNameWithVer} '${gcpImageName}:latest'"
println "${gcpImageNameWithVer} successfully uploaded"
}
}
} finally {
stage("Cleanup") {
sh "docker rmi buildsmb-$params.OSVERSION || true"
sh "docker rmi ${imageName}"
cleanWs()
}
}
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu-focal-loadtest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update

RUN apt-get -y install llvm git wget cmake libc++-dev libc++abi-dev clang libtool lcov libssl-dev libsrtp2-dev libmicrohttpd-dev libopus-dev zip curl jq
RUN apt-get -y install llvm git wget cmake libc++-dev libc++abi-dev clang libtool lcov libssl-dev libsrtp2-dev libmicrohttpd-dev libopus-dev zip curl jq lld

RUN useradd -ms /bin/bash builder

Expand Down

0 comments on commit 7db2e21

Please sign in to comment.