From 3ee88c87fbae7e9968c4fc7f9aae5e7f28581aad Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Thu, 15 Aug 2024 15:32:53 +0100 Subject: ci: separate python & terraform jobs --- .github/workflows/on-commit.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/on-commit.yml b/.github/workflows/on-commit.yml index 937aeaa..e4eb4f8 100644 --- a/.github/workflows/on-commit.yml +++ b/.github/workflows/on-commit.yml @@ -6,7 +6,7 @@ on: - 'main' jobs: - quality-checks: + python-quality-checks: runs-on: ubuntu-latest steps: - uses : actions/checkout@v4 @@ -25,6 +25,9 @@ jobs: - name : 'Python: Formatting' run: | black --check . + terraform-quality-checks: + runs-on: ubuntu-latest + steps: - name: 'Terraform: Setup' uses: hashicorp/setup-terraform@v3 with: @@ -37,4 +40,4 @@ jobs: run: terraform init -backend=false - name: 'Terraform: Validate' working-directory: ./terraform - run: terraform validate + run: terraform validate \ No newline at end of file -- cgit v1.2.3 From 6964625c65ae1552b8182891cf47997e480cce5e Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Thu, 15 Aug 2024 15:34:03 +0100 Subject: fix(ci): correct terraform folder path --- .github/workflows/on-commit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/on-commit.yml b/.github/workflows/on-commit.yml index e4eb4f8..355729e 100644 --- a/.github/workflows/on-commit.yml +++ b/.github/workflows/on-commit.yml @@ -33,11 +33,11 @@ jobs: with: terraform_version: latest - name: 'Terraform: Formatting' - working-directory: ./terraform + working-directory: terraform run: terraform fmt -check -recursive - name: 'Terraform: Initialise' - working-directory: ./terraform + working-directory: terraform run: terraform init -backend=false - name: 'Terraform: Validate' - working-directory: ./terraform + working-directory: terraform run: terraform validate \ No newline at end of file -- cgit v1.2.3 From e5f2d8c98dd029bfb9926c35002abcf998510cf7 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Thu, 15 Aug 2024 15:37:26 +0100 Subject: fix(ci): add missing checkout action --- .github/workflows/on-commit.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github') diff --git a/.github/workflows/on-commit.yml b/.github/workflows/on-commit.yml index 355729e..a4e66bb 100644 --- a/.github/workflows/on-commit.yml +++ b/.github/workflows/on-commit.yml @@ -28,6 +28,7 @@ jobs: terraform-quality-checks: runs-on: ubuntu-latest steps: + - uses : actions/checkout@v4 - name: 'Terraform: Setup' uses: hashicorp/setup-terraform@v3 with: -- cgit v1.2.3 From 47f5abae5b1b033a805b08c2a00d7df0bb0dcd97 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Thu, 15 Aug 2024 15:41:35 +0100 Subject: test(ci): add continue-on-error for debugging --- .github/workflows/on-commit.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/on-commit.yml b/.github/workflows/on-commit.yml index a4e66bb..fd9ffb8 100644 --- a/.github/workflows/on-commit.yml +++ b/.github/workflows/on-commit.yml @@ -18,13 +18,16 @@ jobs: run: | python -m pip install --upgrade pip pip install flake8 pylint black bandit safety + continue-on-error: true - name : 'Python: Linting' run: | flake8 . find . -name "*.py" | xargs pylint + continue-on-error: true - name : 'Python: Formatting' run: | black --check . + continue-on-error: true terraform-quality-checks: runs-on: ubuntu-latest steps: @@ -36,9 +39,12 @@ jobs: - name: 'Terraform: Formatting' working-directory: terraform run: terraform fmt -check -recursive + continue-on-error: true - name: 'Terraform: Initialise' working-directory: terraform run: terraform init -backend=false + continue-on-error: true - name: 'Terraform: Validate' working-directory: terraform - run: terraform validate \ No newline at end of file + run: terraform validate + continue-on-error: true \ No newline at end of file -- cgit v1.2.3 From cc13dc8d170d8c60dbb92e4e802a854bbdf81d5b Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Thu, 15 Aug 2024 16:03:00 +0100 Subject: test(ci): add terraform deploy job --- .github/workflows/deploy.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/deploy.yml (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6674373 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,37 @@ +name: deploy-terraform + +on: + push: + branches: + - main # Adjust the branch based on our deployment strategy + +jobs: + deploy-terraform: + name: Deploy Terraform + runs-on: ubuntu-latest + environment: test-env + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Install Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Terraform Init + working-directory: terraform + run: terraform init + + - name: Terraform Plan + working-directory: terraform + run: terraform plan + + - name: Terraform Apply + working-directory: terraform + run: terraform apply --auto-approve \ No newline at end of file -- cgit v1.2.3 From fc8e61c0e58df57195c6a33852a0a17ba34322c6 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Thu, 15 Aug 2024 16:05:03 +0100 Subject: fix(ci): amend to trigger on commit to test-ci/... --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6674373..372d0b3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: deploy-terraform on: push: branches: - - main # Adjust the branch based on our deployment strategy + - test-ci/** # Adjust the branch based on our deployment strategy jobs: deploy-terraform: -- cgit v1.2.3 From 861fd5fe8303c6558c7763477c89dc98fff23c57 Mon Sep 17 00:00:00 2001 From: lian-manonog Date: Fri, 16 Aug 2024 10:20:14 +0100 Subject: wip: pushing the ci-cd-branch to test terraform infra --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 372d0b3..922daee 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,7 @@ name: deploy-terraform on: push: branches: - - test-ci/** # Adjust the branch based on our deployment strategy + - ci-cd-branch # Adjust the branch based on our deployment strategy jobs: deploy-terraform: -- cgit v1.2.3 From 3d56751d93eeb5ef6cef1f44dd54ee38fcd1fe3c Mon Sep 17 00:00:00 2001 From: lian-manonog Date: Fri, 16 Aug 2024 12:20:54 +0100 Subject: wip: change env line 14 to production --- .github/workflows/deploy.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 922daee..bd9df57 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,15 +5,17 @@ on: branches: - ci-cd-branch # Adjust the branch based on our deployment strategy + jobs: deploy-terraform: name: Deploy Terraform runs-on: ubuntu-latest - environment: test-env + #needs: run-checks (must ref on-commit.yml file) + environment: production steps: - name: Checkout Repo uses: actions/checkout@v4 - + - name: Install Terraform uses: hashicorp/setup-terraform@v3 -- cgit v1.2.3 From 2bcedc300f36760b55f0db8cfb4e724362d1c251 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Fri, 16 Aug 2024 14:27:41 +0100 Subject: chore(ci): remove redundant on-commit.yml --- .github/workflows/on-commit.yml | 50 ----------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 .github/workflows/on-commit.yml (limited to '.github') diff --git a/.github/workflows/on-commit.yml b/.github/workflows/on-commit.yml deleted file mode 100644 index fd9ffb8..0000000 --- a/.github/workflows/on-commit.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: commit-qc-checks - -on: - push: - branches-ignore: - - 'main' - -jobs: - python-quality-checks: - runs-on: ubuntu-latest - steps: - - uses : actions/checkout@v4 - - name : 'Python: Setup' - uses : actions/setup-python@v5 - with: - python-version: 3.11 - - name : 'Python: Install Dependencies' - run: | - python -m pip install --upgrade pip - pip install flake8 pylint black bandit safety - continue-on-error: true - - name : 'Python: Linting' - run: | - flake8 . - find . -name "*.py" | xargs pylint - continue-on-error: true - - name : 'Python: Formatting' - run: | - black --check . - continue-on-error: true - terraform-quality-checks: - runs-on: ubuntu-latest - steps: - - uses : actions/checkout@v4 - - name: 'Terraform: Setup' - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: latest - - name: 'Terraform: Formatting' - working-directory: terraform - run: terraform fmt -check -recursive - continue-on-error: true - - name: 'Terraform: Initialise' - working-directory: terraform - run: terraform init -backend=false - continue-on-error: true - - name: 'Terraform: Validate' - working-directory: terraform - run: terraform validate - continue-on-error: true \ No newline at end of file -- cgit v1.2.3 From cf3d366e730e88ceea194d5b3b1d1a3ddecdd944 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Fri, 16 Aug 2024 14:30:07 +0100 Subject: ci: deploy only on push/pr to main --- .github/workflows/deploy.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bd9df57..db51d20 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,10 +1,13 @@ name: deploy-terraform on: - push: + pull-request: branches: - - ci-cd-branch # Adjust the branch based on our deployment strategy - + - main + pull: + branches: + - main + jobs: deploy-terraform: @@ -36,4 +39,4 @@ jobs: - name: Terraform Apply working-directory: terraform - run: terraform apply --auto-approve \ No newline at end of file + run: terraform apply --auto-approve -- cgit v1.2.3 From 63b5f3e5f1888d5653d2f7b3529b3d72e3315dbf Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Fri, 16 Aug 2024 14:43:46 +0100 Subject: fix(ci): amend pull_request syntax --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index db51d20..00c7263 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,7 +1,7 @@ name: deploy-terraform on: - pull-request: + pull_request: branches: - main pull: -- cgit v1.2.3 From 9cec304b2f8c2832c4a715bba784a34f7c674c19 Mon Sep 17 00:00:00 2001 From: Alex Schofield Date: Fri, 16 Aug 2024 14:52:35 +0100 Subject: fix(ci): amend pull to push --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 00c7263..5672048 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - main - pull: + push: branches: - main -- cgit v1.2.3