diff --git a/infra/base-images/Jenkinsfile b/infra/base-images/Jenkinsfile index 180ec13b5..baed0cdb3 100644 --- a/infra/base-images/Jenkinsfile +++ b/infra/base-images/Jenkinsfile @@ -18,9 +18,24 @@ def dockerOptions="--no-cache" +stage 'Build Docker Images' node { git url: 'https://github.com/google/oss-fuzz/' sh "docker build $dockerOptions --pull -t libfuzzer/base infra/base-images/base" sh "docker build $dockerOptions -t libfuzzer/base-clang infra/base-images/base-clang" sh "docker build $dockerOptions -t libfuzzer/base-fuzzer infra/base-images/base-fuzzer" } + +stage 'Push Docker Images', concurrency: 1 +node { + // login into docker + def username = readFile('/var/secrets/dockerhub-login/username') + def password = readFile('/var/secrets/dockerhub-login/password') + def email = readFile('/var/secrets/dockerhub-login/email') + + // #! is important here to disable default -x. + sh "#!/bin/bash -e\ndocker info\ndocker version\ndocker login -u='${username}' -p='${password}' -e='${email}' https://index.docker.io/v1/" + sh "docker push libfuzzer/base" + sh "docker push libfuzzer/base-clang" + sh "docker push libfuzzer/base-fuzzer" +} diff --git a/infra/jenkins-cluster/jenkins-master.yaml b/infra/jenkins-cluster/jenkins-master.yaml index 93f700eeb..2c001be14 100644 --- a/infra/jenkins-cluster/jenkins-master.yaml +++ b/infra/jenkins-cluster/jenkins-master.yaml @@ -35,6 +35,8 @@ spec: mountPath: "/var/jenkins_home" - name: docker-sock mountPath: "/var/run/docker.sock" + - name: dockerhub-login-secret + mountPath: "/var/secrets/dockerhub-login" livenessProbe: httpGet: path: "/login" @@ -54,3 +56,6 @@ spec: - name: docker-sock hostPath: path: /var/run/docker.sock + - name: dockerhub-login-secret + secret: + secretName: dockerhub-login