chore(deps): update chart crowdsec to 0.17.0 #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ArgoCD Diff on PR | |
on: | |
pull_request: | |
paths: | |
- "k8s-apps/**" | |
jobs: | |
argocd_diff: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up environment | |
run: | | |
# Install ArgoCD CLI | |
curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 | |
chmod +x /usr/local/bin/argocd | |
- name: Get list of deployed apps | |
id: deployed_apps | |
run: | | |
# Extract deployed app names from applicationset.yaml | |
DEPLOYED_APPS=$(yq eval '.spec.generators[0].list.elements[].name' argocd-apps/applicationset.yaml | tr '\n' ' ') | |
echo "Deployed apps: $DEPLOYED_APPS" | |
echo "deployed_apps=$DEPLOYED_APPS" >> $GITHUB_OUTPUT | |
- name: Get updated apps | |
id: updated_apps | |
run: | | |
git fetch origin | |
# Extract unique app names from modified paths under k8s-apps | |
MODIFIED_APPS=$(git diff --name-only origin/main...HEAD | grep '^k8s-apps/' | awk -F'/' '{print $2}' | sort -u | tr '\n' ' ') | |
echo "Modified apps: $MODIFIED_APPS" | |
# Get deployed apps from previous step | |
DEPLOYED_APPS="${{ steps.deployed_apps.outputs.deployed_apps }}" | |
# Filter modified apps to include only deployed apps | |
FILTERED_APPS=$(echo "$MODIFIED_APPS" | tr ' ' '\n' | grep -Fx -f <(echo "$DEPLOYED_APPS" | tr ' ' '\n') || true) | |
echo "Filtered deployed apps: $FILTERED_APPS" | |
if [ -z "$FILTERED_APPS" ]; then | |
echo "No deployed apps changed" | |
echo "apps=" >> $GITHUB_OUTPUT | |
else | |
echo "apps=$FILTERED_APPS" >> $GITHUB_OUTPUT | |
fi | |
- name: Login to ArgoCD | |
if: steps.updated_apps.outputs.apps != '' | |
run: | | |
argocd login argocd.terence.cloud --grpc-web --username admin --password $ARGOCD_ADMIN_PASSWORD | |
env: | |
ARGOCD_ADMIN_PASSWORD: ${{ secrets.ARGOCD_ADMIN_PASSWORD }} | |
- name: ArgoCD Diff for updated apps | |
id: argocd_diff | |
if: steps.updated_apps.outputs.apps != '' | |
run: | | |
DIFF_OUTPUT="" | |
for APP in ${{ steps.updated_apps.outputs.apps }}; do | |
echo "Processing app: $APP" | |
cd "k8s-apps/$APP" | |
helm dependency update | |
DIFF=$(argocd app diff "$APP" \ | |
--grpc-web \ | |
--local-repo-root $(git rev-parse --show-toplevel) \ | |
--local $PWD \ | |
--loglevel warn \ | |
--exit-code=false) | |
if [ -n "$DIFF" ]; then | |
DIFF_OUTPUT="${DIFF_OUTPUT}\n\n### Diff for $APP:\n\`\`\`diff\n$DIFF\n\`\`\`" | |
else | |
DIFF_OUTPUT="${DIFF_OUTPUT}\n\n### Diff for $APP:\nNo changes detected" | |
fi | |
cd - | |
done | |
{ | |
echo 'diff_output<<EOF' | |
echo -e "$DIFF_OUTPUT" | |
echo 'EOF' | |
} >> "$GITHUB_OUTPUT" | |
- name: Publish PR Comment | |
if: steps.updated_apps.outputs.apps != '' | |
uses: actions/github-script@v7 | |
env: | |
DIFF_OUTPUT: ${{ steps.argocd_diff.outputs.diff_output }} | |
with: | |
script: | | |
const diffOutput = process.env.DIFF_OUTPUT; | |
if (diffOutput) { | |
const commentBody = `### ArgoCD Diff Results\n${diffOutput}`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: commentBody, | |
}); | |
} |