Skip to content

UML-2732: Run Lambda in container image and enable integration tests #8

UML-2732: Run Lambda in container image and enable integration tests

UML-2732: Run Lambda in container image and enable integration tests #8

Workflow file for this run

name: "[Workflow] Pull Request Path"
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
on:
pull_request:
branches:
- main
permissions:
actions: read
checks: read
contents: write
deployments: none
issues: none
packages: none
pull-requests: write
repository-projects: none
security-events: write
statuses: none
defaults:
run:
shell: bash
jobs:
pr_label:
runs-on: ubuntu-latest
name: Label PR
steps:
- uses: actions/labeler@main
with:
configuration-path: ".github/labeller.yml"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
branch_name:
name: "Generate a safe branch name"
uses: ministryofjustice/opg-github-workflows/.github/workflows/data-parse-branch-name.yml@main
set_variables:
name: output workflow variables
runs-on: ubuntu-latest
outputs:
environment_terraform_version: ${{ steps.terraform_version_environment.outputs.version }}
semver_tag: ${{ steps.semver_tag.outputs.created_tag }}
steps:
- name: Set terraform version - environment
id: terraform_version_environment
uses: ministryofjustice/opg-github-actions/.github/actions/[email protected]
with:
terraform_directory: "./terraform/environment"
- name: "Semver tag"
id: semver_tag
uses: ministryofjustice/opg-github-actions/.github/actions/[email protected]
with:
prerelease: true
with_v: true
github_token: ${{ secrets.GITHUB_TOKEN }}
terraform_environment_lint:
name: Terraform - Environment - Lint
needs:
- set_variables
uses: ministryofjustice/opg-github-workflows/.github/workflows/[email protected]
with:
terraform_version: ${{ needs.set_variables.outputs.environment_terraform_version }}
tflint_check: false
directory: "./terraform/environment"
python_unit_tests:
name: Python Unit Tests
needs:
- set_variables
uses: ./.github/workflows/_python_unit_tests.yml
docker_build_scan_push:
name: Build, Scan and Push
needs:
- set_variables
- python_unit_tests
- terraform_environment_lint
uses: ./.github/workflows/_docker_build_scan_push.yml
with:
build_latest: false
semver_tag: ${{ needs.set_variables.outputs.semver_tag }}
secrets: inherit
# TODO: Add Integration tests. Pact verfication is probably unnecessary due to to Sirius not changing their API much
# pact_verification:
# runs-on: ubuntu-latest
# needs: terraform_checks
# env:
# # GIT_CONSUMER: << pipeline.parameters.consumer >>
# # GIT_COMMIT_CONSUMER: << pipeline.parameters.consumerversion >>
# PACT_PROVIDER: lpa
# PACT_CONSUMER: sirius
# PACT_BROKER_BASE_URL: https://pact-broker.api.opg.service.justice.gov.uk
# PACT_BROKER_HTTP_AUTH_USER: admin
# steps:
# - uses: actions/checkout@v2
# - name: Pact Install
# run: |
# wget https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.82.3/pact-1.82.3-linux-x86_64.tar.gz
# tar xzf pact-1.82.3-linux-x86_64.tar.gz
# - name: Code artifact login
# working-directory: ./docs/ci_scripts
# run: |
# ./login_code_artifact.sh -a 288342028542 -t pip
# - name: install ci requirements
# working-directory: ./pact
# run: |
# pip3 install -r requirements.txt
# - name: verify pact
# working-directory: ./pact
# run: |
# echo ${API_VERSION}
# python check_pact_deployable.py \
# --provider_base_url="http://localhost:4343" \
# --pact_broker_url="${PACT_BROKER_BASE_URL}" \
# --broker_user_name="admin" \
# --broker_secret_name="pactbroker_admin" \
# --consumer_pacticipant="${PACT_CONSUMER}" \
# --provider_pacticipant="${PACT_PROVIDER}" \
# --api_version="${API_VERSION}" \
# --git_commit_consumer="${GIT_COMMIT_CONSUMER}" \
# --git_commit_provider="${GIT_COMMIT_PROVIDER}" || echo "Failed but because consumer pacts not set up yet"
ephemeral_environment:
name: Create Ephemeral Environment
uses: ministryofjustice/opg-github-workflows/.github/workflows/[email protected]
needs:
- set_variables
- docker_build_scan_push
- branch_name
with:
terraform_version: ${{ needs.set_variables.outputs.environment_terraform_version }}
terraform_directory: "./terraform/environment"
terraform_workspace: ${{ github.event.pull_request.number }}${{ needs.branch_name.outputs.branch_name }}
is_ephemeral: true
workspace_manager_aws_account_id: "050256574573"
workspace_manager_aws_iam_role: integrations-ci
terraform_apply: false
secrets: inherit