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: Apl 307 apl-charts repo creation #1774

Merged
merged 7 commits into from
Oct 28, 2024
Merged

fix: Apl 307 apl-charts repo creation #1774

merged 7 commits into from
Oct 28, 2024

Conversation

Ani1357
Copy link
Contributor

@Ani1357 Ani1357 commented Oct 25, 2024

This PR adds an extra check in the apl installation job which checks the presence of the apl-charts repo in gitea. It uses the git ls-remote command to do so and in case the repo is there it will skip cloning it again which was previously causing issues when the job did not finish in the first attempt.

Validation steps:

  1. Deploy APL from this branch
  2. What for the installation job to start and monitor its logs
  3. When you see this line in the logs: otomi:cmd:commit:gitea-apl-charts:info Cloning apl-charts in Gitea, then kill the pod so a new one resumes the installation
  4. The second pod should finish the installation without errors

@j-zimnowoda j-zimnowoda self-requested a review October 25, 2024 12:59
Copy link
Contributor

@merll merll left a comment

Choose a reason for hiding this comment

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

It seems this approach does not work reliably. I tested this and from an installation with one failed and one successful pod, it reads apl-charts repository already exists in Gitea twice. When I check the repo after successful installation, it is empty.

Generally git ls-remote works, but one would need to check for non-empty output, in addition to the exit code. It seems this is what the $`git ls-remote ... ` should be doing, but it does not. For comparison, if I create a token and run the following bash code, I get

if [[ -z $(git ls-remote https://$T1@gitea.merll-1.dev-akamai-apl.net/otomi/values.git) ]]; then echo empty; else echo not empty; fi
not empty

❯ if [[ -z $(git ls-remote https://$T1@gitea.merll-1.dev-akamai-apl.net/otomi/charts.git) ]]; then echo empty; else echo not empty; fi
empty

@Ani1357
Copy link
Contributor Author

Ani1357 commented Oct 28, 2024

@merll great catch. I updated the code to check for a non-empty reply.

@Ani1357 Ani1357 requested a review from merll October 28, 2024 09:33
Copy link
Contributor

@merll merll left a comment

Choose a reason for hiding this comment

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

I can confirm this works as intended now.

@Ani1357 Ani1357 merged commit 73aac2f into main Oct 28, 2024
8 checks passed
@Ani1357 Ani1357 deleted the APL-307 branch October 28, 2024 14:46
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.

4 participants