Merge pull request #1776 from monopole/moarTweaksDarnPseudo

Tweaks to accomodate pseudo/k8s.
This commit is contained in:
Jeff Regan
2019-11-11 17:11:31 -08:00
committed by GitHub
2 changed files with 34 additions and 24 deletions

View File

@@ -10,29 +10,41 @@ set -x
module=$1 module=$1
shift shift
# The following assumes git tags formatted like function setSemVer {
# "api/v1.2.3" and splits on the slash. # Check the tag for consistency with module name.
# Goreleaser doesn't know what to do with this # The following assumes git tags formatted like
# tag format, and fails when creating an archive # "api/v1.2.3" and splits on the slash.
# with a / in the name. # Goreleaser doesn't know what to do with this
fullTag=$(git describe) # tag format, and fails when creating an archive
export tModule=${fullTag%/*} # with a / in the name.
export tSemver=${fullTag#*/} local fullTag=$(git describe)
echo "tModule=$tModule" local tModule=${fullTag%/*}
echo "tSemver=$tSemver" semVer=${fullTag#*/}
if [ "$module" != "$tModule" ]; then
# Make sure version has no slash
# (k8s/v0.1.0 becomes v0.1.0)
local tmp=${semVer#*/}
if [ "$tmp" != "$semVer" ]; then
semVer="$tmp"
fi
echo "tModule=$tModule"
echo "semVer=$semVer"
if [ "$module" != "$tModule" ]; then
# Tag and argument sanity check # Tag and argument sanity check
echo "Unexpected mismatch: moduleFromArg=$module, moduleFromTag=$tModule" echo "Unexpected mismatch: moduleFromArg=$module, moduleFromTag=$tModule"
echo "Either the module arg to this script is wrong, or the git tag is wrong." echo "Either the module arg to this script is wrong, or the git tag is wrong."
exit 1 exit 1
fi fi
}
if [ "$module" == "pseudok8s" ]; then setSemVer
cd pseudo/k8s
else
cd $module
fi
cd $module
# Remove slash from module name
# (pseudo/k8s becomes pseudok8s)
module=$(echo $module | sed 's|/||')
configFile=$(mktemp) configFile=$(mktemp)
cat <<EOF >$configFile cat <<EOF >$configFile
@@ -69,7 +81,7 @@ builds:
goarch: goarch:
- amd64 - amd64
archives: archives:
- name_template: "${module}_${tSemver}_{{ .Os }}_{{ .Arch }}" - name_template: "${module}_${semVer}_{{ .Os }}_{{ .Arch }}"
EOF EOF
cat $configFile cat $configFile

View File

@@ -26,8 +26,6 @@
# #
# releasing/cloudbuild_${module}.yaml # releasing/cloudbuild_${module}.yaml
# #
# where module is one of kustomize, pluginator or api.
#
# Inside this yaml file is a reference to the script # Inside this yaml file is a reference to the script
# #
# releasing/cloudbuild.sh # releasing/cloudbuild.sh