diff --git a/Jenkinsfile b/Jenkinsfile index f39f4bc..c2306fa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -75,22 +75,20 @@ pipeline { } stage('Backend') { steps { - withCredentials([string(credentialsId: 'npm-sentry-dsn', variable: 'SENTRY_DSN')]) { - withCredentials([usernamePassword(credentialsId: 'oss-index-token', passwordVariable: 'NANCY_TOKEN', usernameVariable: 'NANCY_USER')]) { - sh './scripts/ci/test-backend' - } - // Build all the golang binaries - sh './scripts/ci/build-backend' - // Build the docker image used for testing below - sh '''docker build --pull --no-cache \\ - -t "${IMAGE}:${BRANCH_LOWER}-ci-${BUILD_NUMBER}" \\ - -f docker/Dockerfile \\ - --build-arg BUILD_COMMIT="${BUILD_COMMIT}" \\ - --build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \\ - --build-arg BUILD_VERSION="${BUILD_VERSION}" \\ - . - ''' + withCredentials([usernamePassword(credentialsId: 'oss-index-token', passwordVariable: 'NANCY_TOKEN', usernameVariable: 'NANCY_USER')]) { + sh './scripts/ci/test-backend' } + // Build all the golang binaries + sh './scripts/ci/build-backend' + // Build the docker image used for testing below + sh '''docker build --pull --no-cache \\ + -t "${IMAGE}:${BRANCH_LOWER}-ci-${BUILD_NUMBER}" \\ + -f docker/Dockerfile \\ + --build-arg BUILD_COMMIT="${BUILD_COMMIT}" \\ + --build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \\ + --build-arg BUILD_VERSION="${BUILD_VERSION}" \\ + . + ''' } post { success { @@ -215,12 +213,10 @@ pipeline { } } steps { - withCredentials([string(credentialsId: 'npm-sentry-dsn', variable: 'SENTRY_DSN')]) { - withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { - sh 'docker login -u "${duser}" -p "${dpass}"' - sh "./scripts/buildx --push ${buildxPushTags}" - // sh './scripts/buildx -o type=local,dest=docker-build' - } + withCredentials([usernamePassword(credentialsId: 'jc21-dockerhub', passwordVariable: 'dpass', usernameVariable: 'duser')]) { + sh 'docker login -u "${duser}" -p "${dpass}"' + sh "./scripts/buildx --push ${buildxPushTags}" + // sh './scripts/buildx -o type=local,dest=docker-build' } } } diff --git a/docker/Dockerfile b/docker/Dockerfile index 5a09ac0..9175aae 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,14 +14,12 @@ ARG BUILD_COMMIT ARG BUILD_VERSION ARG GOPRIVATE ARG GOPROXY -ARG SENTRY_DSN ENV BUILD_COMMIT="${BUILD_COMMIT:-dev}" \ BUILD_VERSION="${BUILD_VERSION:-0.0.0}" \ CGO_ENABLED=0 \ GOPRIVATE="${GOPRIVATE:-}" \ - GOPROXY="${GOPROXY:-}" \ - SENTRY_DSN="${SENTRY_DSN:-}" + GOPROXY="${GOPROXY:-}" COPY scripts /scripts COPY backend /app diff --git a/scripts/buildx b/scripts/buildx index 10fcf62..4ab2847 100755 --- a/scripts/buildx +++ b/scripts/buildx @@ -24,7 +24,6 @@ docker buildx build \ --build-arg SKIP_TESTS=1 \ --build-arg GOPRIVATE="${GOPRIVATE:-}" \ --build-arg GOPROXY="${GOPROXY:-}" \ - --build-arg SENTRY_DSN="${SENTRY_DSN:-}" \ --platform linux/amd64,linux/arm64,linux/arm/7 \ --progress plain \ --pull \ diff --git a/scripts/ci/build-backend b/scripts/ci/build-backend index a8a0349..f266424 100755 --- a/scripts/ci/build-backend +++ b/scripts/ci/build-backend @@ -60,7 +60,7 @@ build_backend() { go build \ -tags 'json1' \ -buildvcs=false \ - -ldflags "-w -s -X main.commit=${BUILD_COMMIT:-notset} -X main.version=${BUILD_VERSION} -X main.sentryDSN=${SENTRY_DSN:-}" \ + -ldflags "-w -s -X main.commit=${BUILD_COMMIT:-notset} -X main.version=${BUILD_VERSION}" \ -o "/app/bin/$FILENAME" \ ./cmd/server } diff --git a/scripts/ci/test-backend b/scripts/ci/test-backend index 94bb5c6..82c8587 100755 --- a/scripts/ci/test-backend +++ b/scripts/ci/test-backend @@ -58,7 +58,6 @@ else -e GOPRIVATE="${GOPRIVATE:-}" \ -e GOPROXY="${GOPROXY:-}" \ -e NOW="$NOW" \ - -e SENTRY_DSN="${SENTRY_DSN:-}" \ -e TZ="${TZ:-Australia/Brisbane}" \ -v "$(pwd):/app" \ -w '/app/backend' \ diff --git a/scripts/go-multiarch-wrapper b/scripts/go-multiarch-wrapper index 1073cee..ef0c9cb 100755 --- a/scripts/go-multiarch-wrapper +++ b/scripts/go-multiarch-wrapper @@ -26,14 +26,14 @@ echo -e "${BLUE}❯ ${CYAN}Building binaries for ${YELLOW}${GOARCH} (${TARGETPLA go build \ -tags 'json1' \ -buildvcs=false \ - -ldflags "-w -s -X main.commit=${BUILD_COMMIT:-notset} -X main.version=${BUILD_VERSION} -X main.sentryDSN=${SENTRY_DSN:-}" \ + -ldflags "-w -s -X main.commit=${BUILD_COMMIT:-notset} -X main.version=${BUILD_VERSION}" \ -o "${1:-/dist/server}" \ ./cmd/server # ipranges go build \ -buildvcs=false \ - -ldflags "-w -s -X main.commit=${BUILD_COMMIT:-notset} -X main.version=${BUILD_VERSION} -X main.sentryDSN=${SENTRY_DSN:-}" \ + -ldflags "-w -s -X main.commit=${BUILD_COMMIT:-notset} -X main.version=${BUILD_VERSION}" \ -o "${2:-/dist/ipranges}" \ ./cmd/ipranges