Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit 0b3db15

Browse files
author
Thulio Ferraz Assis
authored
fix: git tags on CI and improved dev targets (#88)
* fix: targets for CI and dev - On Travis, we use minikube with driver=none. - So the host docker is the one used by minikube. - So building images on the host is automatically available to kubernetes. - So we can deploy the chart without uploading anything. Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: tags not being fetched on CI Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: move git fetch logic to version.sh Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: env to force fetching of tags and unshallow When a repository is shallow-cloned, sometimes the tags are too old to trace back to a commit, making 'git describe --tags' fail. If VERSION_FORCE_TAG_FETCH environment variable is set, version.sh will fetch all the tags and unshallow the repository. This is useful for CI, where it shallow-cones the repository by default. Signed-off-by: Thulio Ferraz Assis <[email protected]>
1 parent 315d8c6 commit 0b3db15

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636
- TEST_PROVISION_TIMEOUT=5m
3737
- TEST_BIND_TIMEOUT=5m
3838
- TEST_ASSERT_TIMEOUT=2m
39+
# Forces the version.sh script to fetch tags and unshallow the git repository.
40+
- VERSION_FORCE_TAG_FETCH=true
3941
before_install:
4042
- sudo apt-get -qq -y install conntrack
4143
before_script:
@@ -46,6 +48,9 @@ jobs:
4648
stage: release
4749
services:
4850
- docker
51+
env:
52+
# Forces the version.sh script to fetch tags and unshallow the git repository.
53+
- VERSION_FORCE_TAG_FETCH=true
4954
before_script:
5055
- ci/install/release.sh
5156
script: ci/release.sh

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ log:
9393
create-cluster:
9494
./hack/create-cluster.sh
9595

96-
deploy: image-in-minikube charts
96+
deploy:
9797
IMAGE="$(IMAGE)" \
9898
TAG="$(TAG)" \
9999
IMAGE_PULL_POLICY="$(IMAGE_PULL_POLICY)" \
100100
OUTPUT_CHARTS_DIR="$(OUTPUT_CHARTS_DIR)" \
101101
./build/deploy.sh
102102

103+
deploy-dev: image-in-minikube charts deploy
104+
103105
release: clean release-images release-charts
104106

105107
release-images: image

build/version.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@
1616

1717
set -o errexit -o nounset -o pipefail
1818

19+
if [ -z "$(git tag --list)" ]; then
20+
if [ -n "${VERSION_FORCE_TAG_FETCH:-}" ]; then
21+
>&2 echo "fetching git tags"
22+
git fetch --tags --all 1> /dev/null 2> /dev/null
23+
>&2 echo "unshallowing git repository"
24+
git fetch --unshallow 1> /dev/null 2> /dev/null
25+
else
26+
>&2 echo "failed to fetch git tags"
27+
exit 1
28+
fi
29+
fi
30+
1931
git_tag=$(git describe --tags)
32+
2033
# This dirty check also takes into consideration new files not staged for
2134
# commit.
2235
git_dirty=$([[ -z "$(git status --short)" ]] || echo "-dirty")

ci/test_integration.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ set -o errexit -o nounset -o pipefail
1818

1919
VM_DRIVER=none sudo timeout 3m make create-cluster
2020
timeout 1m kubectl create namespace minibroker-tests
21-
timeout 10m make deploy
21+
timeout 10m make image
22+
timeout 1m make charts
23+
timeout 3m make deploy
2224
timeout 8m make test-integration

0 commit comments

Comments
 (0)