Harmonize CI pipeline

This commit is contained in:
Stephane Nicoll
2020-12-17 07:11:59 +01:00
parent d0cb9fc546
commit 35d40e3619
14 changed files with 272 additions and 163 deletions

View File

@@ -1,3 +1,48 @@
anchors:
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"
- "**/initializr-service-sample/**"
artifactory-task-params: &artifactory-task-params
ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
bintray-task-params: &bintray-task-params
BINTRAY_SUBJECT: ((bintray-subject))
BINTRAY_REPO: ((bintray-repo))
BINTRAY_USERNAME: ((bintray-username))
BINTRAY_API_KEY: ((bintray-api-key))
build-project-task-params: &build-project-task-params
privileged: true
timeout: ((task-timeout))
file: git-repo/ci/tasks/build-project.yml
git-repo-resource-source: &git-repo-resource-source
uri: ((github-repo))
username: ((github-username))
password: ((github-password))
branch: ((branch))
registry-image-resource-source: &registry-image-resource-source
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: ((milestone))
slack-fail-params: &slack-fail-params
text: ":concourse-failed: <!here> <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|failure: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
slack-success-params: &slack-success-params
text: ":concourse-succeeded: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|success: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
sontatype-task-params: &sonatype-task-params
SONATYPE_USER_TOKEN: ((sonatype-user-token))
SONATYPE_PASSWORD_TOKEN: ((sonatype-user-token-password))
resource_types:
- name: artifactory-resource
type: registry-image
@@ -22,73 +67,73 @@ resource_types:
resources:
- name: git-repo
type: git
icon: github
source:
uri: ((github-repo))
username: ((github-username))
password: ((github-password))
branch: ((branch))
ignore_paths: ["ci/images/*"]
<<: *git-repo-resource-source
- name: git-repo-windows
type: git
icon: github
source:
uri: ((github-repo))
username: ((github-username))
password: ((github-password))
branch: ((branch))
ignore_paths: ["ci/images/*"]
<<: *git-repo-resource-source
git_config:
- name: core.autocrlf
value: true
- name: git-pull-request
type: pull-request
icon: source-pull
source:
access_token: ((github-ci-pull-request-token))
repo: spring-io/initializr
base: ((branch))
repository: ((github-repo-name))
base_branch: ((branch))
ignore_paths: ["ci/*"]
- name: ci-images-git-repo
type: git
source:
uri: ((github-repo))
branch: ((branch))
paths: ["ci/images/*"]
- name: initializr-ci-image
type: registry-image
source:
repository: springci/initializr-ci-image
username: ((docker-hub-username))
password: ((docker-hub-password))
tag: ((branch))
- name: artifactory-repo
type: artifactory-resource
source:
uri: ((artifactory-server))
username: ((artifactory-username))
password: ((artifactory-password))
build_name: ((build-name))
- name: slack-alert
type: slack-notification
source:
url: ((slack-webhook-url))
- name: repo-status-build
type: github-status-resource
source:
repository: spring-io/initializr
access_token: ((github-ci-status-token))
branch: ((branch))
context: build
- name: github-release
type: github-release
icon: briefcase-download
source:
owner: spring-io
repository: initializr
access_token: ((github-ci-release-token))
pre_release: false
- name: ci-images-git-repo
type: git
icon: github
source:
uri: ((github-repo))
branch: ((branch))
paths: ["ci/images/*"]
- name: ci-image
type: registry-image
icon: docker
source:
<<: *registry-image-resource-source
repository: ((docker-hub-organization))/initializr-ci
- name: artifactory-repo
type: artifactory-resource
icon: package-variant
source:
uri: ((artifactory-server))
username: ((artifactory-username))
password: ((artifactory-password))
build_name: ((build-name))
- name: repo-status-build
type: github-status-resource
icon: eye-check-outline
source:
repository: ((github-repo-name))
access_token: ((github-ci-status-token))
branch: ((branch))
context: build
- name: slack-alert
type: slack-notification
icon: slack
source:
url: ((slack-webhook-url))
- name: daily
type: time
source: {interval: 24h}
icon: clock-outline
source: { interval: "24h" }
jobs:
- name: build-initializr-ci-image
- name: build-ci-image
plan:
- get: ci-images-git-repo
trigger: true
@@ -98,67 +143,48 @@ jobs:
privileged: true
file: git-repo/ci/tasks/build-ci-image.yml
output_mapping:
image: initializr-ci-image
- put: initializr-ci-image
image: ci-image
- put: ci-image
params:
image: initializr-ci-image/image.tar
image: ci-image/image.tar
- name: build
serial: true
public: true
plan:
- get: ci-image
- get: git-repo
trigger: true
- get: initializr-ci-image
- put: repo-status-build
params: { state: "pending", commit: "git-repo" }
- do:
- task: build-project
image: initializr-ci-image
file: git-repo/ci/tasks/build-project.yml
- 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"
- "**/initializr-service-sample/**"
image: ci-image
<<: *build-project-task-params
on_failure:
do:
- put: repo-status-build
params: { state: "failure", commit: "git-repo" }
- put: slack-alert
params:
text: ":concourse-failed: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|failure: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
<<: *slack-fail-params
- put: repo-status-build
params: { state: "success", commit: "git-repo" }
- put: artifactory-repo
params:
<<: *artifactory-repo-put-params
on_failure:
do:
- put: slack-alert
params:
<<: *slack-fail-params
- put: slack-alert
params:
text: ":concourse-succeeded: <https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}|success: ${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME}>"
silent: true
icon_emoji: ":concourse:"
username: concourse-ci
- name: windows-build
serial: true
public: true
plan:
- get: daily
trigger: true
- get: git-repo
resource: git-repo-windows
- task: build-project
tags: [WIN64]
file: git-repo/ci/tasks/build-project-windows.yml
<<: *slack-success-params
- name: build-pull-requests
serial: true
public: true
plan:
- get: initializr-ci-image
- get: ci-image
- get: git-repo
resource: git-pull-request
trigger: true
@@ -169,30 +195,56 @@ jobs:
path: git-repo
status: pending
- task: build-project
image: initializr-ci-image
image: ci-image
file: git-repo/ci/tasks/build-pr-project.yml
on_success:
put: git-pull-request
on_success:
put: git-pull-request
params:
path: git-repo
status: success
on_failure:
put: git-pull-request
params:
path: git-repo
status: failure
- name: windows-build
serial: true
plan:
- get: git-repo
resource: git-repo-windows
- get: daily
trigger: true
- do:
- task: build-project
privileged: true
file: git-repo/ci/tasks/build-project-windows.yml
tags: [ WIN64 ]
timeout: ((task-timeout))
params:
BRANCH: ((branch))
on_failure:
do:
- put: slack-alert
params:
path: git-repo
status: success
on_failure:
put: git-pull-request
params:
path: git-repo
status: failure
<<: *slack-fail-params
- put: slack-alert
params:
<<: *slack-success-params
- name: stage-release
serial: true
plan:
- get: initializr-ci-image
- get: ci-image
- get: git-repo
trigger: false
- task: stage
image: initializr-ci-image
image: ci-image
file: git-repo/ci/tasks/stage.yml
- put: artifactory-repo
params:
<<: *artifactory-params
RELEASE_TYPE: RELEASE
- put: artifactory-repo
params:
<<: *artifactory-repo-put-params
repo: libs-staging-local
- put: git-repo
params:
@@ -200,39 +252,56 @@ jobs:
- name: promote-release
serial: true
plan:
- get: initializr-ci-image
- get: ci-image
- get: git-repo
trigger: false
- get: artifactory-repo
trigger: false
passed: [stage-release]
params:
download_artifacts: false
save_build_info: true
- task: promote
image: initializr-ci-image
image: ci-image
file: git-repo/ci/tasks/promote.yml
params:
ARTIFACTORY_SERVER: ((artifactory-server))
ARTIFACTORY_USERNAME: ((artifactory-username))
ARTIFACTORY_PASSWORD: ((artifactory-password))
- task: generate-release-notes
file: git-repo/ci/tasks/generate-release-notes.yml
RELEASE_TYPE: RELEASE
<<: *artifactory-task-params
<<: *bintray-task-params
- name: sync-to-maven-central
serial: true
plan:
- get: ci-image
- get: git-repo
- get: artifactory-repo
trigger: true
passed: [promote-release]
params:
GITHUB_ORGANIZATION: spring-io
GITHUB_REPO: initializr
download_artifacts: false
save_build_info: true
- task: sync-to-maven-central
image: ci-image
file: git-repo/ci/tasks/sync-to-maven-central.yml
params:
<<: *bintray-task-params
<<: *sonatype-task-params
- task: generate-changelog
file: git-repo/ci/tasks/generate-changelog.yml
params:
RELEASE_TYPE: RELEASE
GITHUB_USERNAME: ((github-username))
GITHUB_TOKEN: ((github-ci-release-token))
- put: github-release
params:
name: generated-release-notes/version
tag: generated-release-notes/version
body: generated-release-notes/body
name: generated-changelog/tag
tag: generated-changelog/tag
body: generated-changelog/changelog.md
groups:
- name: "build"
jobs: ["build", "windows-build"]
- name: "releases"
jobs: ["stage-release", "promote-release"]
jobs: ["stage-release", "promote-release", "sync-to-maven-central"]
- name: "ci-images"
jobs: ["build-initializr-ci-image"]
jobs: ["build-ci-image"]
- name: "pull-requests"
jobs: ["build-pull-requests"]