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