-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add support for GitHub app credentials #235
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @philamente,
Thanks for the contribution!
There are a few things that need to be addressed before we can merge this.
- I see you have added these fields to both the structure of
repository
andrepository_credentials
but have only added them to the schema ofrepository_credentials
(and notrepository
). Was this intentional? - Please can you ensure that you add tests covering the population of the newly added attributes to the affected resources? Note: at present, the acceptance tests are failing, so this will also need to be addressed, although I think this will be resolved by point 1.
- As
GithubAppId
andGithubInstallationId
areint64
types within ArgoCD, I believe you will need to set these toschema.TypeString
within the Terraform schema (rather thanschema.TypeInt
) and then convert between string/int64 as appropriate. This can be tested/validated by testing the max boundary of these values in the test you add in point 2. For reference, see theshard
attribute on theargocd_cluster
resource and the usage of theutils
functionconvertStringToInt64
within this repository. - Docs will need to be updated based to reflect changes in point 3.
Feel free to reach out if anything I've said is unclear and/or if you need more specific guidance!
Hi @onematchfox, thanks for your kind feedback! I saw the failing tests from github actions - unfortunately my local test setup did not yet work properly (working on a corporate pc with annoying limitations - might switch to private on for testing env). This contribution is my first attempt in Go, so thanks for baring with me and providing such a detailed feedback. ;) I also noticed that we might have an issue with one of the maps which were set to String only and hence will break with int. Your proposal in 3) could circumvent that. Thanks! |
@onematchfox Maybe you have an idea: the two ids (github_app as well as the github_app_installation) require type int64. Hence using the Int64Pointer does not work/make sense. However through the conversion to String the optional (unset) case of 0 does not get handled as null by terraform as it gets parsed to "0". --> Right now I am thinking about the following:
But most likely I miss something here, so maybe you have an even better/more elegant solution |
Repository credentials are read using the [`ListRepositoryCredentials` function](https://github.com/oboukili/terraform-provider-argocd/blob/124d87be91701f969512d2b855e868929c0245db/argocd/resource_argocd_repository_credentials.go#L79) which only returns `url` and `username` as per the implementation at https://github.com/argoproj/argo-cd/blob/7be094f38d06859b594b98eb75c7c70d39b80b1e/server/repocreds/repocreds.go#L58-L61
Going to go ahead and merge this now. Thanks, @philamente, for the contribution! |
Thank you very much for feedback and review! |
Co-authored-by: OneMatchFox <[email protected]>
We need to switch our authentication towards github to GitHub App. As there was also a feature request for this one in the issues, I hence added GitHub App functionality to the following ressources:
The underlying package already supports it