From c3b4d8fb497054bf5e8584acaa050af28cbf3557 Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Thu, 10 Sep 2020 12:53:46 +0800 Subject: [PATCH 1/3] Fix push semver versioned ci image not being pushed if has semver suffix. --- .github/workflows/master_only.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/master_only.yml b/.github/workflows/master_only.yml index cf058914d4..daac30d37d 100644 --- a/.github/workflows/master_only.yml +++ b/.github/workflows/master_only.yml @@ -42,7 +42,7 @@ jobs: - name: Push versioned release run: | # Build and push semver tagged commits - rx='^v[0-9]+?\.[0-9]+?\.[0-9]+?$' + rx='^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))$ ' if [[ "${RELEASE_VERSION}" =~ $rx ]]; then VERSION_WITHOUT_PREFIX=${RELEASE_VERSION:1} From 7c296feca7a5ec190ed956fc586fb0eb17d3e968 Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Thu, 10 Sep 2020 13:01:25 +0800 Subject: [PATCH 2/3] Add comments to document semver regex. --- .github/workflows/master_only.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/master_only.yml b/.github/workflows/master_only.yml index daac30d37d..d795f8cb90 100644 --- a/.github/workflows/master_only.yml +++ b/.github/workflows/master_only.yml @@ -42,7 +42,9 @@ jobs: - name: Push versioned release run: | # Build and push semver tagged commits - rx='^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))$ ' + # Regular expression should match MAJOR.MINOR.PATCH[-PRERELEASE[.IDENTIFIER]] + # eg. v0.7.1 v0.7.2-alpha v0.7.2-rc.1 + rx='^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))$ ' if [[ "${RELEASE_VERSION}" =~ $rx ]]; then VERSION_WITHOUT_PREFIX=${RELEASE_VERSION:1} From 5cd6773c8a01c84aa77b2846ebefbefd660c1c7e Mon Sep 17 00:00:00 2001 From: Zhu Zhanyan Date: Thu, 10 Sep 2020 13:45:04 +0800 Subject: [PATCH 3/3] Replace regular expression matcher with grep -P for Perl regex style matching. --- .github/workflows/master_only.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/master_only.yml b/.github/workflows/master_only.yml index d795f8cb90..501630a318 100644 --- a/.github/workflows/master_only.yml +++ b/.github/workflows/master_only.yml @@ -45,7 +45,7 @@ jobs: # Regular expression should match MAJOR.MINOR.PATCH[-PRERELEASE[.IDENTIFIER]] # eg. v0.7.1 v0.7.2-alpha v0.7.2-rc.1 rx='^v([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))$ ' - if [[ "${RELEASE_VERSION}" =~ $rx ]]; then + if echo "${RELEASE_VERSION}" | grep -P "$rx" &>/dev/null ; then VERSION_WITHOUT_PREFIX=${RELEASE_VERSION:1} docker tag gcr.io/kf-feast/feast-${{ matrix.component }}:${GITHUB_SHA} gcr.io/kf-feast/feast-${{ matrix.component }}:${VERSION_WITHOUT_PREFIX}