Skip to content

Commit e625fe2

Browse files
committed
[v1] Update v1 image tag and disable search feature
1 parent 1c9595d commit e625fe2

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.github/workflows/cd.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ jobs:
103103
# If the commit message starts with [v1], it's an update for v1
104104
if [[ "$COMMIT_MESSAGE" == \[v1\]* ]]; then
105105
echo "Update is for v1. Not setting v2.image.tag."
106-
# Update the app without changing the v2 image
107-
helm upgrade --install app-release ./my-chart
106+
# 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
107+
CURRENT_V2_IMAGE_TAG=$(kubectl get pods -l app=spring-app -o jsonpath="{.items[0].spec.containers[0].image}" | cut -d ":" -f 2)
108+
# 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
109+
helm upgrade --install app-release ./my-chart --set v1.image.tag=${{ inputs.image_tag }},v2.image.tag=$CURRENT_V2_IMAGE_TAG
110+
108111
else
109112
# If the commit message does not start with [v1], it's an update for v2
110113
echo "Update is for v2. Setting v2.image.tag to: ${{ inputs.image_tag }}."

src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ spring.redis.port=6379
1515
# spring.data.jpa.repositories.enabled=false
1616
# spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
1717
spring.jpa.hibernate.ddl-auto=none
18-
enableSearchFeature=true
18+
enableSearchFeature=false

src/test/java/net/codejava/JUnit5ExampleTest11.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ void testEnableSearchFeature() {
5858
// print a comment about the value of enableSearchFeature
5959
System.out.println("\n\n");
6060
System.out.println("--------------------------------------------------------------------------------");
61-
System.out.println("Expected value of enableSearchFeature: true");
61+
System.out.println("Expected value of enableSearchFeature: false");
6262
System.out.println("Actual value of enableSearchFeature: " + appController.getEnableSearchFeature());
6363
System.out.println("--------------------------------------------------------------------------------");
6464

65-
// assert that the value of enableSearchFeature is true
66-
assertEquals(true, appController.getEnableSearchFeature());
65+
// assert that the value of enableSearchFeature is false
66+
assertEquals(false, appController.getEnableSearchFeature());
6767

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

0 commit comments

Comments
 (0)