Skip to content

Commit fea9309

Browse files
committed
Add mise.toml for tool version management
Use mise.toml as single source of truth for tool versions in both local development and CI. This replaces manual version env vars and installation scripts. Changes: - Add mise.toml with all tool versions - Update CircleCI to install tools via mise - Remove redundant manual installation scripts - Simplify PATH configuration Closes #1634
1 parent 861ec5b commit fea9309

File tree

2 files changed

+39
-92
lines changed

2 files changed

+39
-92
lines changed

.circleci/config.yml

Lines changed: 29 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,13 @@ env: &env
44
MODULE_CI_VERSION: v0.46.0
55
MODULE_GCP_CI_VERSION: v0.1.1
66
MODULE_CI_CIRCLECI_HELPER_VERSION: v0.56.0
7-
TERRAFORM_VERSION: 1.5.7
8-
TOFU_VERSION: 1.8.0
9-
PACKER_VERSION: 1.10.0
10-
TERRAGRUNT_VERSION: v0.80.4
11-
TERRAGRUNT_TEST_VERSION: v0.93.10 # Version used for terragrunt module tests
12-
OPA_VERSION: v1.1.0
13-
GO_VERSION: 1.24.0
7+
# Tool versions are managed in mise.toml - only exceptions listed here
8+
TERRAGRUNT_TEST_VERSION: v0.93.10 # Version used for terragrunt module tests (overrides mise.toml)
149
GO111MODULE: auto
15-
K8S_VERSION: v1.20.0 # Same as EKS
16-
MINIKUBE_VERSION: v1.22.0
17-
HELM_VERSION: v3.13.1
1810
KUBECONFIG: /home/circleci/.kube/config
1911
BIN_BUILD_PARALLELISM: 3
20-
MISE_VERSION: v2024.4.0
21-
# Mise ASDF defaults to using main.tf to determine the terraform version to use, so we need to
22-
# override this to use the .terraform-version file instead.
23-
ASDF_HASHICORP_TERRAFORM_VERSION_FILE: .terraform-version
12+
MISE_VERSION: 2024.12.0
13+
MISE_YES: 1
2414

2515
defaults: &defaults
2616
machine:
@@ -32,16 +22,10 @@ setup_minikube: &setup_minikube
3222
command: |
3323
sudo apt update -y
3424
sudo apt install -y conntrack
35-
setup-minikube --k8s-version "$K8S_VERSION" --minikube-version "$MINIKUBE_VERSION"
36-
37-
install_helm: &install_helm
38-
name: install helm
39-
command: |
40-
# install helm
41-
curl -Lo helm.tar.gz https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz
42-
tar -xvf helm.tar.gz
43-
chmod +x linux-amd64/helm
44-
sudo mv linux-amd64/helm /usr/local/bin/
25+
# Get minikube version from mise
26+
MINIKUBE_VERSION=$(mise current asdf:alvarobp/asdf-minikube)
27+
K8S_VERSION=v$(mise current kubectl)
28+
setup-minikube --k8s-version "$K8S_VERSION" --minikube-version "v$MINIKUBE_VERSION"
4529
4630
install_gruntwork_utils: &install_gruntwork_utils
4731
name: install gruntwork utils
@@ -50,36 +34,21 @@ install_gruntwork_utils: &install_gruntwork_utils
5034
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_CIRCLECI_HELPER_VERSION}"
5135
gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
5236
gruntwork-install --module-name "gcp-helpers" --repo "https://github.com/gruntwork-io/terraform-google-ci" --tag "${MODULE_GCP_CI_VERSION}"
53-
configure-environment-for-gruntwork-module \
54-
--mise-version ${MISE_VERSION} \
55-
--terraform-version ${TERRAFORM_VERSION} \
56-
--terragrunt-version ${TERRAGRUNT_VERSION} \
57-
--packer-version ${PACKER_VERSION} \
58-
--go-version NONE
59-
60-
# Install OPA
61-
echo "Installing OPA version ${OPA_VERSION}"
62-
curl -sLO "https://github.com/open-policy-agent/opa/releases/download/${OPA_VERSION}/opa_linux_amd64_static"
63-
chmod +x ./opa_linux_amd64_static
64-
sudo mv ./opa_linux_amd64_static /usr/local/bin/opa
65-
66-
# Temporary fix for installing go - remove when we can update gruntwork-module-circleci-helpers to version with fix
67-
echo "Installing Go version $version"
68-
curl -O --silent --location --fail --show-error "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz"
69-
sudo rm -rf /usr/local/go
70-
sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
71-
sudo ln -s /usr/local/go/bin/go /usr/bin/go
72-
echo "The installed version of Go is now $(go version)"
73-
74-
install_tofu: &install_tofu
75-
name: Install OpenTofu
76-
command: |
77-
curl -L "https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_amd64.zip" -o tofu.zip
78-
unzip -o tofu.zip
79-
sudo install -m 0755 tofu /usr/local/bin/tofu
80-
rm -rf tofu
81-
rm -rf tofu.zip
82-
tofu --version
37+
38+
# Install mise and all tools from mise.toml
39+
curl https://mise.run | sh
40+
export PATH="$HOME/.local/bin:$PATH"
41+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $BASH_ENV
42+
echo 'eval "$($HOME/.local/bin/mise activate bash)"' >> $BASH_ENV
43+
mise trust
44+
mise install
45+
46+
# Symlink tools to /usr/local/bin for pre-commit hooks
47+
sudo ln -sf $(mise which go) /usr/local/bin/go
48+
sudo ln -sf $(mise which terraform) /usr/local/bin/terraform
49+
50+
echo "Installed tools:"
51+
mise ls
8352
8453
install_terragrunt_latest: &install_terragrunt_latest
8554
name: Install Terragrunt (latest test version)
@@ -139,9 +108,8 @@ jobs:
139108
paths:
140109
- $HOME/go/src/
141110

142-
# The weird way you have to set PATH in Circle 2.0
143-
- run: |
144-
echo 'export PATH=$HOME/.local/bin:$HOME/go/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
111+
# Add Go bin to PATH for go install tools
112+
- run: echo 'export PATH=$HOME/go/bin:$PATH' >> $BASH_ENV
145113

146114
# Run pre-commit hooks and fail the build if any hook finds required changes.
147115
- run:
@@ -199,10 +167,6 @@ jobs:
199167
- run:
200168
<<: *install_docker_buildx
201169

202-
# The weird way you have to set PATH in Circle 2.0
203-
- run: |
204-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
205-
206170
# Run the tests. Note that we set the "-p 1" flag to tell Go to run tests in each package sequentially. Without
207171
# this, Go buffers all log output until all packages are done, which with slower running tests can cause CircleCI
208172
# to kill the build after more than 10 minutes without log output.
@@ -239,14 +203,11 @@ jobs:
239203
<<: *install_gruntwork_utils
240204
- run:
241205
<<: *install_docker_buildx
242-
- run:
243-
<<: *install_tofu
244206

245-
# The weird way you have to set PATH in Circle 2.0
207+
# Use tofu instead of terraform for this test
246208
- run: |
247-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
248-
# remove terraform binary so tofu will be used
249209
sudo rm -f $(which terraform)
210+
sudo ln -s $(mise which tofu) /usr/local/bin/terraform
250211
251212
# Run the tests. Note that we set the "-p 1" flag to tell Go to run tests in each package sequentially. Without
252213
# this, Go buffers all log output until all packages are done, which with slower running tests can cause CircleCI
@@ -287,10 +248,6 @@ jobs:
287248
- run:
288249
<<: *install_gruntwork_utils
289250

290-
# The weird way you have to set PATH in Circle 2.0
291-
- run: |
292-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
293-
294251
- run:
295252
<<: *configure_environment_for_gcp
296253

@@ -324,10 +281,6 @@ jobs:
324281
- run:
325282
<<: *install_gruntwork_utils
326283

327-
# The weird way you have to set PATH in Circle 2.0
328-
- run: |
329-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
330-
331284
- run:
332285
<<: *setup_minikube
333286

@@ -363,16 +316,9 @@ jobs:
363316
- run:
364317
<<: *install_gruntwork_utils
365318

366-
# The weird way you have to set PATH in Circle 2.0
367-
- run: |
368-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
369-
370319
- run:
371320
<<: *setup_minikube
372321

373-
- run:
374-
<<: *install_helm
375-
376322
# Run the Helm tests. These tests are run because the helm build tag is included, and we explicitly
377323
# select the helm tests
378324
- run:
@@ -409,10 +355,6 @@ jobs:
409355
- run:
410356
<<: *install_docker_buildx
411357

412-
# The weird way you have to set PATH in Circle 2.0
413-
- run: |
414-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
415-
416358
# Run the terragrunt-specific tests. These tests specifically target the terragrunt module
417359
# and require terragrunt binary to be available (which is installed via install_gruntwork_utils)
418360
- run:
@@ -442,20 +384,15 @@ jobs:
442384

443385
- run:
444386
<<: *install_gruntwork_utils
445-
- run:
446-
<<: *install_tofu
447387
- run:
448388
<<: *install_terragrunt_latest
449389
- run:
450390
<<: *install_docker_buildx
451391

452-
# The weird way you have to set PATH in Circle 2.0
392+
# Use tofu instead of terraform for this test
453393
- run: |
454-
echo 'export PATH=$HOME/.local/bin:$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
455-
# Remove terraform binary so tofu will be used by terragrunt
456394
sudo rm -f $(which terraform)
457-
# Verify tofu is available
458-
which tofu
395+
sudo ln -s $(mise which tofu) /usr/local/bin/terraform
459396
tofu --version
460397
461398
# Run the terragrunt-specific tests with tofu as the backend

mise.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[tools]
2+
go = "1.24.0"
3+
terraform = "1.5.7"
4+
opentofu = "1.8.0"
5+
packer = "1.10.0"
6+
terragrunt = "0.80.4"
7+
opa = "1.1.0"
8+
helm = "3.13.1"
9+
kubectl = "1.20.0"
10+
"asdf:alvarobp/asdf-minikube" = "1.22.0"

0 commit comments

Comments
 (0)