Commit 3a8d1738 authored by Phillip Webb's avatar Phillip Webb

Reduce repetition in CI pipeline.yml

Use YAML anchors and aliases to reduce the amount of repetition
in our CI pipeline YAML.

Closes gh-21716
parent ce13235e
anchors:
git-repo-resource-source: &git-repo-resource-source
uri: ((github-repo))
username: ((github-username))
password: ((github-password))
branch: ((branch))
docker-resource-source: &docker-resource-source
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: ((branch))
build-project-task-params: &build-project-task-params
privileged: true
timeout: ((task-timeout))
file: git-repo/ci/tasks/build-project.yml
github-task-params: &github-task-params
GITHUB_REPO: spring-boot
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
MILESTONE: ((milestone))
bintray-task-params: &bintray-task-params
BINTRAY_SUBJECT: ((bintray-subject))
BINTRAY_REPO: ((bintray-repo))
BINTRAY_USERNAME: ((bintray-username))
BINTRAY_API_KEY: ((bintray-api-key))
sontatype-task-params: &sonatype-task-params
SONATYPE_USER_TOKEN: ((sonatype-user-token))
SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password))
artifactory-task-params: &artifactory-task-params
ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
artifactory-repo-put-params: &artifactory-repo-put-params
repo: libs-snapshot-local
folder: distribution-repository
build_uri: "https://ci.spring.io/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
exclude:
- "**/*.effective-pom"
artifact_set:
- include:
- "/**/spring-boot-docs-*.zip"
properties:
"zip.type": "docs"
"zip.deployed": "false"
resource_types: resource_types:
- name: artifactory-resource - name: artifactory-resource
type: docker-image type: docker-image
...@@ -23,18 +69,12 @@ resources: ...@@ -23,18 +69,12 @@ resources:
type: git type: git
icon: github-circle icon: github-circle
source: source:
uri: ((github-repo)) <<: *git-repo-resource-source
username: ((github-username))
password: ((github-password))
branch: ((branch))
- name: git-repo-windows - name: git-repo-windows
type: git type: git
icon: github-circle icon: github-circle
source: source:
uri: ((github-repo)) <<: *git-repo-resource-source
username: ((github-username))
password: ((github-password))
branch: ((branch))
git_config: git_config:
- name: core.autocrlf - name: core.autocrlf
value: true value: true
...@@ -74,18 +114,14 @@ resources: ...@@ -74,18 +114,14 @@ resources:
type: docker-image type: docker-image
icon: docker icon: docker
source: source:
<<: *docker-resource-source
repository: ((docker-hub-organization))/spring-boot-ci-image repository: ((docker-hub-organization))/spring-boot-ci-image
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: ((branch))
- name: spring-boot-jdk11-ci-image - name: spring-boot-jdk11-ci-image
type: docker-image type: docker-image
icon: docker icon: docker
source: source:
<<: *docker-resource-source
repository: ((docker-hub-organization))/spring-boot-jdk11-ci-image repository: ((docker-hub-organization))/spring-boot-jdk11-ci-image
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: ((branch))
- name: artifactory-repo - name: artifactory-repo
type: artifactory-resource type: artifactory-resource
icon: package-variant icon: package-variant
...@@ -149,22 +185,14 @@ jobs: ...@@ -149,22 +185,14 @@ jobs:
- task: detect-jdk8-update - task: detect-jdk8-update
file: git-repo/ci/tasks/detect-jdk-updates.yml file: git-repo/ci/tasks/detect-jdk-updates.yml
params: params:
GITHUB_REPO: spring-boot <<: *github-task-params
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
JDK_VERSION: java8 JDK_VERSION: java8
MILESTONE: ((milestone))
image: spring-boot-ci-image image: spring-boot-ci-image
- task: detect-jdk11-update - task: detect-jdk11-update
file: git-repo/ci/tasks/detect-jdk-updates.yml file: git-repo/ci/tasks/detect-jdk-updates.yml
params: params:
GITHUB_REPO: spring-boot <<: *github-task-params
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
JDK_VERSION: java11 JDK_VERSION: java11
MILESTONE: ((milestone))
image: spring-boot-ci-image image: spring-boot-ci-image
- name: detect-ubuntu-image-updates - name: detect-ubuntu-image-updates
plan: plan:
...@@ -176,11 +204,7 @@ jobs: ...@@ -176,11 +204,7 @@ jobs:
- task: detect-ubuntu-image-updates - task: detect-ubuntu-image-updates
file: git-repo/ci/tasks/detect-ubuntu-image-updates.yml file: git-repo/ci/tasks/detect-ubuntu-image-updates.yml
params: params:
GITHUB_REPO: spring-boot <<: *github-task-params
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
MILESTONE: ((milestone))
image: spring-boot-ci-image image: spring-boot-ci-image
- name: detect-docker-updates - name: detect-docker-updates
plan: plan:
...@@ -192,11 +216,7 @@ jobs: ...@@ -192,11 +216,7 @@ jobs:
- task: detect-docker-updates - task: detect-docker-updates
file: git-repo/ci/tasks/detect-docker-updates.yml file: git-repo/ci/tasks/detect-docker-updates.yml
params: params:
GITHUB_REPO: spring-boot <<: *github-task-params
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
MILESTONE: ((milestone))
image: spring-boot-ci-image image: spring-boot-ci-image
- name: build - name: build
serial: true serial: true
...@@ -209,10 +229,8 @@ jobs: ...@@ -209,10 +229,8 @@ jobs:
params: { state: "pending", commit: "git-repo" } params: { state: "pending", commit: "git-repo" }
- do: - do:
- task: build-project - task: build-project
privileged: true <<: *build-project-task-params
timeout: ((task-timeout))
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/build-project.yml
- in_parallel: - in_parallel:
- task: build-samples - task: build-samples
timeout: ((task-timeout)) timeout: ((task-timeout))
...@@ -239,20 +257,8 @@ jobs: ...@@ -239,20 +257,8 @@ jobs:
- put: repo-status-build - put: repo-status-build
params: { state: "success", commit: "git-repo" } params: { state: "success", commit: "git-repo" }
- put: artifactory-repo - put: artifactory-repo
params: &artifactory-params params:
repo: libs-snapshot-local <<: *artifactory-repo-put-params
folder: distribution-repository
build_uri: "https://ci.spring.io/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
exclude:
- "**/*.effective-pom"
artifact_set:
- include:
- "/**/spring-boot-docs-*.zip"
properties:
"zip.type": "docs"
"zip.deployed": "false"
on_failure: on_failure:
do: do:
- put: slack-alert - put: slack-alert
...@@ -319,10 +325,8 @@ jobs: ...@@ -319,10 +325,8 @@ jobs:
params: { state: "pending", commit: "git-repo" } params: { state: "pending", commit: "git-repo" }
- do: - do:
- task: build-project - task: build-project
privileged: true <<: *build-project-task-params
timeout: ((task-timeout))
image: spring-boot-jdk11-ci-image image: spring-boot-jdk11-ci-image
file: git-repo/ci/tasks/build-project.yml
- in_parallel: - in_parallel:
- task: build-samples - task: build-samples
timeout: ((task-timeout)) timeout: ((task-timeout))
...@@ -395,7 +399,7 @@ jobs: ...@@ -395,7 +399,7 @@ jobs:
RELEASE_TYPE: M RELEASE_TYPE: M
- put: artifactory-repo - put: artifactory-repo
params: params:
<<: *artifactory-params <<: *artifactory-repo-put-params
repo: libs-staging-local repo: libs-staging-local
- put: git-repo - put: git-repo
params: params:
...@@ -413,7 +417,7 @@ jobs: ...@@ -413,7 +417,7 @@ jobs:
RELEASE_TYPE: RC RELEASE_TYPE: RC
- put: artifactory-repo - put: artifactory-repo
params: params:
<<: *artifactory-params <<: *artifactory-repo-put-params
repo: libs-staging-local repo: libs-staging-local
- put: git-repo - put: git-repo
params: params:
...@@ -431,7 +435,7 @@ jobs: ...@@ -431,7 +435,7 @@ jobs:
RELEASE_TYPE: RELEASE RELEASE_TYPE: RELEASE
- put: artifactory-repo - put: artifactory-repo
params: params:
<<: *artifactory-params <<: *artifactory-repo-put-params
repo: libs-staging-local repo: libs-staging-local
- put: git-repo - put: git-repo
params: params:
...@@ -453,9 +457,7 @@ jobs: ...@@ -453,9 +457,7 @@ jobs:
file: git-repo/ci/tasks/promote.yml file: git-repo/ci/tasks/promote.yml
params: params:
RELEASE_TYPE: M RELEASE_TYPE: M
ARTIFACTORY_SERVER: ((artifactory-server)) <<: *artifactory-task-params
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
- task: generate-release-notes - task: generate-release-notes
file: git-repo/ci/tasks/generate-release-notes.yml file: git-repo/ci/tasks/generate-release-notes.yml
params: params:
...@@ -484,9 +486,7 @@ jobs: ...@@ -484,9 +486,7 @@ jobs:
file: git-repo/ci/tasks/promote.yml file: git-repo/ci/tasks/promote.yml
params: params:
RELEASE_TYPE: RC RELEASE_TYPE: RC
ARTIFACTORY_SERVER: ((artifactory-server)) <<: *artifactory-task-params
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
- task: generate-release-notes - task: generate-release-notes
file: git-repo/ci/tasks/generate-release-notes.yml file: git-repo/ci/tasks/generate-release-notes.yml
params: params:
...@@ -515,13 +515,8 @@ jobs: ...@@ -515,13 +515,8 @@ jobs:
file: git-repo/ci/tasks/promote.yml file: git-repo/ci/tasks/promote.yml
params: params:
RELEASE_TYPE: RELEASE RELEASE_TYPE: RELEASE
ARTIFACTORY_SERVER: ((artifactory-server)) <<: *artifactory-task-params
ARTIFACTORY_USERNAME: ((artifactory-username)) <<: *bintray-task-params
ARTIFACTORY_PASSWORD: ((artifactory-password))
BINTRAY_SUBJECT: ((bintray-subject))
BINTRAY_REPO: ((bintray-repo))
BINTRAY_USERNAME: ((bintray-username))
BINTRAY_API_KEY: ((bintray-api-key))
- name: sync-to-maven-central - name: sync-to-maven-central
serial: true serial: true
plan: plan:
...@@ -537,12 +532,8 @@ jobs: ...@@ -537,12 +532,8 @@ jobs:
image: spring-boot-ci-image image: spring-boot-ci-image
file: git-repo/ci/tasks/sync-to-maven-central.yml file: git-repo/ci/tasks/sync-to-maven-central.yml
params: params:
BINTRAY_USERNAME: ((bintray-username)) <<: *bintray-task-params
BINTRAY_API_KEY: ((bintray-api-key)) <<: *sonatype-task-params
SONATYPE_USER_TOKEN: ((sonatype-user-token))
SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password))
BINTRAY_SUBJECT: ((bintray-subject))
BINTRAY_REPO: ((bintray-repo))
- task: generate-release-notes - task: generate-release-notes
file: git-repo/ci/tasks/generate-release-notes.yml file: git-repo/ci/tasks/generate-release-notes.yml
params: params:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment