Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.

Commit 9460bc9

Browse files
committed
handle tag-only commits with no hash in version
When doing the release process, we generate version numbers that have a version tag but don't have a hash. The IDK test against the expected hash doesn't work in this context. Let's check for an expected tag first.
1 parent 0201649 commit 9460bc9

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.gitlab/.gitlab-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ run go tests idk race:
353353
- cd ./idk/
354354
- echo $PROJECT
355355
- echo $CI_COMMIT_REF_SLUG
356-
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all-race
356+
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all-race
357357
after_script:
358358
- cd ./idk/
359359
- make save-pilosa-logs
@@ -378,7 +378,7 @@ run go tests idk shard transactional:
378378
- cd ./idk/
379379
- echo $PROJECT
380380
- echo $CI_COMMIT_REF_SLUG
381-
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all
381+
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all
382382
after_script:
383383
- cd ./idk/
384384
- make save-pilosa-logs
@@ -404,7 +404,7 @@ run go tests idk 533:
404404
- cd ./idk/
405405
- echo $PROJECT
406406
- echo $CI_COMMIT_REF_SLUG
407-
- CONFLUENT_VERSION=5.3.3 BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all
407+
- CONFLUENT_VERSION=5.3.3 BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all
408408
after_script:
409409
- cd ./idk/
410410
- make save-pilosa-logs
@@ -428,7 +428,7 @@ run go tests idk sasl:
428428
- cd ./idk/
429429
- echo $PROJECT
430430
- echo $CI_COMMIT_REF_SLUG
431-
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all-kafka-sasl
431+
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all-kafka-sasl
432432
after_script:
433433
- cd ./idk/
434434
- make save-pilosa-logs

idk/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ services:
121121
environment:
122122
IDK_DEFAULT_SHARD_TRANSACTIONAL: ${IDK_DEFAULT_SHARD_TRANSACTIONAL}
123123
IDK_FEATUREBASE_HASH: ${IDK_FEATUREBASE_HASH}
124+
IDK_FEATUREBASE_TAG: ${IDK_FEATUREBASE_TAG}
124125
volumes:
125126
- ./testenv/certs:/certs
126127
- ./docker-sasl/ssl_keys:/ssl_keys

idk/ingest_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ func TestFeaturebaseVersion(t *testing.T) {
8989
t.Fatalf("unmarshalling version: %v", err)
9090
}
9191
v := vh.Version
92+
expectedTag := os.Getenv("IDK_FEATUREBASE_TAG")
93+
if expectedTag != "" {
94+
// if a tag is set, we're in a tagged pipeline, and the version
95+
// should just be vX.Y or something similar, without a commit
96+
// hash.
97+
if v != expectedTag {
98+
t.Fatalf("version %s does not match expected tag %s", v, expectedTag)
99+
}
100+
t.Logf("featurebase version %q matches expectations", expectedTag)
101+
return
102+
}
103+
// no tag. we expect to always have a hash, and if there's a specific
104+
// expected hash, we verify it.
92105
expectedHash := os.Getenv("IDK_FEATUREBASE_HASH")
93106
if expectedHash == "" {
94107
t.Skipf("featurebase version: %s [no expected version]", v)

0 commit comments

Comments
 (0)