Skip to content

Commit 2f457e2

Browse files
authored
check latest tag (#17)
1 parent 1d68d67 commit 2f457e2

4 files changed

Lines changed: 39 additions & 5 deletions

File tree

.buildkite/check-latest-tag.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
cd "$(dirname "${BASH_SOURCE[0]}")"/..
6+
7+
get_latest() {
8+
git tag |
9+
# drop `v` prefix
10+
grep "^v" |
11+
cut -c2- |
12+
13+
# sort by semantic version
14+
sort -t "." -k1,1n -k2,2n -k3,3n |
15+
16+
# last
17+
tail -n 1 |
18+
19+
# drop newline
20+
tr -d '\n'
21+
}
22+
23+
latest="$(get_latest)"
24+
25+
git grep --line-number "# LATEST" examples >want.txt
26+
git grep --line-number "\"$latest\" # LATEST" examples >got.txt
27+
28+
if ! git diff --no-index --exit-code want.txt got.txt; then
29+
echo ""
30+
echo "❌ Detected old versions! Make sure that all versions \`version = \"...\" # LATEST\` match the latest git tag: $latest"
31+
exit 1
32+
fi

.buildkite/pipeline.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ steps:
77
command: .buildkite/shellcheck.sh
88
- label: ":terraform:"
99
command: .buildkite/terraform-validate.sh
10+
- label: ":lint-roller:"
11+
command: .buildkite/check-latest-tag.sh

examples/multiple-executors/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ locals {
66

77
module "networking" {
88
source = "sourcegraph/executors/aws//modules/networking"
9-
version = "0.0.21"
9+
version = "0.0.21" # LATEST
1010

1111
availability_zone = local.availability_zone
1212
}
1313

1414
module "docker-mirror" {
1515
source = "sourcegraph/executors/aws//modules/docker-mirror"
16-
version = "0.0.21"
16+
version = "0.0.21" # LATEST
1717

1818
vpc_id = module.networking.vpc_id
1919
subnet_id = module.networking.subnet_id
@@ -23,7 +23,7 @@ module "docker-mirror" {
2323

2424
module "executors-codeintel" {
2525
source = "sourcegraph/executors/aws//modules/executors"
26-
version = "0.0.21"
26+
version = "0.0.21" # LATEST
2727

2828
vpc_id = module.networking.vpc_id
2929
subnet_id = module.networking.subnet_id
@@ -38,7 +38,7 @@ module "executors-codeintel" {
3838

3939
module "executors-batches" {
4040
source = "sourcegraph/executors/aws//modules/executors"
41-
version = "0.0.21"
41+
version = "0.0.21" # LATEST
4242

4343
vpc_id = module.networking.vpc_id
4444
subnet_id = module.networking.subnet_id

examples/single-executor/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55

66
module "executors" {
77
source = "sourcegraph/executors/aws"
8-
version = "0.0.21"
8+
version = "0.0.21" # LATEST
99

1010
availability_zone = local.availability_zone
1111
executor_instance_tag = "codeintel-prod"

0 commit comments

Comments
 (0)