ci-dockerfiles-sanity-check: Build name fix for non-Gerrit case
If there's no Gerrit patch, don't add dangling hyphen to build name.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I95d4520c3d0588ff657d4dbd7377816174091acf
diff --git a/ci-dockerfiles-sanity-check.yaml b/ci-dockerfiles-sanity-check.yaml
index a5cb4b6..c33db29 100644
--- a/ci-dockerfiles-sanity-check.yaml
+++ b/ci-dockerfiles-sanity-check.yaml
@@ -71,7 +71,11 @@
builders:
- shell: |
#!/bin/bash -e
- echo "#${BUILD_NUMBER}-${GERRIT_PATCHSET_REVISION:0:8}" > ${WORKSPACE}/version.txt
+ if [ -n "${GERRIT_PATCHSET_REVISION}" ]; then
+ echo "#${BUILD_NUMBER}-${GERRIT_PATCHSET_REVISION:0:8}" > ${WORKSPACE}/version.txt
+ else
+ echo "#${BUILD_NUMBER}" > ${WORKSPACE}/version.txt
+ fi
- build-name-setter:
name: 'version.txt'
file: true