From e8d7cf3b0472635413873c84d7c530cd075ca76c Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Thu, 2 Mar 2023 12:17:36 +0000 Subject: [PATCH] feat: remove unneccessary pipelines --- .github/workflows/production_pipeline.yml | 256 ------------------ .github/workflows/review_pipeline.yml | 172 ------------ .../workflows/review_teardown_pipeline.yml | 92 ------- 3 files changed, 520 deletions(-) delete mode 100644 .github/workflows/production_pipeline.yml delete mode 100644 .github/workflows/review_pipeline.yml delete mode 100644 .github/workflows/review_teardown_pipeline.yml diff --git a/.github/workflows/production_pipeline.yml b/.github/workflows/production_pipeline.yml deleted file mode 100644 index 23bb69c00..000000000 --- a/.github/workflows/production_pipeline.yml +++ /dev/null @@ -1,256 +0,0 @@ -name: Production CI/CD Pipeline - -on: - release: - types: [released] - workflow_dispatch: - -env: - REPO_URL: communitiesuk/submit-social-housing-lettings-and-sales-data - -defaults: - run: - shell: bash - -jobs: - test: - name: Test - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:13.5 - env: - POSTGRES_PASSWORD: password - POSTGRES_USER: postgres - POSTGRES_DB: data_collector - ports: - - 5432:5432 - # Needed because the Postgres container does not provide a health check - # tmpfs makes database faster by using RAM - options: >- - --mount type=tmpfs,destination=/var/lib/postgresql/data - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - env: - RAILS_ENV: test - GEMFILE_RUBY_VERSION: 3.1.1 - DB_HOST: localhost - DB_DATABASE: data_collector - DB_USERNAME: postgres - DB_PASSWORD: password - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} - - steps: - - name: Get latest release with tag - id: latestrelease - run: | - echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/${REPO_URL}/releases/latest | jq '.tag_name' | sed 's/\"//g')" - - - name: Confirm release tag - run: | - echo ${{ steps.latestrelease.outputs.releasetag }} - - - name: Checkout tag - uses: actions/checkout@v3 - with: - ref: ${{ steps.latestrelease.outputs.releasetag }} - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Set up node - uses: actions/setup-node@v3 - with: - cache: yarn - node-version: 16 - - - name: Create database - run: | - bundle exec rake db:prepare - - - name: Compile Assets - run: | - bundle exec rake assets:precompile - - - name: Run tests - run: | - bundle exec rspec --exclude-pattern "features/*" --fail-fast - - feature_test: - name: Feature Tests - if: '!github.event.pull_request.draft' - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:13.5 - env: - POSTGRES_PASSWORD: password - POSTGRES_USER: postgres - POSTGRES_DB: data_collector - ports: - - 5432:5432 - # Needed because the Postgres container does not provide a health check - # tmpfs makes database faster by using RAM - options: >- - --mount type=tmpfs,destination=/var/lib/postgresql/data - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - - env: - RAILS_ENV: test - GEMFILE_RUBY_VERSION: 3.1.1 - DB_HOST: localhost - DB_DATABASE: data_collector - DB_USERNAME: postgres - DB_PASSWORD: password - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - cache: yarn - node-version: 16 - - - name: Create database - run: | - bundle exec rake db:prepare - - - name: Compile assets - run: | - bundle exec rake assets:precompile - - - name: Run tests - run: | - bundle exec rspec spec/features --fail-fast - - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - name: Get latest release with tag - id: latestrelease - run: | - echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/${REPO_URL}/releases/latest | jq '.tag_name' | sed 's/\"//g')" - - - name: Confirm release tag - run: | - echo ${{ steps.latestrelease.outputs.releasetag }} - - - name: Checkout tag - uses: actions/checkout@v3 - with: - ref: ${{ steps.latestrelease.outputs.releasetag }} - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Rubocop - run: | - bundle exec rubocop - - audit: - name: Audit dependencies - runs-on: ubuntu-latest - - steps: - - name: Get latest release with tag - id: latestrelease - run: | - echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/${REPO_URL}/releases/latest | jq '.tag_name' | sed 's/\"//g')" - - - name: Confirm release tag - run: | - echo ${{ steps.latestrelease.outputs.releasetag }} - - - name: Checkout tag - uses: actions/checkout@v3 - with: - ref: ${{ steps.latestrelease.outputs.releasetag }} - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Audit - run: | - bundle exec bundler-audit - - deploy: - name: Deploy - concurrency: "production" - runs-on: ubuntu-latest - environment: "production" - needs: [lint, test, feature_test, audit] - - steps: - - name: Get latest release with tag - id: latestrelease - run: | - echo "::set-output name=releasetag::$(curl -s https://api.github.com/repos/${REPO_URL}/releases/latest | jq '.tag_name' | sed 's/\"//g')" - - - name: Confirm release tag - run: | - echo ${{ steps.latestrelease.outputs.releasetag }} - - - name: Checkout tag - uses: actions/checkout@v3 - with: - ref: ${{ steps.latestrelease.outputs.releasetag }} - - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Deploy - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: ${{ secrets.CF_SPACE }} - CF_ORG: ${{ secrets.CF_ORG }} - APP_NAME: dluhc-core-production - GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} - APP_HOST: ${{ secrets.APP_HOST }} - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} - IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} - EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }} - S3_CONFIG: ${{ secrets.S3_CONFIG }} - CSV_DOWNLOAD_PAAS_INSTANCE: ${{ secrets.CSV_DOWNLOAD_PAAS_INSTANCE }} - SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY - cf set-env $APP_NAME APP_HOST $APP_HOST - cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY - cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE - cf set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE - cf set-env $APP_NAME S3_CONFIG $S3_CONFIG - cf set-env $APP_NAME CSV_DOWNLOAD_PAAS_INSTANCE $CSV_DOWNLOAD_PAAS_INSTANCE - cf set-env $APP_NAME SENTRY_DSN $SENTRY_DSN - cf push $APP_NAME --strategy rolling diff --git a/.github/workflows/review_pipeline.yml b/.github/workflows/review_pipeline.yml deleted file mode 100644 index 5656898bc..000000000 --- a/.github/workflows/review_pipeline.yml +++ /dev/null @@ -1,172 +0,0 @@ -name: Review app pipeline - -concurrency: ${{ github.workflow }}-${{ github.event.pull_request.number }} - -on: - pull_request: - types: - - opened - - synchronize - - reopened - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - postgres: - name: Provision postgres - runs-on: ubuntu-latest - environment: staging - - steps: - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Provision postgres - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: dev - CF_ORG: ${{ secrets.CF_ORG }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf create-service postgres tiny-unencrypted-13 dluhc-core-review-${{ github.event.pull_request.number }}-postgres --wait - - redis: - name: Provision redis - runs-on: ubuntu-latest - environment: staging - - steps: - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Provision redis - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: dev - CF_ORG: ${{ secrets.CF_ORG }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf create-service redis micro-6.x dluhc-core-review-${{ github.event.pull_request.number }}-redis --wait - - deploy: - name: Deploy review app - runs-on: ubuntu-latest - environment: staging - needs: [postgres, redis] - permissions: - issues: write - pull-requests: write - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Setup review app without starting - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: dev - CF_ORG: ${{ secrets.CF_ORG }} - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf push $APP_NAME \ - --manifest ./config/cloud_foundry/review_manifest.yml \ - --no-start - - - name: Set environment variables - env: - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - API_USER: ${{ secrets.API_USER }} - API_KEY: ${{ secrets.API_KEY }} - GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} - RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} - IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} - EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }} - S3_CONFIG: ${{ secrets.S3_CONFIG }} - CSV_DOWNLOAD_PAAS_INSTANCE: ${{ secrets.CSV_DOWNLOAD_PAAS_INSTANCE }} - SENTRY_DSN: ${{ secrets.SENTRY_DSN }} - run: | - cf set-env $APP_NAME API_USER $API_USER - cf set-env $APP_NAME API_KEY $API_KEY - cf set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY - cf set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY - cf set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE - cf set-env $APP_NAME EXPORT_PAAS_INSTANCE "dluhc-core-review-export-bucket" - cf set-env $APP_NAME S3_CONFIG $S3_CONFIG - cf set-env $APP_NAME CSV_DOWNLOAD_PAAS_INSTANCE "dluhc-core-review-csv-bucket" - cf set-env $APP_NAME SENTRY_DSN $SENTRY_DSN - cf set-env $APP_NAME APP_HOST "https://dluhc-core-review-${{ github.event.pull_request.number }}.london.cloudapps.digital" - - - name: Bind postgres service - env: - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - SERVICE_NAME: dluhc-core-review-${{ github.event.pull_request.number }}-postgres - run: | - cf bind-service $APP_NAME $SERVICE_NAME --wait - - - name: Bind redis service - env: - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - SERVICE_NAME: dluhc-core-review-${{ github.event.pull_request.number }}-redis - run: | - cf bind-service $APP_NAME $SERVICE_NAME --wait - - - name: Bind logit drain service - env: - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - SERVICE_NAME: logit-ssl-drain - run: | - cf bind-service $APP_NAME $SERVICE_NAME --wait - - - name: Bind S3 buckets services - env: - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - run: | - cf bind-service $APP_NAME dluhc-core-review-csv-bucket --wait - cf bind-service $APP_NAME dluhc-core-review-export-bucket --wait - cf bind-service $APP_NAME dluhc-core-review-import-bucket --wait - - - name: Start review app - env: - APP_NAME: dluhc-core-review-${{ github.event.pull_request.number }} - run: | - cf restage $APP_NAME - - - name: Comment on PR with URL - uses: unsplash/comment-on-pr@v1.3.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - msg: "Created review app at https://dluhc-core-review-${{ github.event.pull_request.number }}.london.cloudapps.digital" - check_for_duplicate_msg: true - duplicate_msg_pattern: Created review app at* diff --git a/.github/workflows/review_teardown_pipeline.yml b/.github/workflows/review_teardown_pipeline.yml deleted file mode 100644 index 37bdb9aa4..000000000 --- a/.github/workflows/review_teardown_pipeline.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Review app teardown pipeline - -on: - pull_request: - types: - - closed - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - app: - name: Teardown app - runs-on: ubuntu-latest - environment: staging - - steps: - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Teardown app - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: dev - CF_ORG: ${{ secrets.CF_ORG }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf delete dluhc-core-review-${{ github.event.pull_request.number }} -f -r - - postgres: - name: Teardown postgres - runs-on: ubuntu-latest - environment: staging - needs: [app] - - steps: - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Teardown postgres - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: dev - CF_ORG: ${{ secrets.CF_ORG }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf delete-service dluhc-core-review-${{ github.event.pull_request.number }}-postgres --wait -f - - redis: - name: Teardown redis - runs-on: ubuntu-latest - environment: staging - needs: [app] - - steps: - - name: Install Cloud Foundry CLI - run: | - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf8-cli - - - name: Teardown redis - env: - CF_USERNAME: ${{ secrets.CF_USERNAME }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} - CF_SPACE: dev - CF_ORG: ${{ secrets.CF_ORG }} - run: | - cf api $CF_API_ENDPOINT - cf auth - cf target -o $CF_ORG -s $CF_SPACE - cf delete-service dluhc-core-review-${{ github.event.pull_request.number }}-redis --wait -f