cloudfoundry/stratos

View on GitHub
deploy/ci/console-nightly-releases.yml

Summary

Maintainability
Test Coverage
# Nightly image-build pipeline
# This pipeline builds the images for Helm and generates a nightly Helm chart
---
resource_types:
- name: docker-image
  type: docker-image
  privileged: true
  source:
    repository: ((docker-resource-image))

resources:
- name: midnight
  type: time
  source:
    start: 12:00 AM
    stop: 2:00 AM
- name: stratos
  type: git
  source:
    uri: git@github.com:((stratos-repository-organization))/((stratos-repository))
    branch: ((stratos-repository-branch))
    private_key: ((github-private-key))
- name: helm-repo
  type: git
  source:
    uri: git@github.com:((helm-repo-github-organization))/((helm-repo-github-repository))
    branch: ((helm-repo-branch))
    private_key: ((github-private-key))
# Images
- name: jetstream-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-organization))/stratos-jetstream
- name: config-init-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-organization))/stratos-config-init
- name: mariadb-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-organization))/stratos-mariadb
- name: ui-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-organization))/stratos-console

- name: helm-chart-tarball
  type: s3
  source:
    bucket: ((minio-bucket))
    endpoint: ((minio-server-endpoint))
    regexp: temp-artifacts/console-helm-chart-(?P<version>.*).tgz
    access_key_id: ((minio-access-key))
    secret_access_key: ((minio-secret-access-key))
    region_name: eu-central-1
- name: nightly-gh-release
  type: github-release
  source:
    owner: ((github-artifact-organization))
    repository: ((github-artifact-repository))
    access_token: ((github-access-token))
    pre_release: true
- name: image-tag
  type: s3
  source:
    bucket: ((minio-bucket))
    endpoint: ((minio-server-endpoint))
    regexp: temp-artifacts/release-(.*).tar
    access_key_id: ((minio-access-key))
    secret_access_key: ((minio-secret-access-key))
    region_name: eu-central-1
jobs:
- name: generate-tag-files
  plan:
  - get: stratos
  - get: midnight
    trigger: true
  - do:
    - task: generate-tag
      file: stratos/deploy/ci/tasks/dev-releases/generate-tag-files.yml
    - put: image-tag
      params:
        file: image-tag/*.tar
        acl: public-read
- name: build-images
  plan:
  - get: stratos
    passed: [generate-tag-files]
    trigger: true
  - get: image-tag
    passed: [generate-tag-files]
    params:
      unpack: true
  - aggregate:
    - do:
      - put: jetstream-image
        params:
          dockerfile: stratos/deploy/Dockerfile.bk
          build: stratos/
          target_name:  prod-build
          tag: stratos/deploy/ci/tasks/build-images/nightly-tag
          build_args_file: image-tag/build-args
      - put: mariadb-image
        params:
          dockerfile: stratos/deploy/db/Dockerfile.mariadb
          build: stratos/deploy/db
          tag: stratos/deploy/ci/tasks/build-images/nightly-tag
    - do:
      - put: config-init-image
        params:
          dockerfile: stratos/deploy/Dockerfile.init
          build: stratos/
          tag: stratos/deploy/ci/tasks/build-images/nightly-tag
      - put: ui-image
        params:
          dockerfile: stratos/deploy/Dockerfile.ui
          build: stratos/
          target_name: prod-build
          tag: stratos/deploy/ci/tasks/build-images/nightly-tag
          prebuild_script: build/store-git-metadata.sh
- name: create-chart
  plan:
  - get: stratos
    passed: [build-images]
    trigger: true
  - get: helm-repo
  - do:
    - task: build
      privileged: true
      timeout: 30m
      file: stratos/deploy/ci/tasks/dev-releases/create-nightly-chart.yml
      params:
        GIT_USER: ((concourse-user))
        GIT_EMAIL: ((concourse-email))
        GITHUB_ORG: ((stratos-repository-organization))
        GITHUB_REPO: ((stratos-repository))
        GIT_PRIVATE_KEY: ((github-private-key))
        HELM_REPO_BRANCH: ((helm-repo-branch))
        DOCKER_ORG: ((docker-organization))
        DOCKER_REGISTRY: ((docker-registry))
    - put: helm-chart-tarball
      params:
       file: helm-chart/*.tgz
       acl: public-read
    - put: nightly-gh-release
      params:
        name: stratos/deploy/ci/tasks/dev-releases/nightly-release-name
        tag: stratos/deploy/ci/tasks/build-images/nightly-tag
        body: stratos/deploy/ci/tasks/dev-releases/nightly-release-description
        globs:
        - helm-chart-tarball/*.tgz