diff --git a/docker/Dockerfile b/docker/Dockerfile index 62ebe885ed2934..ccbb489334621e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ -# This is the image to be run -FROM python:2.7.16-slim-buster +ARG PY_VER=2.7.16 +FROM python:${PY_VER}-slim-buster LABEL maintainer="oss@sentry.io" LABEL org.opencontainers.image.title="Sentry" diff --git a/docker/cloudbuild.yaml b/docker/cloudbuild.yaml index 1946a8d467555d..ba40aee75c3827 100644 --- a/docker/cloudbuild.yaml +++ b/docker/cloudbuild.yaml @@ -1,5 +1,6 @@ steps: - name: 'gcr.io/kaniko-project/executor:v0.22.0' + id: builder-image args: [ '--cache=true', '--build-arg', 'SOURCE_COMMIT=$COMMIT_SHA', @@ -8,11 +9,15 @@ steps: ] timeout: 180s - name: 'us.gcr.io/$PROJECT_ID/sentry-builder:$COMMIT_SHA' + id: builder-run env: [ 'SOURCE_COMMIT=$COMMIT_SHA' ] timeout: 360s - name: 'gcr.io/kaniko-project/executor:v0.22.0' + id: runtime-image-py2 + waitFor: + - builder-run args: [ '--cache=true', '--build-arg', 'SOURCE_COMMIT=$COMMIT_SHA', @@ -20,8 +25,22 @@ steps: '-f', './docker/Dockerfile' ] timeout: 300s -# Smoke tests +- name: 'gcr.io/kaniko-project/executor:v0.22.0' + id: runtime-image-py3 + waitFor: + - builder-run + args: [ + '--cache=true', + '--build-arg', 'SOURCE_COMMIT=$COMMIT_SHA', + '--build-arg', 'PY_VER=3.6.10', + '--destination=us.gcr.io/$PROJECT_ID/sentry:$COMMIT_SHA-py3', + '-f', './docker/Dockerfile' + ] + timeout: 300s - name: 'gcr.io/$PROJECT_ID/docker-compose' + id: e2e-test-py2 + waitFor: + - runtime-image-py2 entrypoint: 'bash' env: - 'SENTRY_IMAGE=us.gcr.io/$PROJECT_ID/sentry:$COMMIT_SHA' @@ -33,7 +52,6 @@ steps: - | mkdir onpremise && cd onpremise curl -L "https://github.com/getsentry/onpremise/archive/master.tar.gz" | tar xzf - --strip-components=1 - # The following trick is from https://stackoverflow.com/a/52400857/90297 with great gratuity echo '{"version": "3.4", "networks":{"default":{"external":{"name":"cloudbuild"}}}}' > docker-compose.override.yml ./install.sh set +e @@ -47,7 +65,31 @@ steps: exit $test_return; fi timeout: 450s +- name: 'gcr.io/$PROJECT_ID/docker-compose' + id: e2e-test-py3 + waitFor: + - runtime-image-py3 + - e2e-test-py2 + entrypoint: 'bash' + env: + - 'SENTRY_IMAGE=us.gcr.io/$PROJECT_ID/sentry:$COMMIT_SHA-py3' + - 'SENTRY_TEST_HOST=http://nginx' + - 'CI=1' + args: + - '-e' + - '-c' + - | + mkdir onpremise && cd onpremise + curl -L "https://github.com/getsentry/onpremise/archive/master.tar.gz" | tar xzf - --strip-components=1 + echo '{"version": "3.4", "networks":{"default":{"external":{"name":"cloudbuild"}}}}' > docker-compose.override.yml + ./install.sh + ./test.sh || docker-compose logs nginx web relay + timeout: 450s + - name: 'gcr.io/cloud-builders/docker' + id: docker-push + waitFor: + - e2e-test-py2 secretEnv: ['DOCKER_PASSWORD'] entrypoint: 'bash' args: @@ -66,6 +108,9 @@ steps: docker tag us.gcr.io/$PROJECT_ID/sentry:$COMMIT_SHA getsentry/sentry:latest docker push getsentry/sentry:latest - name: 'node:12' + id: zeus-upload + waitFor: + - builder-run secretEnv: ['ZEUS_HOOK_BASE'] entrypoint: 'bash' args: