Skip to content

Commit

Permalink
Remove unused scripts and fixes outdated scripts (equinor#1558)
Browse files Browse the repository at this point in the history
* Remove unused scripts

* Fix check_terraform.yaml

* fix typo

* fix typo

* use vars instead of secrets

* fix more typos

* print errors from terraform

* use oidc and azuread

* move terraform env variables to terraform step

* fix clean cache registry

* fix vars

* Add contributor to app cache to gitrunner

* fix contributor in playground

* fix contributor in prod

* replace ' with "

* update lock-resources to use new gitrunner

* cleanup start/stop clusters
  • Loading branch information
Richard87 authored Dec 19, 2024
1 parent 9792491 commit 46aa62e
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 1,094 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/aksplan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: AKS Plan
on:
pull_request:
paths:
- terraform/subscriptions/**
- terraform/subscriptions/**
workflow_dispatch:
jobs:
terraform-plan:
Expand Down Expand Up @@ -33,12 +33,14 @@ jobs:
uses: actions/checkout@v4 #Clone Repo
with:
fetch-depth: '2'

- name: Extract data
id: data
run: |
FILENAME=terraform/subscriptions/${{matrix.target.subscription}}/${{matrix.target.name}}/config.yaml
echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT
echo "Checking file: ${FILENAME}"
- name: Check if files changed
id: changes
run: |
Expand All @@ -48,38 +50,46 @@ jobs:
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: 'Az login'
if: steps.changes.outputs.changed == 'true'
uses: azure/login@v2
with:
client-id: ${{ env.ARM_CLIENT_ID }}
tenant-id: ${{ env.ARM_TENANT_ID }}
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }}

- name: Get GitHub Public IP
id: github_public_ip
if: steps.changes.outputs.changed == 'true'
run: echo "ipv4=$(curl 'https://ifconfig.me/ip')" >> $GITHUB_OUTPUT

- name: Add GitHub IP to StorageAccount
if: steps.changes.outputs.changed == 'true'
run: |
az storage account network-rule add \
--resource-group "${{ matrix.target.subscription }}-tfstate" \
--account-name "${{ matrix.target.subscription }}radixinfra" \
--ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null
- name: Add GitHub IP to KeyVault
if: steps.changes.outputs.changed == 'true'
run: |
az keyvault network-rule add --name "radix-keyv-${{ matrix.target.name }}" \
--resource-group "common-${{ matrix.target.name }}" \
--ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null
- name: Lets sleep for 30 seconds for FW rule to complete
if: steps.changes.outputs.changed == 'true'
run: sleep 30s

- name: Setup Terraform
if: steps.changes.outputs.changed == 'true'
id: update_firewall
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 'latest'

- name: Terraform Init & Plan
if: steps.changes.outputs.changed == 'true'
id: init
Expand All @@ -89,15 +99,17 @@ jobs:
run: |
terraform -chdir="./terraform/subscriptions/${{ matrix.target.subscription }}/${{ matrix.target.name }}/pre-clusters" init
terraform -chdir="./terraform/subscriptions/${{ matrix.target.subscription }}/${{ matrix.target.name }}/pre-clusters" plan
- name: Revoke GitHub IP on StorageAccount
if: steps.changes.outputs.changed == 'true'
run: |
az storage account network-rule remove \
--resource-group "${{ matrix.target.subscription }}-tfstate" \
--account-name "${{ matrix.target.subscription }}radixinfra" \
--ip-address ${{ steps.github_public_ip.outputs.ipv4 }} >/dev/null
- name: Revoke GitHub IP on KeyVault
if: steps.changes.outputs.changed == 'true'
if: ${{ steps.update_firewall.outcome == 'success' && !cancelled()}} # Always run this step even if previous step failed
run: |
az keyvault network-rule remove --name "radix-keyv-${{ matrix.target.name }}" \
--resource-group "common-${{ matrix.target.name }}" \
Expand Down
246 changes: 0 additions & 246 deletions .github/workflows/azureAuditlog.yml

This file was deleted.

Loading

0 comments on commit 46aa62e

Please sign in to comment.