-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Hi there,
First and foremost: thank you for this tool! I like it and I think it works pretty well, however there's something I'd like to run by you.
My ArgoCD cluster has one initial ApplicationSet, which looks more or less like this;
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: apps
labels:
app: apps
spec:
goTemplate: true
generators:
- git:
repoURL: [email protected]:Thijmen/some-argocd.git
revision: HEAD
files:
- path: k8s/core/**/config.json
- path: k8s/infra/**/config.json
- path: k8s/services/**/config.json
template:
metadata:
name: apps-{{ normalize (index .path.segments 1) }}-{{ normalize (index .path.segments 2) }}
labels:
app: apps
spec:
project: default
syncPolicy:
automated:
prune: true
destination:
name: in-cluster
namespace: argocd
source:
repoURL: [email protected]:Thijmen/some-argocd.git
targetRevision: HEAD
path: "{{ .path.path }}"So what happens now with the following workflow:
name: Argo CD Diff Preview
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
path: pull-request
- uses: actions/checkout@v4
with:
ref: main
path: main
- name: Prepare secrets
run: |
mkdir secrets
cat > secrets/secret.yaml << EOF
apiVersion: v1
kind: Secret
metadata:
name: private-repo
namespace: argocd
labels:
argocd.argoproj.io/secret-type: repo-creds
stringData:
type: git
url: [email protected]/${{ github.repository }}
sshPrivateKey: |
$(echo "${{ secrets.REPO_ACCESS_SSH_PRIVATE_KEY }}" | sed 's/^/ /')
EOF
- name: Generate Diff
run: |
docker run \
--network=host \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/main:/base-branch \
-v $(pwd)/pull-request:/target-branch \
-v $(pwd)/secrets:/secrets \
-v $(pwd)/output:/output \
-e TARGET_BRANCH=refs/pull/${{ github.event.number }}/merge \
-e REPO=${{ github.repository }} \
dagandersen/argocd-diff-preview:v0.1.22 \
--debug
- name: Post diff as comment
run: |
gh pr comment ${{ github.event.number }} --repo ${{ github.repository }} --body-file output/diff.md --edit-last || \
gh pr comment ${{ github.event.number }} --repo ${{ github.repository }} --body-file output/diff.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}If I create a valid app in k8s/services/test/app.yml - the tool shows it's going to add an app. However - this is incorrect, due to my filter for config.json. Is there any way to make that work with this tool too?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels