Skip to content

Commit

Permalink
Merge pull request #750 from feiskyer/cherry007
Browse files Browse the repository at this point in the history
release-0.7: cherry-pick of #749
  • Loading branch information
feiskyer authored Aug 12, 2021
2 parents 84cec4f + e71123e commit cec351f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ timeout: 1200s
options:
substitution_option: ALLOW_LOOSE
steps:
- name: "gcr.io/k8s-testimages/gcb-docker-gcloud:v20200713-e9b3d9d"
- name: "gcr.io/k8s-testimages/gcb-docker-gcloud:v20210722-085d930"
entrypoint: make
env:
- TAG=${_GIT_TAG}
- PULL_BASE_REF=${_PULL_BASE_REF}
- PROJECT=${_STAGING_PROJECT}
- ENABLE_GIT_COMMAND=true
- ENABLE_GIT_COMMAND=false
- DOCKER_CLI_EXPERIMENTAL=enabled
- DOCKER_BUILDKIT=1
args:
Expand Down
11 changes: 11 additions & 0 deletions hack/pkg-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,25 @@ cd $(dirname "${BASH_SOURCE}")/..
if [ "${ENABLE_GIT_COMMAND}" = true ]; then
GIT_VERSION=$(git describe --tags --always --abbrev=9 || echo)
GIT_COMMIT=$(git rev-parse HEAD)
version_regex="^v(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)-([a-zA-Z0-9-]+)?$"
[[ "${GIT_VERSION}" =~ ${version_regex} ]] && {
# shellcheck disable=SC2034
VERSION_MAJOR="${BASH_REMATCH[1]}"
# shellcheck disable=SC2034
VERSION_MINOR="${BASH_REMATCH[2]}+"
}
else
GIT_VERSION="latest"
GIT_COMMIT="latest"
VERSION_MAJOR="latest"
VERSION_MINOR="latest"
fi

VERSION_PKG=sigs.k8s.io/cloud-provider-azure/pkg/version
LDFLAGS="-s -w"
LDFLAGS="$LDFLAGS -X $VERSION_PKG.gitVersion=${GIT_VERSION}"
LDFLAGS="$LDFLAGS -X $VERSION_PKG.gitCommit=${GIT_COMMIT}"
LDFLAGS="$LDFLAGS -X $VERSION_PKG.gitMajor=${VERSION_MAJOR}"
LDFLAGS="$LDFLAGS -X $VERSION_PKG.gitMinor=${VERSION_MINOR}"
LDFLAGS="$LDFLAGS -X $VERSION_PKG.buildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
echo -ldflags \'$LDFLAGS\'

0 comments on commit cec351f

Please sign in to comment.