forked from hswaw/hscloud
Serge Bazanski
97b5cd7b58
This is a mega-change, but attempting to split this up further is probably not worth the effort. Summary: 1. Bump up bazel, rules_go, and others. 2. Switch to new go target naming (bye bye go_default_library) 3. Move go deps to go.mod/go.sum, use make gazelle generate from that 4. Bump up Python deps a bit And also whatever was required to actually get things to work - loads of small useless changes. Tested to work on NixOS and Ubuntu 20.04: $ bazel build //... $ bazel test //... Change-Id: I8364bdaa1406b9ae4d0385a6b607f3e7989f98a9 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1583 Reviewed-by: q3k <q3k@hackerspace.pl>
43 lines
1.5 KiB
Bash
Executable file
43 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# This script will be run by bazel when the build process starts to
|
|
# generate key-value information that represents the status of the
|
|
# workspace. The output should be like
|
|
#
|
|
# KEY1 VALUE1
|
|
# KEY2 VALUE2
|
|
#
|
|
# If the script exits with non-zero code, it's considered as a failure
|
|
# and the output will be discarded.
|
|
|
|
function rev() {
|
|
cd $1; git describe --always --match "v[0-9].*" --dirty
|
|
}
|
|
|
|
# Get Kubernetes version by doing an ugly grep. This returns something line 'v1.19.3'.
|
|
function kube_ver() {
|
|
cd $1
|
|
grep -A 10 io_k8s_kubernetes third_party/go/repositories.bzl | grep version | head -n 1 | cut -d '"' -f 2
|
|
}
|
|
|
|
KUBE_MAJOR=$(kube_ver . | sed -e 's,v,,' | cut -d . -f 1)
|
|
KUBE_MINOR=$(kube_ver . | sed -e 's,v,,' | cut -d . -f 2)
|
|
KUBE_PATCH=$(kube_ver . | sed -e 's,v,,' | cut -d . -f 3)
|
|
|
|
echo STABLE_BUILD_GERRIT-OAUTH-PROVIDER_LABEL $(rev .)
|
|
echo STABLE_BUILD_OWNERS_LABEL $(rev .)
|
|
echo STABLE_GIT_COMMIT $(git rev-parse HEAD)
|
|
echo STABLE_GIT_VERSION $(rev .)
|
|
echo STABLE_BUILDER $(id -un)@$(hostname -f):$(pwd)
|
|
|
|
# Kubernetes compatibility - see //third_party/go:kubernetes_version_def.bzl.
|
|
echo STABLE_KUBERNETES_buildDate $(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
echo STABLE_KUBERNETES_gitCommit $(git rev-parse HEAD)
|
|
echo STABLE_KUBERNETES_gitMajor $KUBE_MAJOR
|
|
echo STABLE_KUBERNETES_gitMinor $KUBE_MINOR
|
|
if git_status=$(git status --porcelain 2>/dev/null) && [[ -z ${git_status} ]]; then
|
|
echo STABLE_KUBERNETES_gitTreeState clean
|
|
else
|
|
echo STABLE_KUBERNETES_gitTreeState dirty
|
|
fi
|
|
echo STABLE_KUBERNETES_gitVersion $(kube_ver .)-hscloud-$(rev .)
|