From 607108c843e2ca6109b6390198b017e32b8d241f Mon Sep 17 00:00:00 2001 From: Gareth Clay Date: Mon, 2 Oct 2023 13:24:36 +0100 Subject: [PATCH] Switch to concourse-release-scripts image The jar file is no longer publicly available. --- ci/README.adoc | 15 +- ci/config-concourse.yml | 4 - ci/images/spring-credhub-ci/Dockerfile | 1 - ci/pipeline.yml | 237 ------------------------- ci/scripts/promote.sh | 11 +- ci/scripts/sync-to-maven-central.sh | 4 +- ci/set-pipelines.sh | 47 ----- ci/tasks/promote.yml | 6 +- ci/tasks/sync-to-maven-central.yml | 6 +- 9 files changed, 11 insertions(+), 320 deletions(-) delete mode 100644 ci/config-concourse.yml delete mode 100644 ci/pipeline.yml delete mode 100755 ci/set-pipelines.sh diff --git a/ci/README.adoc b/ci/README.adoc index 17f191c..2a348a8 100644 --- a/ci/README.adoc +++ b/ci/README.adoc @@ -1,16 +1,3 @@ == CI Pipeline -Set up the Concourse target and login: - -[source] ----- -$ fly -t spring-credhub login -n spring-credhub -c https://runway-ci.eng.vmware.com ----- - -Deploy the pipelines - -[source] ----- -$ ./set-pipelines.sh ----- - +All pipelines are set from the `main` branch. diff --git a/ci/config-concourse.yml b/ci/config-concourse.yml deleted file mode 100644 index cf973e6..0000000 --- a/ci/config-concourse.yml +++ /dev/null @@ -1,4 +0,0 @@ -artifactory-server: https://repo.spring.io -build-name: spring-credhub -spring-credhub-slack-success-channel: "#sc-app-broker" -spring-credhub-slack-failure-channel: "#sc-app-broker" diff --git a/ci/images/spring-credhub-ci/Dockerfile b/ci/images/spring-credhub-ci/Dockerfile index 5194ee3..6d1d12c 100644 --- a/ci/images/spring-credhub-ci/Dockerfile +++ b/ci/images/spring-credhub-ci/Dockerfile @@ -53,4 +53,3 @@ RUN mkdir -p /opt/openjdk && \ WORKDIR /unpack ADD "https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v$CONCOURSE_JAVA_SCRIPTS_VERSION/concourse-java.sh" /opt/ -ADD "https://repo.spring.io/ui/native/snapshot/io/spring/concourse/releasescripts/concourse-release-scripts/$CONCOURSE_RELEASE_SCRIPTS_VERSION/concourse-release-scripts-$CONCOURSE_RELEASE_SCRIPTS_VERSION.jar" /opt/ \ No newline at end of file diff --git a/ci/pipeline.yml b/ci/pipeline.yml deleted file mode 100644 index ad8aba3..0000000 --- a/ci/pipeline.yml +++ /dev/null @@ -1,237 +0,0 @@ ---- -aliases: - - &slack-success-notification - put: alert - params: - icon_emoji: ":concourse:" - username: concourse - channel: ((spring-credhub-slack-success-channel)) - text: "$BUILD_PIPELINE_NAME pipeline has succeeded with build <${ATC_EXTERNAL_URL}/builds/$BUILD_ID|$BUILD_NAME>!" - - &slack-failure-notification - put: alert - params: - icon_emoji: ":animal-1252:" - username: concourse - channel: ((spring-credhub-slack-failure-channel)) - text: Build <${ATC_EXTERNAL_URL}/builds/$BUILD_ID|$BUILD_NAME> of job $BUILD_JOB_NAME in the $BUILD_PIPELINE_NAME pipeline has failed! - -jobs: - - name: build-ci-images - plan: - - get: ci-images-git-repo - trigger: true - - put: spring-credhub-ci-image - params: - build: ci-images-git-repo/ci/images/spring-credhub-ci - get_params: - skip_download: "true" - - - name: build - serial: true - public: true - plan: - - get: git-repo - trigger: true - - task: build-project - timeout: 1h30m - file: git-repo/ci/tasks/build-project.yml - vars: - ci-image-tag: ((ci-image-tag)) - - put: artifactory-repo - params: &artifactory-params - signing_key: ((signing-key)) - signing_passphrase: ((signing-passphrase)) - repo: libs-snapshot-local - folder: distribution-repository - build_uri: "${ATC_EXTERNAL_URL}/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}" - build_number: "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}" - disable_checksum_uploads: true - artifact_set: - - include: - - "/**/*-docs.zip" - properties: - "zip.type": "docs" - "zip.deployed": "false" - on_success: - *slack-success-notification - on_failure: - *slack-failure-notification - - - name: stage-milestone - serial: true - plan: - - get: git-repo - - task: stage - file: git-repo/ci/tasks/stage.yml - vars: - release-type: M - ci-image-tag: ((ci-image-tag)) - - put: artifactory-repo - params: - <<: *artifactory-params - repo: libs-staging-local - - put: git-repo - params: - repository: stage-git-repo - - - name: stage-rc - serial: true - plan: - - get: git-repo - - task: stage - file: git-repo/ci/tasks/stage.yml - vars: - release-type: RC - ci-image-tag: ((ci-image-tag)) - - put: artifactory-repo - params: - <<: *artifactory-params - repo: libs-staging-local - - put: git-repo - params: - repository: stage-git-repo - - - name: stage-release - serial: true - plan: - - get: git-repo - - task: stage - file: git-repo/ci/tasks/stage.yml - vars: - release-type: RELEASE - ci-image-tag: ((ci-image-tag)) - - put: artifactory-repo - params: - <<: *artifactory-params - repo: libs-staging-local - - put: git-repo - params: - repository: stage-git-repo - - - name: promote-milestone - serial: true - plan: - - get: git-repo - - get: artifactory-repo - passed: [stage-milestone] - params: - save_build_info: true - - task: promote - file: git-repo/ci/tasks/promote.yml - vars: - release-type: M - ci-image-tag: ((ci-image-tag)) - - - name: promote-rc - serial: true - plan: - - in_parallel: - - get: git-repo - - get: artifactory-repo - passed: [stage-rc] - params: - save_build_info: true - - task: promote - file: git-repo/ci/tasks/promote.yml - vars: - release-type: RC - ci-image-tag: ((ci-image-tag)) - - - name: promote-release - serial: true - plan: - - in_parallel: - - get: git-repo - - get: artifactory-repo - passed: [stage-release] - params: - save_build_info: true - - task: promote - file: git-repo/ci/tasks/promote.yml - vars: - release-type: RELEASE - ci-image-tag: ((ci-image-tag)) - - - name: sync-to-maven-central - serial: true - plan: - - in_parallel: - - get: git-repo - - get: artifactory-repo - passed: [promote-release] - params: - save_build_info: true - - task: sync-to-maven-central - file: git-repo/ci/tasks/sync-to-maven-central.yml - vars: - ci-image-tag: ((ci-image-tag)) - -resource_types: - - name: artifactory-resource - type: registry-image - source: - repository: ((dockerhub-mirror-registry))/springio/artifactory-resource - tag: 0.0.14 - - - name: slack-notification - type: registry-image - source: - repository: ((dockerhub-mirror-registry))/cfcommunity/slack-notification-resource - tag: latest - -resources: - - name: git-repo - type: git - source: - uri: ((github-repo)) - username: ((github-token)) - password: ((github-password)) - branch: ((branch)) - ignore_paths: ["ci/images/*"] - fetch_tags: true - - - name: ci-images-git-repo - type: git - source: - uri: ((github-repo)) - branch: ((branch)) - paths: ["ci/images/*"] - - - name: spring-credhub-ci-image - type: docker-image - source: - repository: ((corporate-harbor-registry))/((dockerhub-organization))/spring-credhub-ci - username: ((corporate-harbor-robot-account.username)) - password: ((corporate-harbor-robot-account.password)) - tag: ((ci-image-tag)) - - - name: artifactory-repo - type: artifactory-resource - source: - uri: ((artifactory-server)) - username: ((artifactory-username)) - password: ((artifactory-password)) - build_name: ((build-name)) - - - name: alert - type: slack-notification - source: - url: ((scs-slack-webhook)) - -groups: - - name: "builds" - jobs: - - build - - name: "releases" - jobs: - - stage-milestone - - promote-milestone - - stage-rc - - promote-rc - - stage-release - - promote-release - - sync-to-maven-central - - name: "ci-images" - jobs: - - build-ci-images - diff --git a/ci/scripts/promote.sh b/ci/scripts/promote.sh index 97e0e22..54388d0 100755 --- a/ci/scripts/promote.sh +++ b/ci/scripts/promote.sh @@ -1,13 +1,10 @@ #!/bin/bash set -euo pipefail -# shellcheck source=scripts/common.sh -source $(dirname $0)/common.sh +readonly BUILD_INFO_LOCATION="$(pwd)/artifactory-repo/build-info.json" +readonly VERSION=$( jq -r '.buildInfo.modules[0].id' < "$BUILD_INFO_LOCATION" | sed 's/.*:.*:\(.*\)/\1/' ) -version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' ) -export BUILD_INFO_LOCATION=$(pwd)/artifactory-repo/build-info.json - -java -jar /opt/concourse-release-scripts*.jar promote $RELEASE_TYPE $BUILD_INFO_LOCATION +java -jar /concourse-release-scripts.jar promote "$RELEASE_TYPE" "$BUILD_INFO_LOCATION" echo "Promotion complete" -echo $version > version/version +echo "$VERSION" > version/version diff --git a/ci/scripts/sync-to-maven-central.sh b/ci/scripts/sync-to-maven-central.sh index ef5269f..10e1439 100755 --- a/ci/scripts/sync-to-maven-central.sh +++ b/ci/scripts/sync-to-maven-central.sh @@ -4,8 +4,8 @@ set -euo pipefail readonly BUILD_INFO_LOCATION="$(pwd)/artifactory-repo/build-info.json" readonly CONFIG_DIR="$(pwd)/git-repo/ci/config" -java -jar /opt/concourse-release-scripts*.jar \ - --spring.config.location="${CONFIG_DIR}/release-scripts.yml" \ +java -jar /concourse-release-scripts.jar \ + --spring.config.location="$CONFIG_DIR/release-scripts.yml" \ publishToCentral 'RELEASE' "$BUILD_INFO_LOCATION" "artifactory-repo" echo "Sync complete" diff --git a/ci/set-pipelines.sh b/ci/set-pipelines.sh deleted file mode 100755 index 8ce6935..0000000 --- a/ci/set-pipelines.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# -# Copyright 2016-2021 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -set -euo pipefail - -readonly FLY_TARGET="spring-credhub" -readonly GITHUB_REPO="https://github.com/spring-projects/spring-credhub" - -set_pipeline() { - local pipeline_name pipeline_definition branch ci_image_tag - pipeline_name="${1:?pipeline name must be provided}" - pipeline_definition="${2:?pipeline definition file must be provided}" - branch="${3:?branch must be provided}" - ci_image_tag="${4:-$branch}" - - echo "Setting $pipeline_name pipeline..." - fly --target "$FLY_TARGET" set-pipeline \ - --pipeline "$pipeline_name" \ - --config "$pipeline_definition" \ - --load-vars-from config-concourse.yml \ - --var "github-repo=$GITHUB_REPO" \ - --var "branch=$branch" \ - --var "ci-image-tag=$ci_image_tag" -} - -set_pipelines() { - fly -t "$FLY_TARGET" sync - - set_pipeline spring-credhub-2.3.x pipeline.yml 2.3.x spring-credhub-ci -} - -set_pipelines diff --git a/ci/tasks/promote.yml b/ci/tasks/promote.yml index bf01024..ef4a016 100644 --- a/ci/tasks/promote.yml +++ b/ci/tasks/promote.yml @@ -3,10 +3,8 @@ platform: linux image_resource: type: registry-image source: - repository: ((corporate-harbor-registry))/((dockerhub-organization))/spring-credhub-ci - username: ((corporate-harbor-robot-account.username)) - password: ((corporate-harbor-robot-account.password)) - tag: ((ci-image-tag)) + repository: ((dockerhub-mirror-registry))/springio/concourse-release-scripts + tag: '0.3.4' inputs: - name: git-repo - name: artifactory-repo diff --git a/ci/tasks/sync-to-maven-central.yml b/ci/tasks/sync-to-maven-central.yml index c37527e..0b5d009 100644 --- a/ci/tasks/sync-to-maven-central.yml +++ b/ci/tasks/sync-to-maven-central.yml @@ -3,10 +3,8 @@ platform: linux image_resource: type: registry-image source: - repository: ((corporate-harbor-registry))/((dockerhub-organization))/spring-credhub-ci - username: ((corporate-harbor-robot-account.username)) - password: ((corporate-harbor-robot-account.password)) - tag: ((ci-image-tag)) + repository: ((dockerhub-mirror-registry))/springio/concourse-release-scripts + tag: '0.3.4' inputs: - name: git-repo - name: artifactory-repo