Skip to content

[#952] Updated Lagoon deployment script to use variable update.#1209

Merged
AlexSkrypnyk merged 3 commits intodevelopfrom
feature/add-update-lagoon-variable
Mar 1, 2024
Merged

[#952] Updated Lagoon deployment script to use variable update.#1209
AlexSkrypnyk merged 3 commits intodevelopfrom
feature/add-update-lagoon-variable

Conversation

@richardgaunt
Copy link
Copy Markdown
Contributor

@richardgaunt richardgaunt commented Feb 28, 2024

closes #952

Checklist before requesting a review

  • I have formatted the subject to include ticket number as [#123] Verb in past tense with dot at the end.
  • I have added a link to the issue tracker
  • I have provided information in Changed section about WHY something was done if this was not a normal implementation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have run new and existing relevant tests locally with my changes, and they passed
  • I have provided screenshots, where applicable

Changed

  1. Updated to lagoon update variable rather than add and delete.
  2. Updated tests.

Screenshots

Comment thread .drevops/tests/bats/deployment1.bats Outdated
# Explicitly set DB overwrite flag to 0 due to a bug in Lagoon.
assert_contains "-l testlagoon delete variable -p testproject -e testbranch -N DREVOPS_PROVISION_OVERRIDE_DB" "$(mock_get_call_args "${mock_lagoon}" 3)"
assert_contains "-l testlagoon add variable -p testproject -e testbranch -N DREVOPS_PROVISION_OVERRIDE_DB -V 0 -S global" "$(mock_get_call_args "${mock_lagoon}" 4)"
assert_contains "-l testlagoon update variable -p testproject -e testbranch -N DREVOPS_PROVISION_OVERRIDE_DB -V 0 -S global" "$(mock_get_call_args "${mock_lagoon}" 4)"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Had trouble running locally - with the deployment code we could test it in isolation as unit tests rather than deploying actual builds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@richardgaunt the numbers (3, 4 etc.) at the end of the assertions need to be updated throughout the whole test after the order being modified (this is due to using an old way of asserting that commands run in the order)

assert_contains "-l testlagoon update variable -p testproject -e testbranch -N DREVOPS_PROVISION_OVERRIDE_DB -V 0 -S global" "$(mock_get_call_args "${mock_lagoon}" 3)"

@AlexSkrypnyk
Copy link
Copy Markdown
Member

@richardgaunt
could you please confirm that you have tested this code for 2 cases on real Lagoon instance:

  1. The env is brand new
  2. The env already exists and the deployment is a follow-up deployment

This is to make sure that Lagoon's API supports running update on non-existing variable.

@AlexSkrypnyk AlexSkrypnyk added the Requires more work Pull request was reviewed and reviver(s) asked to work further on the pull request label Feb 28, 2024
Copy link
Copy Markdown
Member

@AlexSkrypnyk AlexSkrypnyk left a comment

Choose a reason for hiding this comment

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

@richardgaunt
Could you please update tests. Thank you

@richardgaunt
Copy link
Copy Markdown
Contributor Author

@richardgaunt could you please confirm that you have tested this code for 2 cases on real Lagoon instance:

1. The env is brand new

2. The env already exists and the deployment is a follow-up deployment

This is to make sure that Lagoon's API supports running update on non-existing variable.

Tested with the PR new environment creation, tested with overriding a database. All worked correctly and the variables were correct values after deploying.

@AlexSkrypnyk AlexSkrypnyk changed the title [#952] Added laggon update variable. [#952] Updated Lagoon deployment script to use variable update. Mar 1, 2024
@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (squash) March 1, 2024 00:08
@AlexSkrypnyk AlexSkrypnyk added Chore and removed Requires more work Pull request was reviewed and reviver(s) asked to work further on the pull request labels Mar 1, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 1, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 61.51%. Comparing base (e5808aa) to head (cda0d0f).

Files Patch % Lines
scripts/drevops/deploy-lagoon.sh 50.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #1209       +/-   ##
============================================
- Coverage    71.88%   61.51%   -10.37%     
============================================
  Files           38       38               
  Lines         2849     2843        -6     
============================================
- Hits          2048     1749      -299     
- Misses         801     1094      +293     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/add-update-lagoon-variable branch from 6241c1b to cda0d0f Compare March 1, 2024 05:25
@AlexSkrypnyk AlexSkrypnyk merged commit db0f670 into develop Mar 1, 2024
@AlexSkrypnyk AlexSkrypnyk deleted the feature/add-update-lagoon-variable branch March 1, 2024 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Update Lagoon deployments to use variable update instead of variable delete + variable add

2 participants