From ce13235e76929b780be282440e313ab0253d59c3 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 10 Jun 2020 15:24:04 -0700 Subject: [PATCH 1/2] Polish --- ci/pipeline.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 143c72e387..9708a2f357 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -29,6 +29,7 @@ resources: branch: ((branch)) - name: git-repo-windows type: git + icon: github-circle source: uri: ((github-repo)) username: ((github-username)) From 3a8d173845597e10618f5de578f8a93610288d23 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 10 Jun 2020 15:43:27 -0700 Subject: [PATCH 2/2] 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 --- ci/pipeline.yml | 145 +++++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 77 deletions(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 9708a2f357..434c6cd9ff 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -1,3 +1,49 @@ +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: - name: artifactory-resource type: docker-image @@ -23,18 +69,12 @@ resources: type: git icon: github-circle source: - uri: ((github-repo)) - username: ((github-username)) - password: ((github-password)) - branch: ((branch)) + <<: *git-repo-resource-source - name: git-repo-windows type: git icon: github-circle - source: - uri: ((github-repo)) - username: ((github-username)) - password: ((github-password)) - branch: ((branch)) + source: + <<: *git-repo-resource-source git_config: - name: core.autocrlf value: true @@ -74,18 +114,14 @@ resources: type: docker-image icon: docker source: + <<: *docker-resource-source repository: ((docker-hub-organization))/spring-boot-ci-image - username: ((docker-hub-username)) - password: ((docker-hub-password)) - tag: ((branch)) - name: spring-boot-jdk11-ci-image type: docker-image icon: docker source: + <<: *docker-resource-source repository: ((docker-hub-organization))/spring-boot-jdk11-ci-image - username: ((docker-hub-username)) - password: ((docker-hub-password)) - tag: ((branch)) - name: artifactory-repo type: artifactory-resource icon: package-variant @@ -149,22 +185,14 @@ jobs: - task: detect-jdk8-update file: git-repo/ci/tasks/detect-jdk-updates.yml params: - GITHUB_REPO: spring-boot - GITHUB_ORGANIZATION: spring-projects - GITHUB_PASSWORD: ((github-password)) - GITHUB_USERNAME: ((github-username)) + <<: *github-task-params JDK_VERSION: java8 - MILESTONE: ((milestone)) image: spring-boot-ci-image - task: detect-jdk11-update file: git-repo/ci/tasks/detect-jdk-updates.yml params: - GITHUB_REPO: spring-boot - GITHUB_ORGANIZATION: spring-projects - GITHUB_PASSWORD: ((github-password)) - GITHUB_USERNAME: ((github-username)) + <<: *github-task-params JDK_VERSION: java11 - MILESTONE: ((milestone)) image: spring-boot-ci-image - name: detect-ubuntu-image-updates plan: @@ -176,11 +204,7 @@ jobs: - task: detect-ubuntu-image-updates file: git-repo/ci/tasks/detect-ubuntu-image-updates.yml params: - GITHUB_REPO: spring-boot - GITHUB_ORGANIZATION: spring-projects - GITHUB_PASSWORD: ((github-password)) - GITHUB_USERNAME: ((github-username)) - MILESTONE: ((milestone)) + <<: *github-task-params image: spring-boot-ci-image - name: detect-docker-updates plan: @@ -192,11 +216,7 @@ jobs: - task: detect-docker-updates file: git-repo/ci/tasks/detect-docker-updates.yml params: - GITHUB_REPO: spring-boot - GITHUB_ORGANIZATION: spring-projects - GITHUB_PASSWORD: ((github-password)) - GITHUB_USERNAME: ((github-username)) - MILESTONE: ((milestone)) + <<: *github-task-params image: spring-boot-ci-image - name: build serial: true @@ -209,10 +229,8 @@ jobs: params: { state: "pending", commit: "git-repo" } - do: - task: build-project - privileged: true - timeout: ((task-timeout)) + <<: *build-project-task-params image: spring-boot-ci-image - file: git-repo/ci/tasks/build-project.yml - in_parallel: - task: build-samples timeout: ((task-timeout)) @@ -239,20 +257,8 @@ jobs: - put: repo-status-build params: { state: "success", commit: "git-repo" } - put: artifactory-repo - params: &artifactory-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" + params: + <<: *artifactory-repo-put-params on_failure: do: - put: slack-alert @@ -319,10 +325,8 @@ jobs: params: { state: "pending", commit: "git-repo" } - do: - task: build-project - privileged: true - timeout: ((task-timeout)) + <<: *build-project-task-params image: spring-boot-jdk11-ci-image - file: git-repo/ci/tasks/build-project.yml - in_parallel: - task: build-samples timeout: ((task-timeout)) @@ -395,7 +399,7 @@ jobs: RELEASE_TYPE: M - put: artifactory-repo params: - <<: *artifactory-params + <<: *artifactory-repo-put-params repo: libs-staging-local - put: git-repo params: @@ -413,7 +417,7 @@ jobs: RELEASE_TYPE: RC - put: artifactory-repo params: - <<: *artifactory-params + <<: *artifactory-repo-put-params repo: libs-staging-local - put: git-repo params: @@ -431,7 +435,7 @@ jobs: RELEASE_TYPE: RELEASE - put: artifactory-repo params: - <<: *artifactory-params + <<: *artifactory-repo-put-params repo: libs-staging-local - put: git-repo params: @@ -453,9 +457,7 @@ jobs: file: git-repo/ci/tasks/promote.yml params: RELEASE_TYPE: M - ARTIFACTORY_SERVER: ((artifactory-server)) - ARTIFACTORY_USERNAME: ((artifactory-username)) - ARTIFACTORY_PASSWORD: ((artifactory-password)) + <<: *artifactory-task-params - task: generate-release-notes file: git-repo/ci/tasks/generate-release-notes.yml params: @@ -484,9 +486,7 @@ jobs: file: git-repo/ci/tasks/promote.yml params: RELEASE_TYPE: RC - ARTIFACTORY_SERVER: ((artifactory-server)) - ARTIFACTORY_USERNAME: ((artifactory-username)) - ARTIFACTORY_PASSWORD: ((artifactory-password)) + <<: *artifactory-task-params - task: generate-release-notes file: git-repo/ci/tasks/generate-release-notes.yml params: @@ -515,13 +515,8 @@ jobs: file: git-repo/ci/tasks/promote.yml params: RELEASE_TYPE: RELEASE - ARTIFACTORY_SERVER: ((artifactory-server)) - ARTIFACTORY_USERNAME: ((artifactory-username)) - ARTIFACTORY_PASSWORD: ((artifactory-password)) - BINTRAY_SUBJECT: ((bintray-subject)) - BINTRAY_REPO: ((bintray-repo)) - BINTRAY_USERNAME: ((bintray-username)) - BINTRAY_API_KEY: ((bintray-api-key)) + <<: *artifactory-task-params + <<: *bintray-task-params - name: sync-to-maven-central serial: true plan: @@ -537,12 +532,8 @@ jobs: image: spring-boot-ci-image file: git-repo/ci/tasks/sync-to-maven-central.yml params: - BINTRAY_USERNAME: ((bintray-username)) - BINTRAY_API_KEY: ((bintray-api-key)) - SONATYPE_USER_TOKEN: ((sonatype-user-token)) - SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password)) - BINTRAY_SUBJECT: ((bintray-subject)) - BINTRAY_REPO: ((bintray-repo)) + <<: *bintray-task-params + <<: *sonatype-task-params - task: generate-release-notes file: git-repo/ci/tasks/generate-release-notes.yml params: