Skip to content

Commit

Permalink
[v1] Update v1 image tag and disable search feature
Browse files Browse the repository at this point in the history
tsviz committed Feb 26, 2024
1 parent 1c9595d commit e625fe2
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -103,8 +103,11 @@ jobs:
# If the commit message starts with [v1], it's an update for v1
if [[ "$COMMIT_MESSAGE" == \[v1\]* ]]; then
echo "Update is for v1. Not setting v2.image.tag."
# Update the app without changing the v2 image
helm upgrade --install app-release ./my-chart
# Fetch the current v2 image tag from the running pods - this is to ensure the v2.image.tag is not changed from the values.yaml file
CURRENT_V2_IMAGE_TAG=$(kubectl get pods -l app=spring-app -o jsonpath="{.items[0].spec.containers[0].image}" | cut -d ":" -f 2)
# Update the app without changing the v2 image but instead change the v1 image to inputs.image_tag ensure the v2.image.tag is not changed from the values.yaml file
helm upgrade --install app-release ./my-chart --set v1.image.tag=${{ inputs.image_tag }},v2.image.tag=$CURRENT_V2_IMAGE_TAG
else
# If the commit message does not start with [v1], it's an update for v2
echo "Update is for v2. Setting v2.image.tag to: ${{ inputs.image_tag }}."
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -15,4 +15,4 @@ spring.redis.port=6379
# spring.data.jpa.repositories.enabled=false
# spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.ddl-auto=none
enableSearchFeature=true
enableSearchFeature=false
6 changes: 3 additions & 3 deletions src/test/java/net/codejava/JUnit5ExampleTest11.java
Original file line number Diff line number Diff line change
@@ -58,12 +58,12 @@ void testEnableSearchFeature() {
// print a comment about the value of enableSearchFeature
System.out.println("\n\n");
System.out.println("--------------------------------------------------------------------------------");
System.out.println("Expected value of enableSearchFeature: true");
System.out.println("Expected value of enableSearchFeature: false");
System.out.println("Actual value of enableSearchFeature: " + appController.getEnableSearchFeature());
System.out.println("--------------------------------------------------------------------------------");

// assert that the value of enableSearchFeature is true
assertEquals(true, appController.getEnableSearchFeature());
// assert that the value of enableSearchFeature is false
assertEquals(false, appController.getEnableSearchFeature());

System.out.println("\n\nTest11-2 Successful!\n\n");
}

0 comments on commit e625fe2

Please sign in to comment.