Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 8 additions & 12 deletions .github/workflows/state-repo-helm-apps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,23 @@ on:

jobs:
helm:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
concurrency:
group: ${{ join(fromJSON(inputs.updated_apps), '') }}-${{ inputs.environment }}
cancel-in-progress: false
env:
HELM_EXPERIMENTAL_OCI: 1
DIFF_FILE: "/tmp/helmfile.md"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- uses: actions/setup-node@v3
with:
node-version: '20.x'

- run: npm install js-yaml

- name: Parse config file
id: parse_config
uses: actions/github-script@v7
Expand Down Expand Up @@ -110,15 +114,13 @@ jobs:

result.region = provider.region
result.role_to_assume = config.environments["${{ inputs.environment }}"]["role-to-assume"]

break;
default:
throw new Error(`Unknown provider: ${providerKind}`)
}


console.log(result);

return result;

# Install dependencies
Expand All @@ -132,7 +134,6 @@ jobs:
helm-version: '${{ inputs.version_helm }}'
helm-diff-plugin-version: '${{ inputs.version_helm_diff_plugin}}'


# AWS setup
- name: Configure AWS Credentials
if: ${{ fromJSON(steps.parse_config.outputs.result).provider_kind == 'aws' }}
Expand All @@ -155,7 +156,6 @@ jobs:
aws ecr get-login-password --region ${{ steps.parse_config.outputs.result && fromJSON(steps.parse_config.outputs.result).region }} | helm registry login --username AWS --password-stdin "$registry"
done


# Azure setup
- name: Setup / Azure Login
uses: Azure/login@v2
Expand Down Expand Up @@ -192,7 +192,6 @@ jobs:
done

# Helm logic

- uses: imranismail/setup-kustomize@v2
with:
kustomize-version: '${{ inputs.version_kustomize }}'
Expand Down Expand Up @@ -282,7 +281,6 @@ jobs:
echo "::warning app=$app,env=${{inputs.environment}}::The helm deploy did not generate any manifest."
fi


# Verify the app exists or if it is the first time it's been applied
appname=$(echo $app | awk -F"/" '{print $NF}')

Expand Down Expand Up @@ -330,8 +328,6 @@ jobs:
run: |

apps='${{ inputs.updated_apps }}'


echo $apps

echo "$apps" | jq -r '.[]' | while read app; do
Expand Down
29 changes: 13 additions & 16 deletions .github/workflows/state-repo-helm-sys-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ on:
default: 'v3.7.1'
jobs:
helm:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
HELM_EXPERIMENTAL_OCI: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- uses: actions/setup-node@v3
with:
node-version: '20.x'

- run: npm install js-yaml

- name: Parse config file
id: parse_config
uses: actions/github-script@v7
Expand Down Expand Up @@ -97,26 +98,24 @@ jobs:
case 'azure':
if(!provider?.tenant_id) throw new Error('AZURE_TENANT_ID not configured')
if(!provider?.subscription_id) throw new Error('AZURE_SUBSCRIPTION_ID not configured')

result.tenant_id = provider.tenant_id
result.subscription_id = provider.subscription_id
result.resource_group_name = config.environments["${{ inputs.environment }}"].resource_group_name

break;
case 'aws':
if(!config?.environments?.["${{ inputs.environment }}"]?.["role-to-assume"]) throw new Error('AWS_ROLE_TO_ASSUME not configured')

result.region = provider.region
result.role_to_assume = config.environments["${{ inputs.environment }}"]["role-to-assume"]

break;
default:
throw new Error(`Unknown provider: ${providerKind}`)
}


console.log(result);

return result;

# Install dependencies
Expand All @@ -126,7 +125,7 @@ jobs:
with:
kubectl-version: '${{ inputs.version_kubectl }}'
kubectl-release-date: '${{ inputs.version_kubectl_release_date }}'
helmfile-version: '${{ inputs.version_helmfile }}'
helmfile-version: '${{ inputs.version_helmfile }}'
helm-version: '${{ inputs.version_helm }}'
helm-diff-plugin-version: '${{ inputs.version_helm_diff_plugin}}'

Expand Down Expand Up @@ -188,7 +187,6 @@ jobs:
done

# Helm logic

- uses: imranismail/setup-kustomize@v2
with:
kustomize-version: '${{ inputs.version_kustomize }}'
Expand All @@ -199,11 +197,10 @@ jobs:
HELM_SECRETS_VERSION: '${{ inputs.version_secrets }}'
if: ${{ inputs.sops_enabled == true || inputs.sops_enabled == 'true' }}
run: |

curl -O -L -C - "https://github.com/mozilla/sops/releases/download/$SOPS_VERSION/sops-$SOPS_VERSION.linux"
sudo mv "sops-$SOPS_VERSION.linux" /usr/bin/sops
sudo chmod +x /usr/bin/sops

helm plugin install --debug https://github.com/jkroepke/helm-secrets

- name: Helm diff
Expand Down Expand Up @@ -234,7 +231,7 @@ jobs:
appname=$(echo $app | awk -F"/" '{print $NF}')

releases_found=`helm list -A -o json | jq "map(select(.name == \"$appname\" )) | length"`

if [ $releases_found -gt 0 ]; then
diff_output=`helmfile --environment ${{ inputs.environment }} --selector release=$appname diff --detailed-exitcode --context 5 | grep --color=never "\S"`
cat <<EOF >> $DIFF_FILE
Expand All @@ -251,15 +248,15 @@ jobs:
fi

done

- name: Helm apply
if: ${{ inputs.apply == true || inputs.apply == 'true' }}
run: |

apps='${{ inputs.updated_apps }}'

cd ${{ github.workspace }}/sys_services

echo $apps

echo "$apps" | jq -r '.[]' | while read app; do
Expand Down
Loading