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

Target using SCM should be indempotent #1170

Merged
merged 14 commits into from
Feb 25, 2023
Merged

Conversation

olblak
Copy link
Member

@olblak olblak commented Feb 19, 2023

Requirement

Description

Fix #1162

At the moment the target execution combined with scm is not idempotent.

Running first updatecli apply --config manifest --push=false will clone the repository, update the files, but not publish the changes, as --push=false is specified.
If we run a second time the same command without --push=false, Updatecli will not change any files as local files are already up to date and won't push the changes as nothing change in the current pipeline execution.

They are a few workaround which must result in deleting the local directory.

I propose in this pullrequest to check for each target execution if the current working branch such as updatecli_xxx has the same commit hash than the source branch such as main and if the remote of updatecli_xxx exist.

The goal is to identify if the current working breach has left over changes that need to be publish

Test

To test this pull request, you can run the following commands:

cp <to_package_directory>
go test

Additional Information

Tradeoff

Potential improvement

@olblak olblak added scm-github SCM of type GiHhub scm-git SCM of kind "Git" scm-gittea labels Feb 19, 2023
@ghost
Copy link

ghost commented Feb 19, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@olblak olblak marked this pull request as draft February 19, 2023 16:39
olblak and others added 3 commits February 19, 2023 17:47
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak changed the title Target should push branch if left over changes Target using SCM should be indempotent Feb 19, 2023
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak marked this pull request as ready for review February 22, 2023 20:09
@olblak
Copy link
Member Author

olblak commented Feb 24, 2023

After additional thought, this #1133 should be fixed by removing the reset operation done during the git checkout

olblak and others added 3 commits February 24, 2023 21:57
Remove early exit check

Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
@olblak olblak merged commit 8abbecb into updatecli:main Feb 25, 2023
@olblak olblak added this to the 0.45.0 milestone Feb 25, 2023
@olblak olblak added the bug Something isn't working label Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scm-git SCM of kind "Git" scm-github SCM of type GiHhub scm-gittea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

github/pullrequest Auth failure poisons retries
1 participant