run_image_tests: replace CHANGE_ID with BRANCH_NAME

CHANGE_ID is set for PRs, which is why it worked during the review
process, but in the master branch it is not set. BRANCH_NAME is set for
both PRs and master branch. In case of PRs it is in form `PR-<pull
request number>`.
This commit is contained in:
Martin Sehnoutka 2020-09-16 08:33:09 +02:00 committed by Lars Karlitski
parent 8ccbde8591
commit d819b26e3f
2 changed files with 3 additions and 3 deletions

View file

@ -52,10 +52,10 @@ var disableLocalBoot = flag.Bool("disable-local-boot", false, "when this flag is
// note: in case of migration to sth else like Github Actions, change it to whatever variables GH Action provides
func GenerateCIArtifactName(prefix string) (string, error) {
distroCode := os.Getenv("DISTRO_CODE")
changeId := os.Getenv("CHANGE_ID")
changeId := os.Getenv("BRANCH_NAME")
buildId := os.Getenv("BUILD_ID")
if changeId == "" || buildId == "" || distroCode == "" {
return "", fmt.Errorf("The environment variables must specify CHANGE_ID, BUILD_ID, and DISTRO_CODE")
return "", fmt.Errorf("The environment variables must specify BRANCH_NAME, BUILD_ID, and DISTRO_CODE")
}
return fmt.Sprintf("%s%s-%s-%s", prefix, distroCode, changeId, buildId), nil

View file

@ -58,7 +58,7 @@ run_test_case () {
AZURE_CREDS=${AZURE_CREDS-/dev/null}
OPENSTACK_CREDS=${OPENSTACK_CREDS-/dev/null}
VCENTER_CREDS=${VCENTER_CREDS-/dev/null}
TEST_CMD="env $(cat $AZURE_CREDS $OPENSTACK_CREDS $VCENTER_CREDS) CHANGE_ID=$CHANGE_ID BUILD_ID=$BUILD_ID DISTRO_CODE=$DISTRO_CODE $TEST_RUNNER -test.v ${IMAGE_TEST_CASES_PATH}/${TEST_CASE_FILENAME}"
TEST_CMD="env $(cat $AZURE_CREDS $OPENSTACK_CREDS $VCENTER_CREDS) BRANCH_NAME=${BRANCH_NAME-master} BUILD_ID=$BUILD_ID DISTRO_CODE=$DISTRO_CODE $TEST_RUNNER -test.v ${IMAGE_TEST_CASES_PATH}/${TEST_CASE_FILENAME}"
# Run the test and add the test name to the list of passed or failed
# tests depending on the result.