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
function setSemVer {
# Check the tag for consistency with module name.
# The following assumes git tags formatted like # The following assumes git tags formatted like
# "api/v1.2.3" and splits on the slash. # "api/v1.2.3" and splits on the slash.
# Goreleaser doesn't know what to do with this # Goreleaser doesn't know what to do with this
# tag format, and fails when creating an archive # tag format, and fails when creating an archive
# with a / in the name. # with a / in the name.
fullTag=$(git describe) local fullTag=$(git describe)
export tModule=${fullTag%/*} local tModule=${fullTag%/*}
export tSemver=${fullTag#*/} semVer=${fullTag#*/}
# 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 "tModule=$tModule"
echo "tSemver=$tSemver" echo "semVer=$semVer"
if [ "$module" != "$tModule" ]; then 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
}
setSemVer
if [ "$module" == "pseudok8s" ]; then
cd pseudo/k8s
else
cd $module cd $module
fi
# 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