anchors:
  git-repo-resource-source: &git-repo-resource-source
    uri: ((github-repo))
    username: ((github-username))
    password: ((github-ci-release-token))
    branch: ((branch))
  registry-image-resource-source: &registry-image-resource-source
    username: ((docker-hub-username))
    password: ((docker-hub-password))
  ci-registry-image-resource-source: &ci-registry-image-resource-source
    username: ((docker-hub-username))
    password: ((docker-hub-password))
    tag: ((milestone))
  gradle-enterprise-task-params: &gradle-enterprise-task-params
    GRADLE_ENTERPRISE_ACCESS_KEY: ((gradle_enterprise_secret_access_key))
    GRADLE_ENTERPRISE_CACHE_URL: ((gradle_enterprise_cache_url))
    GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle_enterprise_cache_user.username))
    GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle_enterprise_cache_user.password))
  docker-hub-task-params: &docker-hub-task-params
    DOCKER_HUB_MIRROR: ((docker-hub-mirror))
    DOCKER_HUB_USERNAME: ((docker-hub-username))
    DOCKER_HUB_PASSWORD: ((docker-hub-password))
    DOCKER_HUB_AUTH: ((docker-hub-auth))
  github-task-params: &github-task-params
    GITHUB_REPO: spring-boot
    GITHUB_ORGANIZATION: spring-projects
    GITHUB_PASSWORD: ((github-ci-release-token))
    GITHUB_USERNAME: ((github-username))
    MILESTONE: ((milestone))
  sontatype-task-params: &sonatype-task-params
    SONATYPE_USER_TOKEN: ((sonatype-username))
    SONATYPE_PASSWORD_TOKEN: ((sonatype-password))
    SONATYPE_URL: ((sonatype-url))
    SONATYPE_STAGING_PROFILE_ID: ((sonatype-staging-profile-id))
  artifactory-task-params: &artifactory-task-params
    ARTIFACTORY_SERVER: ((artifactory-server))
    ARTIFACTORY_USERNAME: ((artifactory-username))
    ARTIFACTORY_PASSWORD: ((artifactory-password))
  sdkman-task-params: &sdkman-task-params
    SDKMAN_CONSUMER_KEY: ((sdkman-consumer-key))
    SDKMAN_CONSUMER_TOKEN: ((sdkman-consumer-token))
  build-project-task-params: &build-project-task-params
    privileged: true
    timeout: ((task-timeout))
    file: git-repo/ci/tasks/build-project.yml
    params:
      BRANCH: ((branch))
      <<: *gradle-enterprise-task-params
      <<: *docker-hub-task-params
  run-system-tests-task-params: &run-system-tests-task-params
    privileged: true
    timeout: ((task-timeout))
    file: git-repo/ci/tasks/run-system-tests.yml
    params:
      BRANCH: ((branch))
      <<: *gradle-enterprise-task-params
      <<: *docker-hub-task-params
  artifactory-repo-put-params: &artifactory-repo-put-params
    signing_key: ((signing-key))
    signing_passphrase: ((signing-passphrase))
    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_JOB_NAME}-${BUILD_NAME}"
    disable_checksum_uploads: true
    threads: 8
    artifact_set:
    - include:
      - "/**/spring-boot-docs-*.zip"
      properties:
        "zip.type": "docs"
        "zip.deployed": "false"
  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}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} failed!>
      [$TEXT_FILE_CONTENT]
    text_file: git-repo/build/build-scan-uri.txt
    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}|${BUILD_PIPELINE_NAME} ${BUILD_JOB_NAME} was successful!>
      [$TEXT_FILE_CONTENT]
    text_file: git-repo/build/build-scan-uri.txt
    silent: true
    icon_emoji: ":concourse:"
    username: concourse-ci
  homebrew-tap-repo-resource-source: &homebrew-tap-repo-resource-source
    uri: ((homebrew-tap-repo))
    username: ((github-username))
    password: ((github-ci-release-token))
    branch: main
  gradle-publish-params: &gradle-publish-params
    GRADLE_PUBLISH_KEY: ((gradle-publish-key))
    GRADLE_PUBLISH_SECRET: ((gradle-publish-secret))
resource_types:
- name: registry-image
  type: registry-image
  source:
    <<: *registry-image-resource-source
    repository: concourse/registry-image-resource
    tag: 1.7.1
- name: artifactory-resource
  type: registry-image
  source:
    <<: *registry-image-resource-source
    repository: springio/artifactory-resource
    tag: 0.0.18
- name: github-status-resource
  type: registry-image
  source:
    <<: *registry-image-resource-source
    repository: dpb587/github-status-resource
    tag: master
- name: slack-notification
  type: registry-image
  source:
    <<: *registry-image-resource-source
    repository: cfcommunity/slack-notification-resource
    tag: latest
- name: github-release
  type: registry-image
  source:
    <<: *registry-image-resource-source
    repository: concourse/github-release-resource
    tag: 1.8.0
resources:
- name: git-repo
  type: git
  icon: github
  source:
    <<: *git-repo-resource-source
- name: git-repo-windows
  type: git
  icon: github
  source:
    <<: *git-repo-resource-source
    git_config:
    - name: core.autocrlf
      value: true
- name: github-pre-release
  type: github-release
  icon: briefcase-download-outline
  source:
    owner: spring-projects
    repository: spring-boot
    access_token: ((github-ci-release-token))
    pre_release: true
    release: false
- name: github-release
  type: github-release
  icon: briefcase-download
  source:
    owner: spring-projects
    repository: spring-boot
    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:
    <<: *ci-registry-image-resource-source
    repository: ((docker-hub-organization))/spring-boot-ci
- name: ci-image-jdk20
  type: registry-image
  icon: docker
  source:
    <<: *ci-registry-image-resource-source
    repository: ((docker-hub-organization))/spring-boot-ci-jdk20
- name: ci-image-jdk21
  type: registry-image
  icon: docker
  source:
    <<: *ci-registry-image-resource-source
    repository: ((docker-hub-organization))/spring-boot-ci-jdk21
- name: paketo-builder-base-image
  type: registry-image
  icon: docker
  source:
    repository: paketobuildpacks/builder
    tag: base
- name: artifactory-repo
  type: artifactory-resource
  icon: package-variant
  source:
    uri: ((artifactory-server))
    username: ((artifactory-username))
    password: ((artifactory-password))
    build_name: ((build-name))
    build_number_prefix: "${BUILD_PIPELINE_NAME}-"
    check_limit: 500
- 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: repo-status-jdk20-build
  type: github-status-resource
  icon: eye-check-outline
  source:
    repository: ((github-repo-name))
    access_token: ((github-ci-status-token))
    branch: ((branch))
    context: jdk20-build
- name: repo-status-jdk21-build
  type: github-status-resource
  icon: eye-check-outline
  source:
    repository: ((github-repo-name))
    access_token: ((github-ci-status-token))
    branch: ((branch))
    context: jdk21-build
- name: slack-alert
  type: slack-notification
  icon: slack
  source:
    url: ((slack-webhook-url))
- name: every-wednesday
  type: time
  icon: clock-outline
  source:
    start: 8:00 PM
    stop: 9:00 PM
    days: [Wednesday]
- name: daily
  type: time
  icon: clock-outline
  source: { interval: "24h" }
- name: homebrew-tap-repo
  type: git
  icon: github
  source:
    <<: *homebrew-tap-repo-resource-source
jobs:
- name: build-ci-images
  plan:
  - get: ci-images-git-repo
    trigger: true
  - get: git-repo
  - in_parallel:
    - task: build-ci-image
      privileged: true
      file: git-repo/ci/tasks/build-ci-image.yml
      output_mapping:
        image: ci-image
      vars:
        ci-image-name: ci-image
    - task: build-ci-image-jdk20
      privileged: true
      file: git-repo/ci/tasks/build-ci-image.yml
      output_mapping:
        image: ci-image-jdk20
      vars:
        ci-image-name: ci-image-jdk20
    - task: build-ci-image-jdk21
      privileged: true
      file: git-repo/ci/tasks/build-ci-image.yml
      output_mapping:
        image: ci-image-jdk21
      vars:
        ci-image-name: ci-image-jdk21
  - in_parallel:
    - put: ci-image
      params:
        image: ci-image/image.tar
    - put: ci-image-jdk20
      params:
        image: ci-image-jdk20/image.tar
    - put: ci-image-jdk21
      params:
        image: ci-image-jdk21/image.tar
- name: detect-jdk-updates
  plan:
  - get: git-repo
  - get: every-wednesday
    trigger: true
  - get: ci-image
  - in_parallel:
    - task: detect-jdk17-update
      image: ci-image
      file: git-repo/ci/tasks/detect-jdk-updates.yml
      params:
        <<: *github-task-params
        JDK_VERSION: java17
    - task: detect-jdk20-update
      image: ci-image
      file: git-repo/ci/tasks/detect-jdk-updates.yml
      params:
        <<: *github-task-params
        JDK_VERSION: java20
- name: detect-ubuntu-image-updates
  plan:
  - get: git-repo
  - get: every-wednesday
    trigger: true
  - get: ci-image
  - do:
    - task: detect-ubuntu-image-updates
      image: ci-image
      file: git-repo/ci/tasks/detect-ubuntu-image-updates.yml
      params:
        <<: *github-task-params
- name: detect-docker-updates
  plan:
  - get: git-repo
  - get: every-wednesday
    trigger: true
  - get: ci-image
  - do:
    - task: detect-docker-updates
      image: ci-image
      file: git-repo/ci/tasks/detect-docker-updates.yml
      params:
        <<: *github-task-params
- name: build
  serial: true
  public: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: true
  - put: repo-status-build
    params: { state: "pending", commit: "git-repo" }
  - do:
    - task: build-project
      image: ci-image
      <<: *build-project-task-params
    on_failure:
      do:
      - put: repo-status-build
        params: { state: "failure", commit: "git-repo" }
      - put: slack-alert
        params:
          <<: *slack-fail-params
  - put: repo-status-build
    params: { state: "success", commit: "git-repo" }
  - put: artifactory-repo
    params:
      <<: *artifactory-repo-put-params
    get_params:
      threads: 8
    on_failure:
      do:
      - put: slack-alert
        params:
          <<: *slack-fail-params
  - put: slack-alert
    params:
      <<: *slack-success-params
- name: jdk20-build
  serial: true
  public: true
  plan:
    - get: ci-image-jdk20
    - get: git-repo
      trigger: true
    - put: repo-status-jdk20-build
      params: { state: "pending", commit: "git-repo" }
    - do:
        - task: build-project
          image: ci-image-jdk20
          privileged: true
          timeout: ((task-timeout))
          file: git-repo/ci/tasks/build-project.yml
          params:
            BRANCH: ((branch))
            TOOLCHAIN_JAVA_VERSION: 20
            <<: *gradle-enterprise-task-params
            <<: *docker-hub-task-params
      on_failure:
        do:
          - put: repo-status-jdk20-build
            params: { state: "failure", commit: "git-repo" }
          - put: slack-alert
            params:
              <<: *slack-fail-params
    - put: repo-status-jdk20-build
      params: { state: "success", commit: "git-repo" }
    - put: slack-alert
      params:
        <<: *slack-success-params
- name: jdk21-build
  serial: true
  public: true
  plan:
    - get: ci-image-jdk21
    - get: git-repo
      trigger: true
    - put: repo-status-jdk21-build
      params: { state: "pending", commit: "git-repo" }
    - do:
        - task: build-project
          image: ci-image-jdk21
          privileged: true
          timeout: ((task-timeout))
          file: git-repo/ci/tasks/build-project.yml
          params:
            BRANCH: ((branch))
            TOOLCHAIN_JAVA_VERSION: 21
            <<: *gradle-enterprise-task-params
            <<: *docker-hub-task-params
      on_failure:
        do:
          - put: repo-status-jdk21-build
            params: { state: "failure", commit: "git-repo" }
          - put: slack-alert
            params:
              <<: *slack-fail-params
    - put: repo-status-jdk21-build
      params: { state: "success", commit: "git-repo" }
    - put: slack-alert
      params:
        <<: *slack-success-params
- 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))
          <<: *gradle-enterprise-task-params
      on_failure:
        do:
          - put: slack-alert
            params:
              <<: *slack-fail-params
    - put: slack-alert
      params:
        <<: *slack-success-params
- name: stage-milestone
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: false
  - task: stage
    image: ci-image
    timeout: ((task-timeout))
    file: git-repo/ci/tasks/stage.yml
    params:
      RELEASE_TYPE: M
      <<: *gradle-enterprise-task-params
      <<: *docker-hub-task-params
  - put: artifactory-repo
    params:
      <<: *artifactory-repo-put-params
      repo: libs-staging-local
    get_params:
      threads: 8
  - put: git-repo
    params:
      repository: stage-git-repo
- name: stage-rc
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: false
  - task: stage
    image: ci-image
    timeout: ((task-timeout))
    file: git-repo/ci/tasks/stage.yml
    params:
      RELEASE_TYPE: RC
      <<: *gradle-enterprise-task-params
      <<: *docker-hub-task-params
  - put: artifactory-repo
    params:
      <<: *artifactory-repo-put-params
      repo: libs-staging-local
    get_params:
      threads: 8
  - put: git-repo
    params:
      repository: stage-git-repo
- name: stage-release
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: false
  - task: stage
    image: ci-image
    timeout: ((task-timeout))
    file: git-repo/ci/tasks/stage.yml
    params:
      RELEASE_TYPE: RELEASE
      <<: *gradle-enterprise-task-params
      <<: *docker-hub-task-params
  - put: artifactory-repo
    params:
      <<: *artifactory-repo-put-params
      repo: libs-staging-local
    get_params:
      threads: 8
  - put: git-repo
    params:
      repository: stage-git-repo
- name: promote-milestone
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: false
  - get: artifactory-repo
    trigger: false
    passed: [stage-milestone]
    params:
      download_artifacts: false
      save_build_info: true
  - task: promote
    image: ci-image
    file: git-repo/ci/tasks/promote.yml
    params:
      RELEASE_TYPE: M
      <<: *artifactory-task-params
  - task: generate-changelog
    file: git-repo/ci/tasks/generate-changelog.yml
    params:
      RELEASE_TYPE: M
      GITHUB_USERNAME: ((github-username))
      GITHUB_TOKEN: ((github-ci-release-token))
  - put: github-pre-release
    params:
      name: generated-changelog/tag
      tag: generated-changelog/tag
      body: generated-changelog/changelog.md
- name: promote-rc
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: false
  - get: artifactory-repo
    trigger: false
    passed: [stage-rc]
    params:
      download_artifacts: false
      save_build_info: true
  - task: promote
    image: ci-image
    file: git-repo/ci/tasks/promote.yml
    params:
      RELEASE_TYPE: RC
      <<: *artifactory-task-params
  - task: generate-changelog
    file: git-repo/ci/tasks/generate-changelog.yml
    params:
      RELEASE_TYPE: RC
      GITHUB_USERNAME: ((github-username))
      GITHUB_TOKEN: ((github-ci-release-token))
  - put: github-pre-release
    params:
      name: generated-changelog/tag
      tag: generated-changelog/tag
      body: generated-changelog/changelog.md
- name: promote-release
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
    trigger: false
  - get: artifactory-repo
    trigger: false
    passed: [stage-release]
    params:
      download_artifacts: true
      save_build_info: true
      threads: 8
  - task: promote
    image: ci-image
    file: git-repo/ci/tasks/promote.yml
    params:
      RELEASE_TYPE: RELEASE
      <<: *artifactory-task-params
      <<: *sonatype-task-params
- name: publish-gradle-plugin
  serial: true
  plan:
    - get: ci-image
    - get: git-repo
    - get: artifactory-repo
      trigger: true
      passed: [promote-release]
      params:
        download_artifacts: true
        save_build_info: true
        threads: 8
    - task: publish-gradle-plugin
      image: ci-image
      file: git-repo/ci/tasks/publish-gradle-plugin.yml
      params:
        <<: *gradle-publish-params
- name: create-github-release
  serial: true
  plan:
  - get: ci-image
  - get: git-repo
  - get: artifactory-repo
    trigger: true
    passed: [promote-release]
    params:
      download_artifacts: false
      save_build_info: true
  - 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-changelog/tag
      tag: generated-changelog/tag
      body: generated-changelog/changelog.md
- name: publish-to-sdkman
  serial: true
  plan:
    - get: ci-image
    - get: git-repo
    - get: artifactory-repo
      passed: [create-github-release]
      params:
        download_artifacts: false
        save_build_info: true
    - task: publish-to-sdkman
      image: ci-image
      file: git-repo/ci/tasks/publish-to-sdkman.yml
      params:
        <<: *sdkman-task-params
        RELEASE_TYPE: RELEASE
        BRANCH: ((branch))
        LATEST_GA: false
- name: update-homebrew-tap
  serial: true
  plan:
    - get: ci-image
    - get: git-repo
    - get: homebrew-tap-repo
    - get: artifactory-repo
      passed: [create-github-release]
      params:
        download_artifacts: false
        save_build_info: true
    - task: update-homebrew-tap
      image: ci-image
      file: git-repo/ci/tasks/update-homebrew-tap.yml
      params:
        LATEST_GA: false
    - put: homebrew-tap-repo
      params:
        repository: updated-homebrew-tap-repo
- name: run-system-tests
  serial: true
  public: true
  plan:
    - get: ci-image
    - get: git-repo
    - get: paketo-builder-base-image
      trigger: true
    - get: daily
      trigger: true
    - do:
        - task: run-system-tests
          image: ci-image
          <<: *run-system-tests-task-params
      on_failure:
        do:
          - put: slack-alert
            params:
              <<: *slack-fail-params
    - put: slack-alert
      params:
        <<: *slack-success-params
- name: jdk20-run-system-tests
  serial: true
  public: true
  plan:
    - get: ci-image-jdk20
    - get: git-repo
    - get: paketo-builder-base-image
      trigger: true
    - get: daily
      trigger: true
    - do:
        - task: run-system-tests
          image: ci-image-jdk20
          privileged: true
          timeout: ((task-timeout))
          file: git-repo/ci/tasks/run-system-tests.yml
          params:
            BRANCH: ((branch))
            TOOLCHAIN_JAVA_VERSION: 20
            <<: *gradle-enterprise-task-params
            <<: *docker-hub-task-params
      on_failure:
        do:
          - put: slack-alert
            params:
              <<: *slack-fail-params
    - put: slack-alert
      params:
        <<: *slack-success-params
- name: jdk21-run-system-tests
  serial: true
  public: true
  plan:
    - get: ci-image-jdk21
    - get: git-repo
    - get: paketo-builder-base-image
      trigger: true
    - get: daily
      trigger: true
    - do:
        - task: run-system-tests
          image: ci-image-jdk21
          privileged: true
          timeout: ((task-timeout))
          file: git-repo/ci/tasks/run-system-tests.yml
          params:
            BRANCH: ((branch))
            TOOLCHAIN_JAVA_VERSION: 21
            <<: *gradle-enterprise-task-params
            <<: *docker-hub-task-params
      on_failure:
        do:
          - put: slack-alert
            params:
              <<: *slack-fail-params
    - put: slack-alert
      params:
        <<: *slack-success-params
groups:
- name: "builds"
  jobs: ["build", "jdk20-build", "jdk21-build", "windows-build"]
- name: "releases"
  jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "create-github-release", "publish-gradle-plugin", "publish-to-sdkman", "update-homebrew-tap"]
- name: "system-tests"
  jobs: ["run-system-tests", "jdk20-run-system-tests", "jdk21-run-system-tests"]
- name: "ci-images"
  jobs: ["build-ci-images", "detect-docker-updates", "detect-jdk-updates", "detect-ubuntu-image-updates"]

