Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relevant components discovery and add support for ArgoCD "native" application discovery #8

Merged
merged 16 commits into from
Jun 12, 2024

Conversation

Oded-B
Copy link
Collaborator

@Oded-B Oded-B commented May 21, 2024

Description

Context:
ArgoCD diffs all “relevant”(possibly affected by PR) ArgoCD apps to every PR to dispaly the diff and checks for “no-diff” PRs
“no-diff” PRs are automatically merged! failure to understand what ArgoCD apps to diff can lead to auto merging (auto-promoting) a change that does change the cluster state

The current way to understand which app to diff is based telefonistka sourcePath configuration, but deployment target that are “last” in the promotion flow (like the prod clusters in a "dev">"staging" > "prod" flow) are referenced not in sourcePath (they are only in targetPath).

PR desc:
This PR will add "affected component paths" to telefonistka PR metadata(the metadata Telefonistka hide in promotion PR "body" field)
And it will change the argoCD app discovery mechanism to get the affected paths from the metadata on promotion PRs (non-promotion PR will keep the sourcePath based code path)

Additionally we are adding another discovery mechanism - one that doesn't require ussage of a dedicated telefonistika(sha1) label no all application objects but one that is less performant on repos will large number of hosted ArgoCD apps

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@Oded-B
Copy link
Collaborator Author

Oded-B commented May 21, 2024

/publish

Copy link

oci-image-publish-on-comment: succeeded ✅
https://github.com/commercetools/telefonistka/actions/runs/9172661908
ghcr.io/commercetools/telefonistka:fix_relevant_components_discovery
ghcr.io/commercetools/telefonistka:sha-2a5adc2

@Oded-B Oded-B marked this pull request as ready for review May 21, 2024 11:29
component the telefonistka dedicated sha1 label and the ArgoCD native
`manifest-generate-paths`  annotation
@Oded-B Oded-B marked this pull request as draft May 28, 2024 12:01
@Oded-B Oded-B changed the title Fix relevant components discovery Fix relevant components discovery and add support for ArgoCD "native" application discovery May 28, 2024
Oded-B and others added 5 commits May 30, 2024 08:50
* mocks: use go run to reduce dependency

Using go run will automatically install the tool and run it if it is not
installed already.

* argocd: fix import path

The import path for the mocks package is incorrect causing errors.

The mocks package should be imported from internal/pkg/mocks instead of
mocks/argocd.

This also removes the aliased import and uses the package as named,
which aligns with the directory name.

---------

Co-authored-by: Hannes Gustafsson <[email protected]>
Log time of API call with questionable performance :)
@Oded-B
Copy link
Collaborator Author

Oded-B commented May 30, 2024

/publish

Copy link

oci-image-publish-on-comment: succeeded ✅
https://github.com/commercetools/telefonistka/actions/runs/9299468083
ghcr.io/commercetools/telefonistka:fix_relevant_components_discovery
ghcr.io/commercetools/telefonistka:sha-29e72b0

@Oded-B
Copy link
Collaborator Author

Oded-B commented May 30, 2024

time="2024-05-30T08:42:12Z" level=info msg="Got 18 ArgoCD applications for repo https://github.com/commercetools/k8s-manifests-poc in 91 ms" func=github.com/wayfair-incubator/telefonistka/internal/pkg/argocd.findArgocdAppByManifestPathAnnotation file="/go/src/github.com/wayfair-incubator/telefonistka/internal/pkg/argocd/argocd.go:197"
time="2024-05-30T08:42:12Z" level=debug msg="Found app foobar-plg-gcp-eu-west1-v1 with manifest-generate-paths(\"workspace/special-delivery/gitops-demo-ns2/foobar\") annotation that matches workspace/special-delivery/gitops-demo-ns2/foobar" func=github.com/wayfair-incubator/telefonistka/internal/pkg/argocd.findArgocdAppByManifestPathAnnotation file="/go/src/github.com/wayfair-incubator/telefonistka/internal/pkg/argocd/argocd.go:219"
time="2024-05-30T08:42:15Z" level=info msg="Non-actionable event type check_run" func=github.com/wayfair-incubator/telefonistka/internal/pkg/githubapi.HandleEvent file="/go/src/github.com/wayfair-incubator/telefonistka/internal/pkg/githubapi/github.go:281"
time="2024-05-30T08:42:18Z" level=debug msg="Successfully got ArgoCD diff\n" func=github.com/wayfair-incubator/telefonistka/internal/pkg/githubapi.HandlePREvent file="/go/src/github.com/wayfair-incubator/telefonistka/internal/pkg/githubapi/github.go:128" prNumber=194 repo=commercetools/k8s-manifests-poc

This image shows Telefonitka is able to identify apps not in the sourcePath

image

@Oded-B Oded-B marked this pull request as ready for review May 30, 2024 09:07
hnnsgstfssn
hnnsgstfssn previously approved these changes Jun 11, 2024
internal/pkg/argocd/argocd_test.go Outdated Show resolved Hide resolved
Copy link

gitstream-cm bot commented Jun 11, 2024

This PR is missing a Jira ticket reference in the title or description.
Please add a Jira ticket reference to the title or description of this PR.

docs/installation.md Outdated Show resolved Hide resolved
Copy link

@yzdann yzdann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
There a couple of nitpicks i or we 'll cover with a following PR.

@Oded-B Oded-B merged commit 324e6b0 into main Jun 12, 2024
8 checks passed
Copy link

gitstream-cm bot commented Jun 12, 2024

🥷 Code experts: no user but you matched threshold 10

Oded-B has most 👩‍💻 activity in the files.
Oded-B has most 🧠 knowledge in the files.

See details

.github/workflows/lint.yml

Activity based on git-commit:

Oded-B
JUN 2 additions & 1 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 3%

Makefile

Activity based on git-commit:

Oded-B
JUN 2 additions & 1 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 7%

docs/installation.md

Activity based on git-commit:

Oded-B
JUN 1 additions & 0 deletions
MAY 4 additions & 0 deletions
APR 11 additions & 0 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 32%

go.mod

Activity based on git-commit:

Oded-B
JUN 16 additions & 14 deletions
MAY
APR 155 additions & 27 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 81%

go.sum

Activity based on git-commit:

Oded-B
JUN 22 additions & 19 deletions
MAY
APR 1587 additions & 235 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 75%

internal/pkg/argocd/argocd.go

Activity based on git-commit:

Oded-B
JUN 103 additions & 25 deletions
MAY 6 additions & 0 deletions
APR 273 additions & 0 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 100%

internal/pkg/argocd/argocd_test.go

Activity based on git-commit:

Oded-B
JUN 187 additions & 0 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 100%

internal/pkg/configuration/config.go

Activity based on git-commit:

Oded-B
JUN 8 additions & 7 deletions
MAY 1 additions & 0 deletions
APR 5 additions & 3 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 37%

internal/pkg/githubapi/github.go

Activity based on git-commit:

Oded-B
JUN 75 additions & 12 deletions
MAY 8 additions & 1 deletions
APR 51 additions & 10 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 48%

internal/pkg/mocks/.gitignore

Activity based on git-commit:

Oded-B
JUN 1 additions & 0 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 100%

internal/pkg/mocks/mocks.go

Activity based on git-commit:

Oded-B
JUN 5 additions & 0 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Oded-B: 100%

To learn more about /:\ gitStream - Visit our Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants