github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/ci/cli-dev-bosh-lite/pipeline.yml (about)

     1  resource_types:
     2  - name: slack-notification
     3    type: docker-image
     4    source:
     5      repository: cfcommunity/slack-notification-resource
     6      tag: latest
     7  
     8  - name: terraform
     9    type: docker-image
    10    source:
    11      repository: ljfranklin/terraform-resource
    12      tag: latest
    13  - name: bosh-deployment
    14    type: docker-image
    15    source:
    16      repository: cloudfoundry/bosh-deployment-resource
    17  - name: cron-resource
    18    type: docker-image
    19    source:
    20      repository: cftoolsmiths/cron-test
    21  
    22  resources:
    23    - name: terraform
    24      type: terraform
    25      source:
    26        backend_type: gcs
    27        backend_config:
    28          bucket: ((bosh-lite-storage-bucket))
    29          prefix: terraform_state_files/
    30          credentials: ((bosh-lite-gcp-json-key))
    31    - name: cli
    32      type: git
    33      source:
    34        branch: master
    35        uri: git@github.com:cloudfoundry/cli.git
    36        private_key: ((bosh-lite-pools-github-private-key))
    37    - name: capi-ci
    38      type: git
    39      source:
    40        branch: master
    41        uri: git@github.com:cloudfoundry/capi-ci.git
    42        private_key: ((bosh-lite-pools-github-private-key))
    43    - name: bosh-deployment
    44      type: git
    45      source:
    46        branch: master
    47        uri: git@github.com:cloudfoundry/bosh-deployment.git
    48        private_key: ((bosh-lite-pools-github-private-key))
    49    - name: edge-capi-release
    50      type: s3
    51      source:
    52        bucket: capi-releases
    53        regexp: capi-(.*)-.*-.*.tgz
    54    - name: ready-pool
    55      type: pool
    56      source:
    57        branch: master
    58        uri: ((env-pool-repo))
    59        pool: bosh-lites
    60        private_key: ((bosh-lite-pools-github-private-key))
    61    - name: deleting-pool
    62      type: pool
    63      source:
    64        branch: master
    65        uri: ((env-pool-repo))
    66        pool: bosh-lites-to-be-deleted
    67        private_key: ((bosh-lite-pools-github-private-key))
    68    - name: building-pool
    69      type: pool
    70      source:
    71        branch: master
    72        uri: ((env-pool-repo))
    73        pool: building-bosh-lites
    74        private_key: ((bosh-lite-pools-github-private-key))
    75    - name: pool-repo
    76      type: git
    77      source:
    78        branch: master
    79        uri: ((env-pool-repo))
    80        private_key: ((bosh-lite-pools-github-private-key))
    81    - name: create-bosh-lite-trigger
    82      type: git
    83      source:
    84        branch: master
    85        uri: ((env-pool-repo))
    86        private_key: ((bosh-lite-pools-github-private-key))
    87        paths:
    88          - .trigger-bosh-lites-create # updated by check-pool-size
    89    - name: destroy-bosh-lite-trigger
    90      type: git
    91      source:
    92        branch: master
    93        uri: ((env-pool-repo))
    94        private_key: ((bosh-lite-pools-github-private-key))
    95        paths:
    96          - .trigger-bosh-lites-destroy # updated by unclaim_bosh_lite alias
    97    - name: cf-deployment
    98      type: git
    99      source:
   100        uri: git@github.com:cloudfoundry/cf-deployment.git
   101        private_key: ((bosh-lite-pools-github-private-key))
   102        tag_filter: v*
   103    - name: cf-deploy
   104      type: bosh-deployment
   105      source:
   106        skip_check: true
   107    - name: 5m
   108      type: time
   109      source:
   110        interval: 5m
   111    - name: slack-alert
   112      type: slack-notification
   113      source:
   114        url: ((slack-webhook-url))
   115  
   116  jobs:
   117    - name: create-bosh-lite
   118      plan:
   119        - in_parallel:
   120          - get: capi-ci
   121          - get: bosh-deployment
   122          - get: cf-deployment
   123          - get: cli
   124          - get: create-bosh-lite-trigger
   125            trigger: true
   126          - get: edge-capi-release
   127        - task: generate-fake-env-for-building-pool
   128          file: capi-ci/ci/bosh-lite/generate-fake-env-for-building-pool.yml
   129        - put: building-pool
   130          params:
   131            add_claimed: fake-placeholder-env/
   132        - put: terraform
   133          params:
   134            generate_random_name: true
   135            delete_on_failure: true
   136            terraform_source: capi-ci/terraform/bosh-lite/
   137            vars:
   138              project_id: ((bosh-lite-project-id))
   139              json_key: ((bosh-lite-gcp-json-key))
   140              dns_project_id: ((bosh-lite-project-id))
   141              dns_json_key: ((bosh-lite-gcp-json-key))
   142              system_domain_suffix: ((bosh-lite-system-domain-suffix))
   143              dns_zone_name: ((bosh-lite-dns-zone-name))
   144        - do:
   145            - task: create-bosh-lite
   146              file: capi-ci/ci/bosh-lite/create-bosh-lite.yml
   147              params:
   148                GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   149                GCP_INSTANCE_TYPE: n1-highmem-4
   150            - do:
   151                - task: create-env-vars-file
   152                  file: capi-ci/ci/bosh-lite/create-env-vars-file.yml
   153                - task: upload-cf-assets
   154                  file: capi-ci/ci/bosh-lite/upload-cf-assets.yml
   155                - task: write-bosh-target-file
   156                  file: capi-ci/ci/bosh-lite/write-bosh-target-file.yml
   157                - put: cf-deploy
   158                  params:
   159                    source_file: bosh-target/target.yml
   160                    manifest: cf-deployment/cf-deployment.yml
   161                    var_files:
   162                      edge_capi_url: edge-capi-release/url
   163                    vars_files:
   164                    - bosh-target/vars.yml
   165                    ops_files:
   166                    - capi-ci/cf-deployment-operations/skip-cert-verify.yml
   167                    - capi-ci/cf-deployment-operations/use-latest-stemcell.yml
   168                    - cf-deployment/operations/bosh-lite.yml
   169                    - cf-deployment/operations/use-compiled-releases.yml
   170                    - cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell.yml
   171                    - cf-deployment/operations/test/add-persistent-isolation-segment-diego-cell-bosh-lite.yml
   172                    - cf-deployment/operations/use-internal-lookup-for-route-services.yml
   173                    - capi-ci/cf-deployment-operations/seed-credhub-asg.yml
   174                    - cli/ci/infrastructure/operations/default-app-memory.yml
   175                    - cli/ci/infrastructure/operations/add-oidc-provider.yml
   176                    - cli/ci/infrastructure/operations/add-uaa-client-cf-custom.yml
   177                    - cli/ci/infrastructure/operations/give-cf-admin-clients-read-scope.yml
   178                    - cli/ci/infrastructure/operations/use-edge-capi.yml
   179                - task: upload-to-gcs
   180                  file: capi-ci/ci/gcs/upload-to-gcs.yml
   181                  input_mapping:
   182                    environment: terraform
   183                    source-directory: director-state
   184                  params:
   185                    GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   186                    GCP_BUCKET: ((bosh-lite-storage-bucket))
   187                    GCP_PATH: director-state
   188                    USE_ENV_NAMED_SUBDIR: true
   189                - put: ready-pool
   190                  params:
   191                    add: bosh-lite-env-info/
   192                - put: building-pool
   193                  params:
   194                    remove: fake-placeholder-env/
   195              on_failure:
   196                in_parallel:
   197                  - task: delete-bosh-lite
   198                    file: capi-ci/ci/bosh-lite/delete-bosh-lite.yml
   199          on_failure:
   200            in_parallel:
   201              - put: terraform
   202                params:
   203                  action: destroy
   204                  env_name_file: terraform/name
   205                  terraform_source: capi-ci/terraform/bosh-lite/
   206                  vars:
   207                    project_id: ((bosh-lite-project-id))
   208                    json_key: ((bosh-lite-gcp-json-key))
   209                    dns_project_id: ((bosh-lite-project-id))
   210                    dns_json_key: ((bosh-lite-gcp-json-key))
   211                    system_domain_suffix: ((bosh-lite-system-domain-suffix))
   212                    dns_zone_name: ((bosh-lite-dns-zone-name))
   213                get_params:
   214                  action: destroy
   215              - put: slack-alert
   216                params:
   217                  channel: '#cli-eng'
   218                  text: |
   219                    Creating a bosh-lite failed :(
   220                    ```
   221                    Do the following tasks:
   222                    1.Make sure the bosh-lite is deleted and resources are cleaned up.
   223                    2.Remove the corresponding sha file from building-bosh-lites pool.
   224                    3.Retrigger the create-bosh-lite task in the pipeline.
   225                    Link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
   226                    https://bit.ly/2S5aIov
   227                    ```
   228  
   229    - name: delete-bosh-lite
   230      plan:
   231        - in_parallel:
   232          - get: destroy-bosh-lite-trigger
   233            version: every
   234            trigger: true
   235          - get: capi-ci
   236          - get: bosh-deployment
   237          - put: deleting-pool
   238            params:
   239              acquire: true
   240        - do:
   241          - task: download-from-gcs
   242            file: capi-ci/ci/gcs/download-from-gcs.yml
   243            input_mapping:
   244              environment: deleting-pool
   245            output_mapping:
   246              destination-directory: director-state
   247            params:
   248              GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   249              GCP_BUCKET: ((bosh-lite-storage-bucket))
   250              GCP_PATH: director-state
   251              USE_ENV_NAMED_SUBDIR: true
   252          - task: delete-bosh-lite
   253            file: capi-ci/ci/bosh-lite/delete-bosh-lite.yml
   254          - put: terraform
   255            params:
   256              action: destroy
   257              env_name_file: deleting-pool/name
   258              terraform_source: capi-ci/terraform/bosh-lite/
   259              vars:
   260                project_id: ((bosh-lite-project-id))
   261                json_key: ((bosh-lite-gcp-json-key))
   262                dns_project_id: ((bosh-lite-project-id))
   263                dns_json_key: ((bosh-lite-gcp-json-key))
   264                system_domain_suffix: ((bosh-lite-system-domain-suffix))
   265                dns_zone_name: ((bosh-lite-dns-zone-name))
   266            get_params:
   267              action: destroy
   268          - task: delete-from-gcs
   269            file: capi-ci/ci/gcs/delete-from-gcs.yml
   270            input_mapping:
   271              environment: deleting-pool
   272            params:
   273              GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   274              GCP_BUCKET: ((bosh-lite-storage-bucket))
   275              GCP_PATH: director-state
   276              USE_ENV_NAMED_SUBDIR: true
   277          - put: deleting-pool
   278            params:
   279              remove: deleting-pool/
   280  
   281    - name: check-pool-size
   282      build_logs_to_retain: 100
   283      plan:
   284        - in_parallel:
   285          - get: capi-ci
   286          - get: pool-repo
   287          - get: 5m
   288            trigger: true
   289        - task: check-pool-size
   290          file: capi-ci/ci/bosh-lite/check-pool-size.yml
   291          input_mapping:
   292            env-pool: pool-repo
   293          params:
   294            MIN_UNCLAIMED_COUNT: 3
   295            GIT_USERNAME: ((git-username))
   296            GIT_EMAIL: ((git-email))
   297        - put: pool-repo
   298          params:
   299            repository: updated-env-pool
   300            rebase: true