github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+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: v6.*
    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                    - capi-ci/cf-deployment-operations/seed-credhub-asg.yml
   167                    - cli/ci/infrastructure/operations/default-app-memory.yml
   168                    - cli/ci/infrastructure/operations/add-oidc-provider.yml
   169                - task: upload-to-gcs
   170                  file: capi-ci/ci/gcs/upload-to-gcs.yml
   171                  input_mapping:
   172                    environment: terraform
   173                    source-directory: director-state
   174                  params:
   175                    GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   176                    GCP_BUCKET: ((bosh-lite-storage-bucket))
   177                    GCP_PATH: director-state
   178                    USE_ENV_NAMED_SUBDIR: true
   179                - put: ready-pool
   180                  params:
   181                    add: bosh-lite-env-info/
   182                - put: building-pool
   183                  params:
   184                    remove: fake-placeholder-env/
   185              on_failure:
   186                aggregate:
   187                  - task: delete-bosh-lite
   188                    file: capi-ci/ci/bosh-lite/delete-bosh-lite.yml
   189                  - put: slack-alert
   190                    params:
   191                       channel: '#cli-eng'
   192                       text: |
   193                         Creating a bosh-lite failed :(
   194                         ```
   195                         Do the following tasks:
   196                         1.Make sure the bosh-lite is deleted and resources are cleaned up.
   197                         2.Remove the corresponding sha file from building-bosh-lites pool.
   198                         3.Retrigger the create-bosh-lite task in the pipeline.
   199                         Link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
   200                         https://bit.ly/2S5aIov
   201                         ```
   202          on_failure:
   203            aggregate:
   204              - put: terraform
   205                params:
   206                  action: destroy
   207                  env_name_file: terraform/name
   208                  terraform_source: capi-ci/terraform/bosh-lite/
   209                  vars:
   210                    project_id: ((bosh-lite-project-id))
   211                    json_key: ((bosh-lite-gcp-json-key))
   212                    dns_project_id: ((bosh-lite-project-id))
   213                    dns_json_key: ((bosh-lite-gcp-json-key))
   214                    system_domain_suffix: ((bosh-lite-system-domain-suffix))
   215                    dns_zone_name: ((bosh-lite-dns-zone-name))
   216                    region: ((bosh-lite-region))
   217                get_params:
   218                  action: destroy
   219  
   220    - name: delete-bosh-lite
   221      plan:
   222        - aggregate:
   223          - get: destroy-bosh-lite-trigger
   224            version: every
   225            trigger: true
   226          - get: capi-ci
   227          - get: bosh-deployment
   228          - put: deleting-pool
   229            params:
   230              acquire: true
   231        - do:
   232          - task: download-from-gcs
   233            file: capi-ci/ci/gcs/download-from-gcs.yml
   234            input_mapping:
   235              environment: deleting-pool
   236            output_mapping:
   237              destination-directory: director-state
   238            params:
   239              GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   240              GCP_BUCKET: ((bosh-lite-storage-bucket))
   241              GCP_PATH: director-state
   242              USE_ENV_NAMED_SUBDIR: true
   243          - task: delete-bosh-lite
   244            file: capi-ci/ci/bosh-lite/delete-bosh-lite.yml
   245          - put: terraform
   246            params:
   247              action: destroy
   248              env_name_file: deleting-pool/name
   249              terraform_source: capi-ci/terraform/bosh-lite/
   250              vars:
   251                project_id: ((bosh-lite-project-id))
   252                json_key: ((bosh-lite-gcp-json-key))
   253                dns_project_id: ((bosh-lite-project-id))
   254                dns_json_key: ((bosh-lite-gcp-json-key))
   255                system_domain_suffix: ((bosh-lite-system-domain-suffix))
   256                dns_zone_name: ((bosh-lite-dns-zone-name))
   257                region: ((bosh-lite-region))
   258            get_params:
   259              action: destroy
   260          - task: delete-from-gcs
   261            file: capi-ci/ci/gcs/delete-from-gcs.yml
   262            input_mapping:
   263              environment: deleting-pool
   264            params:
   265              GCP_JSON_KEY: ((bosh-lite-gcp-json-key))
   266              GCP_BUCKET: ((bosh-lite-storage-bucket))
   267              GCP_PATH: director-state
   268              USE_ENV_NAMED_SUBDIR: true
   269          - put: deleting-pool
   270            params:
   271              remove: deleting-pool/
   272  
   273    - name: check-pool-size
   274      build_logs_to_retain: 100
   275      plan:
   276        - aggregate:
   277          - get: capi-ci
   278          - get: pool-repo
   279          - get: 5m
   280            trigger: true
   281        - task: check-pool-size
   282          file: capi-ci/ci/bosh-lite/check-pool-size.yml
   283          input_mapping:
   284            env-pool: pool-repo
   285          params:
   286            MIN_UNCLAIMED_COUNT: 1
   287            GIT_USERNAME: ((git-username))
   288            GIT_EMAIL: ((git-email))
   289        - put: pool-repo
   290          params:
   291            repository: updated-env-pool
   292            rebase: true