cloudfoundry/stratos

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

Summary

Maintainability
Test Coverage
# This pipeline creates an Alpha, Beta or RC release
---
resource_types:
- name: docker-image
  type: docker-image
  privileged: true
  source:
    repository: ((docker-resource-image))
resources:
# Stratos Git Repository
- name: stratos
  type: git
  source:
    uri: git@github.com:((stratos-repository-organization))/((stratos-repository))
    branch: ((stratos-repository-branch))
    private_key: ((github-private-key))
    # Match any Version 4 release (alpha, beta, rc) other than the actual release
    tag_filter: "4*-*"
- 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))
# Docker Images
- name: jetstream-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-repository))/stratos-jetstream
- name: config-init-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-repository))/stratos-config-init
- name: mariadb-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-repository))/stratos-mariadb
- name: ui-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-repository))/stratos-console
- name: kube-terminal-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-repository))/stratos-kube-terminal
- name: analyzers-image
  type: docker-image
  source:
    username: ((docker-username))
    password: ((docker-password))
    repository: ((docker-repository))/stratos-analyzers
    
# Artifacts
- 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
- 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
jobs:
- name: generate-tag-files
  plan:
  - get: stratos
    trigger: true
  - do:
    - task: generate-tag
      file: stratos/deploy/ci/tasks/dev-releases/generate-tag-files.yml
      params:
        TAG_SUFFIX: ((tag-suffix))
    - put: image-tag
      params:
        file: image-tag/*.tar
        acl: public-read
- name: check-github
  plan:
  - get: stratos
    passed: [generate-tag-files]
    trigger: true
  - get: image-tag
    passed: [generate-tag-files] 
    params:
     unpack: true
  - do:
    - task: build
      privileged: true
      timeout: 30m
      file: stratos/deploy/ci/tasks/dev-releases/check-gh-release.yml
      params:
        GITHUB_TOKEN: ((github-access-token))
        GITHUB_USER: ((helm-repo-github-organization))
        GITHUB_REPO: ((helm-repo-github-repository))
        GIT_USER: ((concourse-user))
        GIT_EMAIL: ((concourse-email))
        GIT_PRIVATE_KEY: ((github-private-key))
        TAG_SUFFIX: ((tag-suffix))
- name: build-images
  plan:
  - get: stratos
    passed: [check-github]
    trigger: true
  - get: image-tag
    passed: [check-github]
    params:
      unpack: true
  - aggregate:
    - do:
      - put: jetstream-image
        params:
          dockerfile: stratos/deploy/Dockerfile.bk
          build: stratos/
          target_name:  prod-build
          tag: image-tag/v2-alpha-tag
          build_args_file: image-tag/build-args
          patch_base_reg: ((patch-base-reg))
          patch_base_tag: ((patch-base-tag))
    - do: 
      - put: ui-image
        params:
          dockerfile: stratos/deploy/Dockerfile.ui
          build: stratos/
          target_name: prod-build
          tag: image-tag/v2-alpha-tag
          build_args_file: image-tag/ui-build-args
          patch_base_reg: ((patch-base-reg))
          patch_base_tag: ((patch-base-tag))
    - do:
      - put: mariadb-image
        params:
          dockerfile: stratos/deploy/db/Dockerfile.mariadb
          build: stratos/deploy/db
          tag: image-tag/v2-alpha-tag
          patch_base_reg: ((patch-base-reg))
          patch_base_tag: ((patch-base-tag))
      - put: config-init-image
        params:
          dockerfile: stratos/deploy/Dockerfile.init
          build: stratos/
          tag: image-tag/v2-alpha-tag
          patch_base_reg: ((patch-base-reg))
          patch_base_tag: ((patch-base-tag))
      - put: analyzers-image
        params:
          dockerfile: stratos/src/jetstream/plugins/analysis/container/Dockerfile
          build: stratos/src/jetstream/plugins/analysis/container/
          tag: image-tag/v2-alpha-tag
          patch_base_reg: ((patch-base-reg))
          patch_base_tag: ((patch-base-tag))
      - put: kube-terminal-image
        params:
          dockerfile: stratos/deploy/containers/kube-terminal/Dockerfile.kubeterminal
          build: stratos/deploy/containers/kube-terminal
          tag: image-tag/v2-alpha-tag
          patch_base_reg: ((patch-base-reg))
          patch_base_tag: ((patch-base-tag))

- name: create-chart
  plan:
  - get: stratos
    passed: [build-images]
    trigger: true
  - get: helm-repo
  - get: image-tag
    passed: [build-images]
    params:
      unpack: true
  - do:
    - task: build
      privileged: true
      timeout: 30m
      file: stratos/deploy/ci/tasks/dev-releases/create-chart.yml
      params:
        GIT_USER: ((concourse-user))
        GIT_EMAIL: ((concourse-email))
        GITHUB_ORG: ((helm-repo-github-organization))
        GITHUB_REPO: ((helm-repo-github-repository))
        GIT_PRIVATE_KEY: ((github-private-key))
        DOCKER_ORG: ((docker-organization))
        DOCKER_REGISTRY: ((docker-registry))
        HELM_REPO_PATH: ((helm-repo-path))
        HELM_REPO_BRANCH: ((helm-repo-branch))
        TAG_SUFFIX: ((tag-suffix))
    - put: helm-chart-tarball
      params:
       file: helm-chart/*.tgz
       acl: public-read   
- name: update-github
  plan:
  - get: stratos
    passed: [create-chart]
    trigger: true
  - get: helm-chart-tarball
    passed: [create-chart]
  - get: image-tag
    passed: [create-chart] 
    params:
     unpack: true
  - do:
    - task: build
      privileged: true
      timeout: 30m
      file: stratos/deploy/ci/tasks/dev-releases/update-gh-release.yml
      params:
        GITHUB_TOKEN: ((github-access-token))
        GITHUB_USER: ((helm-repo-github-organization))
        GITHUB_REPO: ((helm-repo-github-repository))
        GIT_USER: ((concourse-user))
        GIT_EMAIL: ((concourse-email))
        GIT_PRIVATE_KEY: ((github-private-key))
        TAG_SUFFIX: ((tag-suffix))