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

GitHub Deployment - Allow Automerge configuration #193

Merged

Conversation

mikesplain
Copy link
Contributor

Hi there, thanks for adding support for Deployments to the Notifications Engine. I was testing out the support and ran into issues trying to deploy an older ref from the default branch. The notifications controller would report an error when merging the default branch into the commit referenced. Upon reading the docs, it looks like this is the intended behavior so it seems reasonable to allow users to disable this feature when they would not like their deployment updated against the default branch.

This PR was tested against an internal custom ArgoCD build and it resolved our issues with deployments only functioning on the latest commit in a default branch.

I'm happy to make any required changes, just let me know. Thanks!

@mikesplain mikesplain force-pushed the github_environments_automerge branch from 5795ac0 to cabb356 Compare July 10, 2023 15:36
@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Patch coverage: 28.57% and project coverage change: -0.06% ⚠️

Comparison is base (8570c23) 54.31% compared to head (898778a) 54.25%.
Report is 1 commits behind head on master.

❗ Current head 898778a differs from pull request most recent head 2c52675. Consider uploading reports for the commit 2c52675 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #193      +/-   ##
==========================================
- Coverage   54.31%   54.25%   -0.06%     
==========================================
  Files          35       35              
  Lines        3198     3205       +7     
==========================================
+ Hits         1737     1739       +2     
- Misses       1208     1211       +3     
- Partials      253      255       +2     
Files Changed Coverage Δ
pkg/services/github.go 34.80% <28.57%> (-0.20%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mikesplain mikesplain force-pushed the github_environments_automerge branch 3 times, most recently from ae39a91 to 16d940d Compare July 10, 2023 16:30
@mikesplain
Copy link
Contributor Author

mikesplain commented Jul 10, 2023

Please hold off on this at the moment, I want to do another round of testing now that I got the tests and linter to pass.

@mikesplain mikesplain force-pushed the github_environments_automerge branch from 16d940d to f747cf7 Compare July 11, 2023 14:13
@pasha-codefresh
Copy link
Member

@mikesplain is it ready for review?

@mikesplain mikesplain force-pushed the github_environments_automerge branch from f747cf7 to 913c9a2 Compare July 11, 2023 18:21
@mikesplain
Copy link
Contributor Author

mikesplain commented Jul 11, 2023

@pasha-codefresh Yes It is, thank you! Just finished a second round of testing.

@pasha-codefresh pasha-codefresh self-requested a review July 12, 2023 13:54
```

**Notes**:
- If the message is set to 140 characters or more, it will be truncated.
- If `github.repoURLPath` and `github.revisionPath` are same as above, they can be omitted.
- By default, github deployments utilize automerge to ensure the requested ref is up to date with the default branch.
Setting this option to `false` is required if you would like to deploy older refs in your default branch.
Copy link
Member

Choose a reason for hiding this comment

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

Can we also mention that this parameter is optional and by default it is false, i would write opposite , like: Setting this option to true is required ....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the delay I realized that you're right, this PR set the value to false by default however the upstream API is true by default. I had to modify the PR and language in the doc to reverse the behavior. I hope the language in the docs is more clear now. Thanks!

@pasha-codefresh
Copy link
Member

@mikesplain LGTM, just small comment about documentation

@carloscastrojumo
Copy link
Contributor

I was just looking for this feature @mikesplain . Thanks for the PR. Are you still available to address the issues requested by the reviewers?

@mikesplain
Copy link
Contributor Author

Yes, found a bug and had to fix the code slightly. Tested it internally and it works fine just need to rebase. I'll update the PR tomorrow ASAP.

@mikesplain mikesplain force-pushed the github_environments_automerge branch from 3f034ec to b621a21 Compare August 10, 2023 16:50
Signed-off-by: Mike Splain <[email protected]>
Signed-off-by: Mike Splain <[email protected]>
@mikesplain mikesplain force-pushed the github_environments_automerge branch from b621a21 to 898778a Compare August 10, 2023 16:57
@mikesplain
Copy link
Contributor Author

@pasha-codefresh I apologize for the long delay, life gets in the way. This is ready for review again and has been rebased against master!

After your comments I realized the PR worked properly if you set the new configuration however the default was false, rather than the Github default (and argocd notifications default, true), see https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment for more details.

I switched the use of pointers so we can check if the user has set the configuration and default it accordingly. I'm not sure if the project has a better way to handle this, I'm happy to amend with any suggestions. Thanks again

@carloscastrojumo
Copy link
Contributor

Any news on this @pasha-codefresh ?

@pasha-codefresh
Copy link
Member

Sorry, hadnt time to review, @carloscastrojumo @mikesplain , i will do it today / tomorrow

@pasha-codefresh
Copy link
Member

LGTM, thank you

@pasha-codefresh pasha-codefresh merged commit 9dcecdc into argoproj:master Sep 5, 2023
3 checks passed
@mikesplain
Copy link
Contributor Author

Great thanks so much @pasha-codefresh!

@pasha-codefresh
Copy link
Member

Thank you for great job :) you can open PR to argo-cd with notification-engine update, you can send it here, i will help with review

@mikesplain mikesplain deleted the github_environments_automerge branch September 5, 2023 14:53
lol3909 pushed a commit to lol3909/notifications-engine that referenced this pull request Oct 19, 2023
* Allow AutoMerge configuration

Signed-off-by: Mike Splain <[email protected]>

* Add docs and test

Signed-off-by: Mike Splain <[email protected]>

* Fix default and docs

Signed-off-by: Mike Splain <[email protected]>

---------

Signed-off-by: Mike Splain <[email protected]>
Co-authored-by: pasha-codefresh <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>
pasha-codefresh added a commit that referenced this pull request Oct 19, 2023
… (#208)

* fix: oncePer condition only checked when ` when` condition is true

Signed-off-by: Anthony Mikhail <[email protected]>

* wip

Signed-off-by: Anthony Mikhail <[email protected]>

* wip

Signed-off-by: Anthony Mikhail <[email protected]>

* wip

Signed-off-by: Anthony Mikhail <[email protected]>

* add debuging

Signed-off-by: Anthony Mikhail <[email protected]>

* wip

Signed-off-by: Anthony Mikhail <[email protected]>

* Revert "wip"

This reverts commit 6313312.

Signed-off-by: Anthony Mikhail <[email protected]>

* wip

Signed-off-by: Anthony Mikhail <[email protected]>

* chore(deps): bump github.com/gregdel/pushover from 1.1.0 to 1.2.1 (#210)

Bumps [github.com/gregdel/pushover](https://github.com/gregdel/pushover) from 1.1.0 to 1.2.1.
- [Commits](gregdel/pushover@v1.1.0...v1.2.1)

---
updated-dependencies:
- dependency-name: github.com/gregdel/pushover
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Anthony Mikhail <[email protected]>

* GitHub Deployment - Allow Automerge configuration (#193)

* Allow AutoMerge configuration

Signed-off-by: Mike Splain <[email protected]>

* Add docs and test

Signed-off-by: Mike Splain <[email protected]>

* Fix default and docs

Signed-off-by: Mike Splain <[email protected]>

---------

Signed-off-by: Mike Splain <[email protected]>
Co-authored-by: pasha-codefresh <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* Add GitHub Pull Request comments integration (#211)

* Add pull request comment to github service

Signed-off-by: bennesp <[email protected]>

* Add github pull request comment templater test

Signed-off-by: bennesp <[email protected]>

* Add github pull request comment docs

Signed-off-by: bennesp <[email protected]>

---------

Signed-off-by: bennesp <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* chore(deps): bump codecov/codecov-action from 3 to 4 (#216)

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Anthony Mikhail <[email protected]>

* revert to v3 (#218)

Signed-off-by: Anthony Mikhail <[email protected]>

* Add CardsV2 Support to Google Chat (#201)

Signed-off-by: Tom Paulus <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* chore(deps): bump expr version and golang as required by expr 1.15 (#221)

* bump expr version

Signed-off-by: zachaller <[email protected]>

* upgrade go expr uses any

Signed-off-by: zachaller <[email protected]>

* use root go version

Signed-off-by: zachaller <[email protected]>

* add sum

Signed-off-by: zachaller <[email protected]>

* change for golang upgrade

Signed-off-by: zachaller <[email protected]>

---------

Signed-off-by: zachaller <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* wip
Signed-off-by: Anthony Mikhail <[email protected]>

Signed-off-by: Anthony Mikhail <[email protected]>

* fix duplicate when using self-service (#227)

* fix duplicate when using self-service

Signed-off-by: May Zhang <[email protected]>

* fix duplicate when using self-service

Signed-off-by: May Zhang <[email protected]>

* fix tests

Signed-off-by: May Zhang <[email protected]>

* -s

Signed-off-by: May Zhang <[email protected]>

* add test cases

Signed-off-by: May Zhang <[email protected]>

* remove not used method

Signed-off-by: May Zhang <[email protected]>

---------

Signed-off-by: May Zhang <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* Spelling (#220)

* spelling: available

Signed-off-by: Josh Soref <[email protected]>

* spelling: configuration

Signed-off-by: Josh Soref <[email protected]>

* spelling: emoji

Signed-off-by: Josh Soref <[email protected]>

* spelling: environment

Signed-off-by: Josh Soref <[email protected]>

* spelling: github

Signed-off-by: Josh Soref <[email protected]>

* spelling: notification

Signed-off-by: Josh Soref <[email protected]>

* spelling: overridden

Signed-off-by: Josh Soref <[email protected]>

* spelling: successfully

Signed-off-by: Josh Soref <[email protected]>

* spelling: unmarshal

Signed-off-by: Josh Soref <[email protected]>

* spelling: variable or

Signed-off-by: Josh Soref <[email protected]>

* spelling: variables are

Signed-off-by: Josh Soref <[email protected]>

* spelling: webhook

Signed-off-by: Josh Soref <[email protected]>

---------

Signed-off-by: Josh Soref <[email protected]>
Co-authored-by: pasha-codefresh <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* Update documentation for Slack options (#209)

* Clarify option types

Signed-off-by: Andreas Lindhé <[email protected]>

* Sort alphabetically

Signed-off-by: Andreas Lindhé <[email protected]>

* Add missing `channels` and `sigingSecret` options

Signed-off-by: Andreas Lindhé <[email protected]>

* Convert list to Markdown table

Signed-off-by: Andreas Lindhé <[email protected]>

* Clarify `token` description

Signed-off-by: Andreas Lindhé <[email protected]>

* Add example column

Signed-off-by: Andreas Lindhé <[email protected]>

* Populate rest of example fields

Signed-off-by: Andreas Lindhé <[email protected]>

* Fix typo

Co-authored-by: Blake Pettersson <[email protected]>
Signed-off-by: Andreas Lindhé <[email protected]>

---------

Signed-off-by: Andreas Lindhé <[email protected]>
Co-authored-by: Blake Pettersson <[email protected]>
Co-authored-by: pasha-codefresh <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

* fix: avoid crashing in gitHubService.Send when repoURL has no / (#219)

Signed-off-by: Josh Soref <[email protected]>
Co-authored-by: pasha-codefresh <[email protected]>
Signed-off-by: Anthony Mikhail <[email protected]>

---------

Signed-off-by: Anthony Mikhail <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Mike Splain <[email protected]>
Signed-off-by: bennesp <[email protected]>
Signed-off-by: Tom Paulus <[email protected]>
Signed-off-by: zachaller <[email protected]>
Signed-off-by: May Zhang <[email protected]>
Signed-off-by: Josh Soref <[email protected]>
Signed-off-by: Andreas Lindhé <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mike Splain <[email protected]>
Co-authored-by: pasha-codefresh <[email protected]>
Co-authored-by: Benedetto Nespoli <[email protected]>
Co-authored-by: Tom Paulus <[email protected]>
Co-authored-by: Zach Aller <[email protected]>
Co-authored-by: May Zhang <[email protected]>
Co-authored-by: Josh Soref <[email protected]>
Co-authored-by: Andreas Lindhé <[email protected]>
Co-authored-by: Blake Pettersson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants