From 44225f2212aa0dce310cecd78cf8b82106b18177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Ma=C5=82achowski?= Date: Thu, 2 Jan 2025 12:43:51 +0100 Subject: [PATCH] Rename env --- cmd/image-builder/config.go | 2 +- cmd/image-builder/config_test.go | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cmd/image-builder/config.go b/cmd/image-builder/config.go index 8f1fce74890f..0855ad6f1cd1 100644 --- a/cmd/image-builder/config.go +++ b/cmd/image-builder/config.go @@ -356,7 +356,7 @@ func loadJenkinsGitState() (GitStateConfig, error) { } baseRef := os.Getenv("CHANGE_BRANCH") - pullRequestHeadSHA := os.Getenv("CHANGE_TARGET") + pullRequestHeadSHA := os.Getenv("CHANGE_HEAD_SHA") gitState.JobType = "presubmit" gitState.PullRequestNumber = pullNumber diff --git a/cmd/image-builder/config_test.go b/cmd/image-builder/config_test.go index 5d5325924886..49d91b9ad470 100644 --- a/cmd/image-builder/config_test.go +++ b/cmd/image-builder/config_test.go @@ -385,11 +385,10 @@ func TestLoadGitStateConfig(t *testing.T) { ciSystem: Jenkins, }, env: map[string]string{ - "BRANCH_NAME": "refs/heads/main", - "JENKINS_HOME": "/some/absolute/path", - "GIT_URL": "github.com/kyma-project/test-infra", - "GIT_COMMIT": "1234", - "CHANGE_TARGET": "refs/heads/main", + "BRANCH_NAME": "refs/heads/main", + "JENKINS_HOME": "/some/absolute/path", + "GIT_URL": "github.com/kyma-project/test-infra", + "GIT_COMMIT": "1234", }, gitState: GitStateConfig{ RepositoryName: "test-infra", @@ -404,12 +403,12 @@ func TestLoadGitStateConfig(t *testing.T) { ciSystem: Jenkins, }, env: map[string]string{ - "BRANCH_NAME": "refs/heads/main", - "JENKINS_HOME": "/some/absolute/path", - "CHANGE_ID": "14", - "GIT_URL": "github.com/kyma-project/test-infra", - "GIT_COMMIT": "1234", - "CHANGE_TARGET": "4321", + "BRANCH_NAME": "refs/heads/main", + "JENKINS_HOME": "/some/absolute/path", + "CHANGE_ID": "14", + "GIT_URL": "github.com/kyma-project/test-infra", + "GIT_COMMIT": "1234", + "CHANGE_HEAD_SHA": "4321", // Must be explicitly set when calling docker run }, gitState: GitStateConfig{ RepositoryName: "test-infra",