Migrate to new image repositories

This commit is contained in:
Gareth Clay
2024-05-13 10:51:14 +01:00
committed by Roy Clarkson
parent 460dcc2a41
commit 8d66bdfe6a
15 changed files with 89 additions and 650 deletions

View File

@@ -1,4 +1,4 @@
#App Broker CI Pipeline
# App Broker CI Pipeline
## Running the acceptance tests on Cloud Foundry locally
@@ -36,7 +36,7 @@ The original pipeline was decomposed into different jobs so that we could recove
### Fly
The pipeline can be run using the following script:
The pipeline can be set using the following script on the most recent branch of the repository:
```$bash
$ ./scripts/set-pipelines.sh
@@ -49,22 +49,22 @@ If you don't want to click, you can trigger each job using the CLI:
To release a milestone:
```$bash
$ fly -t scs trigger-job -j release-test/stage-milestone
$ fly -t scs trigger-job -j release-test/promote-milestone
$ fly -t app-broker trigger-job -j release-test/stage-milestone
$ fly -t app-broker trigger-job -j release-test/promote-milestone
```
To release an RC:
```$bash
$ fly -t scs trigger-job -j release-test/stage-rc
$ fly -t scs trigger-job -j release-test/promote-rc
$ fly -t app-broker trigger-job -j release-test/stage-rc
$ fly -t app-broker trigger-job -j release-test/promote-rc
```
To release a GA:
```$bash
$ fly -t scs trigger-job -j release-test/stage-release
$ fly -t scs trigger-job -j release-test/promote-release
$ fly -t scs trigger-job -j release-test/distribute-release
$ fly -t scs trigger-job -j release-test/sync-to-maven-central
$ fly -t app-broker trigger-job -j release-test/stage-release
$ fly -t app-broker trigger-job -j release-test/promote-release
$ fly -t app-broker trigger-job -j release-test/distribute-release
$ fly -t app-broker trigger-job -j release-test/sync-to-maven-central
```

View File

@@ -1,5 +0,0 @@
artifactory-server: https://repo.spring.io
build-name: spring-cloud-app-broker
ab-slack-success-channel: "#sc-app-broker"
ab-slack-failure-channel: "#sc-app-broker"
github-repo: https://github.com/spring-cloud/spring-cloud-app-broker

View File

@@ -1,367 +0,0 @@
---
aliases:
- &slack-success-notification
put: alert
params:
icon_emoji: ":concourse:"
username: concourse
channel: ((ab-slack-success-channel))
text: "`$BUILD_PIPELINE_NAME ((branch))` 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: ((ab-slack-failure-channel))
text: "<!here> Build <${ATC_EXTERNAL_URL}/builds/$BUILD_ID|$BUILD_NAME> of job `$BUILD_JOB_NAME` in the `$BUILD_PIPELINE_NAME ((branch))` pipeline has failed!"
jobs:
- name: build-ci-images
plan:
- get: weekly
trigger: true
- get: ci-images-git-repo
trigger: true
- task: build-image
privileged: true
tags: [ btrfs ]
config:
platform: linux
image_resource:
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/concourse/oci-build-task
tag: 0.10.0
inputs:
- name: source
outputs:
- name: image
run:
path: build
input_mapping:
source: ci-images-git-repo
params:
CONTEXT: source/ci/images/app-broker-ci
- put: app-broker-ci-image
inputs: detect
params:
image: image/image.tar
get_params:
skip_download: true
on_failure: *slack-failure-notification
- name: build
serial: true
public: true
plan:
- get: nightly
trigger: true
- 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}/builds/${BUILD_ID}"
build_number: "${BUILD_PIPELINE_NAME}-((branch))-${BUILD_JOB_NAME}-${BUILD_NAME}"
disable_checksum_uploads: true
artifact_set:
- include:
- /**/*.zip
properties:
zip.name: spring-cloud-app-broker
zip.displayname: Spring Cloud App Broker
zip.deployed: false
- include:
- /**/*-docs.zip
properties:
zip.type: docs
on_failure:
*slack-failure-notification
on_error:
*slack-failure-notification
- name: run-acceptance-tests
serial: true
plan:
- in_parallel:
- get: nightly
passed: [build]
trigger: true
- get: git-repo
passed: [build]
trigger: true
- put: cf-environment
params:
action: create
duration: 6h
resource: cf-environment
timeout: 6h
- task: acceptance-tests
file: git-repo/ci/tasks/acceptance-tests.yml
vars:
ci-image-tag: ((ci-image-tag))
on_success:
in_parallel:
- *slack-success-notification
- put: cf-environment
params:
action: release
resource: cf-environment
on_failure:
*slack-failure-notification
on_error:
*slack-failure-notification
- name: stage-milestone
serial: true
plan:
- get: git-repo
passed: [run-acceptance-tests]
- 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-staging
params:
repository: stage-git-repo
- name: stage-rc
serial: true
plan:
- get: git-repo
passed: [run-acceptance-tests]
- 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-staging
params:
repository: stage-git-repo
- name: stage-release
serial: true
plan:
- get: git-repo
passed: [run-acceptance-tests]
- 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-staging
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
- 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
- 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
- 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
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
- name: shepherd
type: registry-image
source:
repository: ((shepherd-image-repository))/shepherd-268822/shepherd2/concourse-resource
tag: v1
resources:
- name: nightly
type: time
icon: calendar-clock
source:
start: 12:00 AM
stop: 1:00 AM
days:
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
location: America/New_York
initial_version: true
- name: weekly
type: time
icon: calendar-clock
source:
start: 12:00 AM
stop: 1:00 AM
days:
- Monday
location: America/New_York
initial_version: true
- 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: git-repo-staging
type: git
source:
uri: ((github-repo))
username: ((github-token))
password: ((github-password))
branch: ((github-username))/staging
- name: ci-images-git-repo
type: git
source:
uri: ((github-repo))
branch: ((branch))
paths: ["ci/images/*"]
- name: app-broker-ci-image
type: registry-image
source:
repository: ((corporate-harbor-registry))/((dockerhub-organization))/app-broker-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))
- name: cf-environment
type: shepherd
source:
url: https://v2.shepherd.run
service-account-key: ((shepherd-service-account-key))
lease:
namespace: spring-cloud-app-broker
pool:
namespace: official
name: cfd
compatibility-mode: environments-app
groups:
- name: "build"
jobs:
- build
- run-acceptance-tests
- name: "milestone"
jobs:
- stage-milestone
- promote-milestone
- name: "rc"
jobs:
- stage-rc
- promote-rc
- name: "release"
jobs:
- stage-release
- promote-release
- sync-to-maven-central
- name: "ci-images"
jobs:
- build-ci-images
- name: "all"
jobs:
- build
- run-acceptance-tests
- stage-milestone
- promote-milestone
- stage-rc
- promote-rc
- stage-release
- promote-release
- sync-to-maven-central
- build-ci-images

View File

@@ -1,65 +0,0 @@
jobs:
- name: manage-pr-pipelines
plan:
- in_parallel:
- get: pipeline-definition
trigger: true
- get: pr
trigger: true
version: every
- task: list-prs
file: pipeline-definition/ci/tasks/list-prs.yml
input_mapping:
git-repo: pipeline-definition
vars:
ci-image-tag: ((ci-image-tag))
- load_var: prs
file: prs/prs.json
- across:
- var: pr
values: ((.:prs))
max_in_flight: all
in_parallel:
- set_pipeline: ((pipeline-name))
file: pipeline-definition/ci/pr-pipeline.yml
var_files:
- pipeline-definition/ci/config-concourse.yml
vars:
ci-image-tag: ((.:pr.baseRefName))
pr:
number: ((.:pr.number))
commit: ((.:pr.headRefOid))
base-branch: ((.:pr.baseRefName))
instance_vars:
pr: ((.:pr.number))
branch: ((.:pr.baseRefName))
author: ((.:pr.author.login))
resource_types:
- name: pull-request
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/teliaoss/github-pr-resource
tag: v0.23.0
resources:
- name: pipeline-definition
type: git
icon: github
source:
uri: ((github-repo))
username: ((github-token))
password: ((github-password))
branch: main
paths:
- ci/pr-pipeline.yml
- ci/config-concourse.yml
- name: pr
type: pull-request
icon: github
source:
repository: ((app-broker-pr-github-pull-requests-repo))
access_token: ((app-broker-pr-github-pull-requests-access-token))
disable_forks: true
required_review_approvals: 1

View File

@@ -1,109 +0,0 @@
---
aliases:
- &slack-success-notification
put: alert
params:
icon_emoji: ":concourse:"
username: concourse
channel: ((ab-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: ((ab-slack-failure-channel))
text: "<!here> 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
plan:
- get: pull-request
trigger: true
version: every
- task: build-project
timeout: 1h30m
file: pull-request/ci/tasks/build-project.yml
input_mapping:
git-repo: pull-request
vars:
ci-image-tag: ((ci-image-tag))
- name: run-acceptance-tests
serial: true
plan:
- in_parallel:
- get: pull-request
passed: [ build ]
trigger: true
- put: cf-environment
params:
action: create
duration: 6h
resource: cf-environment
timeout: 6h
- task: acceptance-tests
file: pull-request/ci/tasks/acceptance-tests.yml
vars:
ci-image-tag: ((ci-image-tag))
input_mapping:
git-repo: pull-request
on_success:
in_parallel:
- *slack-success-notification
- put: cf-environment
params:
action: release
resource: cf-environment
on_failure: *slack-failure-notification
on_error: *slack-failure-notification
resource_types:
- name: pull-request
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/teliaoss/github-pr-resource
tag: latest
- name: slack-notification
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/cfcommunity/slack-notification-resource
tag: latest
- name: shepherd
type: registry-image
source:
repository: ((shepherd-image-repository))/shepherd-268822/shepherd2/concourse-resource
tag: v1
resources:
- name: pull-request
type: pull-request
version:
pr: ((pr.number))
commit: ((pr.commit))
source:
repository: ((app-broker-pr-github-pull-requests-repo))
access_token: ((app-broker-pr-github-pull-requests-access-token))
base_branch: ((pr.base-branch))
disable_forks: true
required_review_approvals: 1
- name: alert
type: slack-notification
source:
url: ((scs-slack-webhook))
- name: cf-environment
type: shepherd
source:
url: https://v2.shepherd.run
service-account-key: ((shepherd-service-account-key))
lease:
namespace: spring-cloud-app-broker
pool:
namespace: official
name: cfd
compatibility-mode: environments-app

View File

@@ -0,0 +1,13 @@
#!/bin/sh
set -eu
export TERM="xterm-256color"
readonly DOCKER_CONFIG_OUTPUT="${DOCKER_CONFIG_OUTPUT:?must be set}"
# Note that we don't use libs.sh here because that script requires bash, and
# we don't have bash in this container image
printf "%s" "$REGISTRY_PASSWORD" | docker login "$REGISTRY" --username "$REGISTRY_USERNAME" --password-stdin
cp -v ~/.docker/config.json "$DOCKER_CONFIG_OUTPUT/"

View File

@@ -3,9 +3,9 @@ platform: linux
image_resource:
type: registry-image
source:
repository: ((corporate-harbor-registry))/((dockerhub-organization))/app-broker-ci
username: ((corporate-harbor-robot-account.username))
password: ((corporate-harbor-robot-account.password))
repository: ((app-broker-dev-docker-registry))/ci/app-broker-ci
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
tag: ((ci-image-tag))
inputs:
- name: git-repo

View File

@@ -0,0 +1,23 @@
platform: linux
image_resource:
type: registry-image
source:
repository: ((app-broker-virtual-docker-registry))/concourse/oci-build-task
tag: 0.11.1
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
inputs:
- name: git-repo
- name: docker-config
outputs:
- name: image
run:
path: build
params:
DEBUG: true
DOCKER_CONFIG: docker-config

View File

@@ -3,9 +3,9 @@ platform: linux
image_resource:
type: registry-image
source:
repository: ((corporate-harbor-registry))/((dockerhub-organization))/app-broker-ci
username: ((corporate-harbor-robot-account.username))
password: ((corporate-harbor-robot-account.password))
repository: ((app-broker-dev-docker-registry))/ci/app-broker-ci
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
tag: ((ci-image-tag))
inputs:
- name: git-repo

View File

@@ -0,0 +1,25 @@
platform: linux
image_resource:
type: registry-image
source:
repository: ((app-broker-virtual-docker-registry))/docker
tag: 26-cli
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
inputs:
- name: git-repo
outputs:
- name: docker-config
run:
path: ci/scripts/generate-docker-credentials.sh
dir: git-repo
params:
DOCKER_CONFIG_OUTPUT: ../docker-config
REGISTRY: ((registry))
REGISTRY_USERNAME: ((registry-username))
REGISTRY_PASSWORD: ((registry-password))

View File

@@ -3,10 +3,10 @@ platform: linux
image_resource:
type: registry-image
source:
repository: ((corporate-harbor-registry))/((dockerhub-organization))/app-broker-ci
repository: ((app-broker-dev-docker-registry))/ci/app-broker-ci
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
tag: ((ci-image-tag))
username: ((corporate-harbor-robot-account.username))
password: ((corporate-harbor-robot-account.password))
inputs:
- name: git-repo

View File

@@ -3,7 +3,9 @@ platform: linux
image_resource:
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/springio/concourse-release-scripts
repository: ((app-broker-virtual-docker-registry))/springio/concourse-release-scripts
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
tag: '0.3.4'
inputs:
- name: git-repo

View File

@@ -3,9 +3,9 @@ platform: linux
image_resource:
type: registry-image
source:
repository: ((corporate-harbor-registry))/((dockerhub-organization))/app-broker-ci
username: ((corporate-harbor-robot-account.username))
password: ((corporate-harbor-robot-account.password))
repository: ((app-broker-dev-docker-registry))/ci/app-broker-ci
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
tag: ((ci-image-tag))
inputs:
- name: git-repo

View File

@@ -3,7 +3,9 @@ platform: linux
image_resource:
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/springio/concourse-release-scripts
repository: ((app-broker-virtual-docker-registry))/springio/concourse-release-scripts
username: ((broadcom-jfrog-artifactory-robot-account.username))
password: ((broadcom-jfrog-artifactory-robot-account.password))
tag: '0.3.4'
inputs:
- name: git-repo

View File

@@ -1,80 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
readonly FLY_TARGET="app-broker"
readonly PIPELINE_NAME_SUFFIX="${PIPELINE_NAME_SUFFIX:-""}"
readonly PIPELINE_TYPE=${1:-""}
[[ "$PIPELINE_NAME_SUFFIX" ]] && DISABLE_SLACK_ALERTING="true" || DISABLE_SLACK_ALERTING="false"
set_branch_pipeline() {
local -r pipeline_name="app-broker${PIPELINE_NAME_SUFFIX:+"-$PIPELINE_NAME_SUFFIX"}"
local -r branches=("main" "2.0.x" "1.6.x" "1.5.x")
for branch in "${branches[@]}"; do
echo "Setting $pipeline_name $branch pipeline..."
fly --target "$FLY_TARGET" set-pipeline \
--pipeline "$pipeline_name" \
--config pipeline.yml \
--load-vars-from config-concourse.yml \
--instance-var "branch=$branch" \
--var "ci-image-tag=$branch" \
--var "disable-slack-alerting=$DISABLE_SLACK_ALERTING" \`
done
}
set_pr_manager_pipeline() {
local -r pipeline_name="app-broker-pull-requests${PIPELINE_NAME_SUFFIX:+"-$PIPELINE_NAME_SUFFIX"}"
echo "Setting PR manager pipeline..."
fly --target "$FLY_TARGET" set-pipeline --pipeline "$pipeline_name" \
--config pr-manager-pipeline.yml \
--load-vars-from config-concourse.yml \
--var ci-image-tag="main" \
--var pipeline-name="$pipeline_name"
}
set_pr_pipeline() {
local -r pr_number="${1:?first argument must be the PR number}"
local -r pipeline_name="app-broker-pr-$pr_number${PIPELINE_NAME_SUFFIX:+"-$PIPELINE_NAME_SUFFIX"}"
echo "Setting PR pipeline for PR $pr_number..."
local -r pr_info="$(gh pr view "$pr_number" --json baseRefName,headRefOid)"
fly --target "$FLY_TARGET" set-pipeline --pipeline "$pipeline_name" \
--config pr-pipeline.yml \
--load-vars-from config-concourse.yml \
--var ci-image-tag="pr-test" \
--var pipeline-name="$pipeline_name" \
--var pr.number="$pr_number" \
--var pr.base-branch="$(jq -r '.baseRefName' <<< "$pr_info")" \
--var pr.commit="$(jq -r '.headRefOid' <<< "$pr_info")"
}
main() {
pushd "$(dirname "$0")/../ci" >/dev/null
case "${PIPELINE_TYPE#--}" in
"branch")
set_branch_pipeline
;;
"pr-manager")
set_pr_manager_pipeline
;;
"pr")
set_pr_pipeline "$2"
;;
*)
set_branch_pipeline
set_pr_manager_pipeline
;;
esac
popd >/dev/null
}
main "$@"