Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LASB-2748: Resolve critical vulnerabilities reported by Snyk #256

Merged
merged 27 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
eced812
Updated the dependabot settings to with with version 2.
mtac50 Dec 6, 2023
64a8d34
LASB-2748: Updated spring boot and gradle versions
mtac50 Dec 6, 2023
8c83341
LASB-2748: Migrated test to use JUnit 5.
mtac50 Dec 6, 2023
0892516
LASB-2748: Fixed test constructor.
mtac50 Dec 7, 2023
2ca6284
LASB-2748: Updated the docker tag to use the commit hash rather than …
mtac50 Dec 7, 2023
067a84d
LASB-2748: Remove references to the BUILD_TAG file.
mtac50 Dec 7, 2023
36ef0e2
LASB-2748: Updated spring boot, logback, snakeyaml and apache.cxf dep…
mtac50 Dec 7, 2023
2ffbb57
LASB-2748: Upgraded spring dependency management and pinned snakeyaml…
mtac50 Dec 7, 2023
9903a87
LASB-2748: Reverted aws sdk update.
mtac50 Dec 7, 2023
fbc21aa
LASB-2748: Created reusable workflows for build and deploying the app…
mtac50 Dec 8, 2023
50cfebd
LASB02748: Replaced the cp-build workflow with one that calls the reu…
mtac50 Dec 8, 2023
1672aaa
LASB-2748: Fixed yaml syntax issue.
mtac50 Dec 8, 2023
6b2b13e
LASB-2748: Added missing job name.
mtac50 Dec 8, 2023
a1018a4
LASB-2748: Updated reference to GITHUB_SHA variable.
mtac50 Dec 8, 2023
1eca258
LASB-2748: Update reference to github.sha variable.
mtac50 Dec 8, 2023
a3c09a1
LASB-2748: Refactored build and deploy dev into steps.
mtac50 Dec 8, 2023
bee4303
LASB-2748: Removed secret inheritance.
mtac50 Dec 8, 2023
0f58c05
LASB-2748: Remove secret inheritance from deploy workflow.
mtac50 Dec 8, 2023
3d1ff68
LASB-2748: Moved checkout action to the calling workflow.
mtac50 Dec 8, 2023
e7ea8c0
LASB-2748: Removed typo in uses section.
mtac50 Dec 8, 2023
4664578
LASB-2748: Changes reusable workflow calls from steps to jobs.
mtac50 Dec 8, 2023
9655b3f
LASB-2748: move runs on and environment settings into the reusable wo…
mtac50 Dec 8, 2023
b0bf59b
LASB-2748:Updated secret usage in reusable workflows.
mtac50 Dec 8, 2023
93b3632
LASB-2748: Fixed typo in inputs reference.
mtac50 Dec 8, 2023
8f30f78
LASB-2748: Updated secrets references.
mtac50 Dec 8, 2023
fe4a0a1
LASB-2748: Updated the cp-deploy action to build and deploy to all en…
mtac50 Dec 8, 2023
6d410e3
LASB-2748: Removed additional jobs section.
mtac50 Dec 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .dependabot/config.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "gradle"
# Look for `package.json` and `lock` files in the `root` directory
directory: "/src"
# Check the npm registry for updates every day (weekdays)
schedule:
interval: "daily"
commit-message:
prefix: "Gradle"
include: "scope"
68 changes: 68 additions & 0 deletions .github/workflows/build-and-push-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and push docker image workflow

on:
workflow_call:
inputs:
ecr-repository:
required: true
type: string
docker-tag:
required: true
type: string
aws-region:
required: true
type: string
secrets:
ecr-role:
required: true

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.ecr-role }}
aws-region: ${{ inputs.aws-region }}
- uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- name: Determine Docker Tag
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ inputs.ecr-repository }}
id: get-docker-tag
run: |
DOCKER_TAG=${{ inputs.docker-tag }}
echo "Using docker tag '${DOCKER_TAG}'"

if docker pull "$REGISTRY/$REPOSITORY:${DOCKER_TAG}"; then
echo "Docker tag '${DOCKER_TAG}' already exists in the ECR - Not rebuilding Docker container"
else
echo >&2 "Docker tag '${DOCKER_TAG}' does not exist in the ECR - Application will be redeployed"
fi

echo "DOCKER_TAG=${DOCKER_TAG}" >> "$GITHUB_ENV"
echo "DOCKER_TAG=$DOCKER_TAG" >> "$GITHUB_OUTPUT"
- name: Building the NOLASA image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ inputs.ecr-repository }}
run: |
if docker pull "$REGISTRY/$REPOSITORY:$DOCKER_TAG"; then
echo "Docker image '$DOCKER_TAG' is up to date - not rebuilding"
else
echo "No Docker image for tag $DOCKER_TAG - Building the image with gradle ..."
chmod +x ./gradlew && ./gradlew build
echo Building the Docker image...
docker build -f Dockerfile_cp -t $REGISTRY/$REPOSITORY:$DOCKER_TAG --no-cache .
mkdir artifacts
zip -rq artifacts/buildreports.zip ./build/reports/tests/test/*
docker push $REGISTRY/$REPOSITORY:$DOCKER_TAG
fi
- name: Upload build tags and test reports
uses: actions/upload-artifact@v3
with:
name: build-reports
path: artifacts/

84 changes: 84 additions & 0 deletions .github/workflows/cp-build-and-deploy-all-envs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# This workflow will deploy to all environments using the commit hash as the image tag.

name: Deploy DEV, TEST PREPROD and PROD

permissions:
id-token: write
contents: read

on:
push:
branches:
- 'master'


jobs:
build-and-push-image:
uses: ./.github/workflows/build-and-push-docker.yml
with:
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
aws-region: ${{ vars.ECR_REGION }}
secrets:
ecr-role: ${{ secrets.ECR_ROLE_TO_ASSUME}}

deploy-application-dev:
needs: build-and-push-image
uses: ./.github/workflows/deploy-to-cloud-platform.yml
with:
env-name: development
helm-values-file: values_dev.yaml
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
ecr-base-uri: 754256621582.dkr.ecr.eu-west-2.amazonaws.com
secrets:
kube-cluster: ${{ secrets.KUBE_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_NAMESPACE }}
kube-cert: ${{ secrets.KUBE_CERT }}
kube-token: ${{ secrets.KUBE_TOKEN }}

deploy-application-test:
needs: deploy-application-dev
uses: ./.github/workflows/deploy-to-cloud-platform.yml
with:
env-name: test
helm-values-file: values_tst.yaml
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
ecr-base-uri: 754256621582.dkr.ecr.eu-west-2.amazonaws.com
secrets:
kube-cluster: ${{ secrets.KUBE_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_NAMESPACE }}
kube-cert: ${{ secrets.KUBE_CERT }}
kube-token: ${{ secrets.KUBE_TOKEN }}

deploy-application-preprod:
needs: deploy-application-test
uses: ./.github/workflows/deploy-to-cloud-platform.yml
with:
env-name: preproduction
helm-values-file: values_preprod.yaml
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
ecr-base-uri: 754256621582.dkr.ecr.eu-west-2.amazonaws.com
secrets:
kube-cluster: ${{ secrets.KUBE_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_NAMESPACE }}
kube-cert: ${{ secrets.KUBE_CERT }}
kube-token: ${{ secrets.KUBE_TOKEN }}

deploy-application-prod:
needs: deploy-application-preprod
uses: ./.github/workflows/deploy-to-cloud-platform.yml
with:
env-name: production
helm-values-file: values_prd.yaml
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
ecr-base-uri: 754256621582.dkr.ecr.eu-west-2.amazonaws.com
secrets:
kube-cluster: ${{ secrets.KUBE_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_NAMESPACE }}
kube-cert: ${{ secrets.KUBE_CERT }}
kube-token: ${{ secrets.KUBE_TOKEN }}

40 changes: 40 additions & 0 deletions .github/workflows/cp-build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will build and deploy the current branch to dev.

name: Build image and deploy to DEV

permissions:
id-token: write
contents: read

on:
pull_request:
branches:
- master

jobs:
build-and-push-image:
uses: ./.github/workflows/build-and-push-docker.yml
with:
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
aws-region: ${{ vars.ECR_REGION }}
secrets:
ecr-role: ${{ secrets.ECR_ROLE_TO_ASSUME}}

deploy-application-to-dev:
needs: build-and-push-image
uses: ./.github/workflows/deploy-to-cloud-platform.yml
with:
env-name: development
helm-values-file: values_dev.yaml
ecr-repository: ${{ vars.ECR_REPOSITORY }}
docker-tag: ${{ github.sha }}
ecr-base-uri: 754256621582.dkr.ecr.eu-west-2.amazonaws.com
secrets:
kube-cluster: ${{ secrets.KUBE_CLUSTER }}
kube-namespace: ${{ secrets.KUBE_NAMESPACE }}
kube-cert: ${{ secrets.KUBE_CERT }}
kube-token: ${{ secrets.KUBE_TOKEN }}



85 changes: 0 additions & 85 deletions .github/workflows/cp-build.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .github/workflows/cp-deploy.yml

This file was deleted.

Loading
Loading