Skip to content

Commit

Permalink
Man 227 enable GitHub actions (#251)
Browse files Browse the repository at this point in the history
* MAN-227 - add new work flow files

* MAN-227 - update node build version in workflow

* MAN-227 - revert update to node build version in workflow

* MAN-227 - add env variable for sentry

* MAN-227 - update workflow file

* MAN-227 - correct file

* MAN-227 - correct file

* MAN-227 - add env variable to build job

* MAN-227 - remove env with block

* MAN-227 - use local version of node_build.yml

* MAN-227 - disable github action lint for testing

* MAN-227 - disable github action lint for testing

* MAN-227 - disable circle job for testing

* MAN-227 - update pipeline

* MAN-227 - update pipeline

* MAN-227 - renable github action validate

* MAN-227 - use local workflow file

* MAN-227 - use pipeline file

* MAN-227 - add env variable to workflow file

* MAN-227 - add env variable to workflow step

* MAN-227 - update pipeline that previously worked

* MAN-227 - update pipeline file to use local workflow

* MAN-227 - use v1 of the workflow

* MAN-227 - use v2 of the workflow

* MAN-227 - reenable circleci steps

* MAN-227 - use local integration test work flow file to see why test in failing in ci

* MAN-227 - update pipeline file to fix lint error

* MAN-227 - use correct local file

* MAN-227 - update pipeline file to fix lint error

* MAN-227 - update workflow file

* MAN-227 - update workflow file to add test step

* MAN-227 - update test workflow file

* MAN-227 - update test workflow file to remove wiremock dwnload

* MAN-227 - update test workflow file to see if docker build step completes successfully

* MAN-227 - update test workflow file to add additional inputs

* MAN-227 - update test workflow file to add additional inputs

* MAN-227 - update test workflow file to add additional inputs

* MAN-227 - update test workflow file to add additional inputs

* MAN-227 - use local build files

* MAN-227 - update local docker build file

* MAN-227 - update local docker build file

* MAN-227 - update local docker build file

* MAN-227 - update local docker build file

* MAN-227 - add local action file

* MAN-227 - add actions checkout

* MAN-227 - add local action

* MAN-227 - update local action

* MAN-227 - add secret to build file

* MAN-227 - add secret env to build file

* MAN-227 - update action file

* MAN-227 - update action file

* MAN-227 - add env to action step

* MAN-227 - upedate env

* MAN-227 - update env

* MAN-227 - update env

* MAN-227 - update docker build step

* MAN-227 - update docker build step

* MAN-227 - update docker build step

* MAN-227 - add env variable to docker build step

* MAN-227 - add env variable to docker build step

* MAN-227 - move env variable to docker build step

* MAN-227 - move env variable to docker build step

* MAN-227 - move env variable to docker build step

* MAN-227 - fix lint errors

* MAN-227 - pass sentry auth token to action

* MAN-227 - fix lint errors

* MAN-227 - add new action

* MAN-227 - fix lint errors

* MAN-227 - update docker build

* MAN-227 - update docker build

* MAN-227 - update docker build

* MAN-227 - update docker build

* MAN-227 - update docker build

* MAN-227 - add env variable step

* MAN-227 - update build

* MAN-227 - update build

* MAN-227 - update build

* MAN-227 - update build

* MAN-227 - update build

* MAN-227 - update build

* MAN-227 - enable tests and general tidy up

* MAN-227 - fix lint errors

* MAN-227 - fix lint errors

* MAN-227 - fix lint errors

* MAN-227 - fix lint errors

* MAN-227 - enable deploy step

* MAN-227 - update ingress value, as this conflicts with ns ingres in hmpps-manage-a-supervision-dev

* MAN-227 - update helm files

* MAN-227 - update helm files

* MAN-227 - update docker build step

* MAN-227 - delete circelci config

* MAN-227 - rename from entries hmpps-manage-a-supervision-ui to hmpps-manage-people-on-probation-ui

* MAN-227 - undo rename for entry, will pick this up on a later task

* MAN-227 - update helm chart

* MAN-227 - only build docker file if git ref is main

* MAN-227 - add basic circleci file to see if github check passes

* MAN-227 - delete circle ci directory
  • Loading branch information
achimber-moj authored Jan 8, 2025
1 parent 4facf24 commit 47b815e
Show file tree
Hide file tree
Showing 29 changed files with 503 additions and 270 deletions.
216 changes: 0 additions & 216 deletions .circleci/config.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/actions/build_multiplatform_docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and push multi-platform docker image to registry
description: action to build and push a multi-platform docker image


inputs:
repository_name:
description: Repository name
required: true
docker_registry:
description: Docker registry
required: true
registry_org:
description: Docker registry organisation
required: true
additional_docker_tag:
description: Additional docker tag that can be used to specify stable tags
required: false
push:
description: Push docker image to registry flag
required: true
app_version:
description: App version
required: true
HMPPS_QUAYIO_USER:
description: Docker registry username
required: false
HMPPS_QUAYIO_TOKEN:
description: Docker registry token
required: false

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Docker login if Docker registry is quay.io
if: ${{ inputs.docker_registry == 'quay.io' }}
uses: docker/login-action@v3
with:
registry: ${{ inputs.docker_registry }}
username: ${{ inputs.HMPPS_QUAYIO_USER }}
password: ${{ inputs.HMPPS_QUAYIO_TOKEN }}

- name: Docker login if Docker registry is ghcr.io
if: ${{ inputs.docker_registry == 'ghcr.io' }}
uses: docker/login-action@v3
with:
registry: ${{ inputs.docker_registry }}
username: ${{ github.actor }}
password: ${{ github.token }}

# - name: Configure AWS credentials
# if: ${{ inputs.docker_registry == 'ecr' }}
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-access-key-id: ${{ secrets.AWS_MGMT_ECR_ID }}
# aws-secret-access-key: ${{ secrets.AWS_MGMT_ECR_KEY }}
# aws-region: eu-west-2

# - name: Login to Amazon ECR
# if: ${{ inputs.docker_registry == 'ecr' }}
# uses: aws-actions/amazon-ecr-login@v1

- name: Build Docker images
env:
SENTRY_AUTH_TOKEN: ${{ inputs.additional_docker_tag }}
uses: docker/build-push-action@v6
with:
cache-from: type=gha
platforms: linux/amd64,linux/arm64
cache-to: type=gha,mode=max
context: .
push: ${{ inputs.push }}
secret-envs: |
"sentry=SENTRY_AUTH_TOKEN"
provenance: false
build-args: |
"BUILD_NUMBER=${{ inputs.app_version }}"
"GIT_REF=${{ github.sha }}"
"GIT_BRANCH=${{ github.ref_name }}"
tags: |
${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ github.event.repository.name }}:latest
${{ inputs.docker_registry}}/${{ inputs.registry_org }}/${{ github.event.repository.name }}:${{ inputs.app_version }}
17 changes: 17 additions & 0 deletions .github/actions/create_app_version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Create app version to use it for docker build and deploy pipelines
description: Create app version to use it for docker build and deploy pipelines

outputs:
version:
value: ${{ steps.create_version.outputs.version }}
description: this is what will be the version

runs:
using: composite
steps:
- name: create app version
id: create_version
shell: bash
run: |
version=$(date '+%Y-%m-%d').${{ github.run_number }}.$(echo ${{ github.sha }} | cut -c1-7)
echo "version=$version" >> $GITHUB_OUTPUT
39 changes: 39 additions & 0 deletions .github/workflows/deploy_to_env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy to environment

on:
workflow_dispatch:
inputs:
environment:
description: Environment
type: choice
required: true
options:
- dev
- preprod
- prod
default: 'dev'
version:
description: version to be deployed to the environment - must already exist.
required: true
default: ''
type: string

permissions:
contents: read

jobs:
helm_lint:
name: helm lint
uses: ministryofjustice/hmpps-github-actions/.github/workflows/test_helm_lint.yml@v1 # WORKFLOW_VERSION
secrets: inherit
with:
environment: ${{ inputs.environment }}
deploy_env:
name: Deploy to environment
needs:
- helm_lint
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v1 # WORKFLOW_VERSION
secrets: inherit
with:
environment: ${{ inputs.environment }}
app_version: ${{ inputs.version }}
Loading

0 comments on commit 47b815e

Please sign in to comment.