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

Promote deployment does not consider branchRef of promoted environment/deployment for branch checkout #3681

Open
sjerdo opened this issue Mar 15, 2024 · 1 comment

Comments

@sjerdo
Copy link

sjerdo commented Mar 15, 2024

Describe the bug

Promote deployments do not promote the exact deployment of one environment to another.

When the branch is changed or does not yet contain all changes which are included in the deployed branchRef, this could affect in incorrect services being deployed (if docker-compose.yml was changed)

To Reproduce

Deploy a branchRef to environment develop using a tag (eg 1.0.0)

lagoon deploy branch --branch develop --branchRef=1.0.0

Then promote the latest deployment of this environment to another environment, eg. main.

lagoon deploy promote --project PROJECT -s develop -d main

In the logs for the develop deployment, we see these git checkout commands for step 'Checkout Repository':

+ [email protected]:PATH/TO/PROJECT.git
+ REF=1.0.0
+ git init .
Initialized empty Git repository in /kubectl-build-deploy/git/.git/
+ git config remote.origin.url [email protected]:PATH/TO/PROJECT.git
+ git fetch --depth=10 --tags --progress [email protected]:PATH/TO/PROJECT.git '+refs/heads/*:refs/remotes/origin/*'
+ git checkout --force 1.0.0
Note: switching to '27.0.1'.
...
HEAD is now at 2031482a Merge branch 'feature/branch' into 'develop'
+ git submodule update --init --recursive --jobs=6
+ [[ -n '' ]]
+ '[' '!' -f .lagoon.yml ']'
++ cat .lagoon.yml
++ shyaml get-value environment_variables.git_sha false
+ INJECT_GIT_SHA=false
+ '[' false == true ']'
+ LAGOON_GIT_SHA=0000000000000000000000000000000000000000

In the logs for the the promote deployment to main, we see these git checkout commands for step 'Checkout Repository':

+ [email protected]:PATH/TO/PROJECT.git
+ REF=origin/develop
+ git init .
Initialized empty Git repository in /kubectl-build-deploy/git/.git/
+ git config remote.origin.url [email protected]:PATH/TO/PROJECT.git
+ git fetch --depth=10 --tags --progress [email protected]:PATH/TO/PROJECT.git '+refs/heads/*:refs/remotes/origin/*'
+ git checkout --force origin/develop
Note: switching to 'origin/develop'.
...
HEAD is now at a2770406 Merge branch 'feature/branch-containing-docker-compose-changes' into 'develop'
+ git submodule update --init --recursive --jobs=6
+ [[ -n '' ]]
+ '[' '!' -f .lagoon.yml ']'
++ cat .lagoon.yml
++ shyaml get-value environment_variables.git_sha false
+ INJECT_GIT_SHA=false
+ '[' false == true ']'
+ LAGOON_GIT_SHA=0000000000000000000000000000000000000000

Expected behavior

We expect a checkout of the revision which was used during the deployment to develop to be used for the configuration files (.lagoon.yml and docker-compose.yml) instead of the latest version of these files in the branch.

In this case I also expect a the Git checkout HEAD to be at 2031482a instead of a2770406

Screenshots

N/A

Additional context

N/A

@smlx
Copy link
Member

smlx commented Mar 18, 2024

Possibly related to uselagoon/build-deploy-tool#229

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

No branches or pull requests

2 participants