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 the jobs sync from/to bitnami in the GHA's "kubeapps general" workflow #5524

Merged
merged 67 commits into from
Oct 20, 2022

Conversation

beni0888
Copy link
Collaborator

@beni0888 beni0888 commented Oct 20, 2022

Description of the change

The changes in this PR are aimed at fixing the issues with the GHA's jobs sync_from_bitnami and sync_to_bitnami that have been failing so far. The main problem was that the GHA runner wasn't able to connect to the required GitHub repositories kubeapps-bot/charts and bitnami/charts, mainly because in our scripts we were using the HTTPS protocol for defining the remotes for those repositories, and that made the git commands to ask for credentials instead of using the corresponding SSH keys. The reason why this wasn't failing in GHA workflow and not in the CircleCI one, is that for some unknown reason (at least for me, although I suspect it has to do with the use of the checkout step), the CircleCI runner has a specific ~/.gitconfig setup as follows:

...
[url "ssh://git@github.com"]
	insteadOf = https://github.com
... 

So it was transparently using git over ssh protocol and taking advantage of the configured keys in the runner.

Besides that, in this PR I have taken advantage to document some of the functions used by the bash scripts that support those jobs and refactor them (mainly renaming variables) to try to better convey the actual intention and responsibility of each script and function (although I cannot be 100% sure I got my goal).

Also, during the development/debugging/head-hitting-against-the-wall process, I discovered that we have added some unnecessary/unused SSH keys to the jobs, so I have removed the associated code and, hopefully, some complexity from the workflow.

Finally, while working on this, I detected a bug in the code of the setup job in charge of setting the value for the triggered_from_fork output variable, so it's been fixed and a previous step has been added to that job, sending to the output the value of the github.event that triggered the workflow, just with debugging purposes.

Benefits

  • The jobs sync_from_bitnami and sync_to_bitnami from GHA's kubeapps general workflow work as expected.
  • Some pieces of the code have been refactored to make their intention and functionality clearer 🤞🏻 .
  • Some complexity has been removed.
  • Our CI scripts are now more robust, not relying on accidental/hidden Git configuration.
  • The setup job's output variable triggered_from_fork is now set as expected.

Possible drawbacks

  • Even though I think I have thoroughly tested the changes, some unforeseen side-effects/bugs could appear.

Applicable issues

Additional information

Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
…st sync_to_bitnami

Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
…nami

Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
@netlify
Copy link

netlify bot commented Oct 20, 2022

Deploy Preview for kubeapps-dev canceled.

Name Link
🔨 Latest commit 635f087
🔍 Latest deploy log https://app.netlify.com/sites/kubeapps-dev/deploys/6351296c0534e800091e6173

Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
@beni0888 beni0888 mentioned this pull request Oct 20, 2022
30 tasks
@beni0888 beni0888 changed the title Fix sync from bitnami gha Fix the jobs sync from/to bitnami in the GHA's "kubeapps general" workflow Oct 20, 2022
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
Signed-off-by: Jesús Benito Calzada <bjesus@vmware.com>
@beni0888 beni0888 self-assigned this Oct 20, 2022
@beni0888 beni0888 added component/ci Issue related to kubeapps ci system github_actions Pull requests that update GitHub Actions code labels Oct 20, 2022
@beni0888 beni0888 added this to the Migrate CI to GitHub Actions milestone Oct 20, 2022
@beni0888 beni0888 marked this pull request as ready for review October 20, 2022 11:12
Copy link
Collaborator

@castelblanque castelblanque left a comment

Choose a reason for hiding this comment

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

Excellent. Thanks for the investigation, the fix and the improvements!

@beni0888 beni0888 merged commit cf45610 into main Oct 20, 2022
@beni0888 beni0888 deleted the fix-sync-from-bitnami-gha branch October 20, 2022 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required component/ci Issue related to kubeapps ci system github_actions Pull requests that update GitHub Actions code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants