github.com/grafana/synthetic-monitoring-agent@v0.64.2/scripts/generate-tags (about)

     1  #!/bin/sh
     2  
     3  set -e
     4  set -u
     5  
     6  # If an optional suffix is provided, append it to all the tags as `-suffix`.
     7  # Note that this breaks the semver format, because appending -foobar means it's
     8  # a pre-release version, not a "flavor" as some people claim. The more
     9  # appropriate way to express this would be to use `+suffix`, but we'll defer
    10  # that until we have fixed the different places where this might be used.
    11  suffix=${1:+-}${1:-}
    12  
    13  rootdir=$(git rev-parse --show-toplevel)
    14  version=$("${rootdir}/scripts/version")
    15  
    16  version_base=$(echo "${version}" | cut -d- -f1)
    17  version_seq=$(echo "${version}" | cut -d- -f2)
    18  
    19  printf "%s," "latest${suffix}"
    20  printf "%s" "${version}${suffix}"
    21  if [ "${version_seq}" = "0" ]; then
    22    # Strip the additional -0-* suffix to generate a additional tag that looks like vX.Y.Z
    23    printf ",%s" "${version_base}${suffix}"
    24  fi