Skip to content

Commit ea20454

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 ea20454

File tree

2 files changed

+36
-93
lines changed

2 files changed

+36
-93
lines changed

.circleci/config.yml

Lines changed: 25 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,14 @@ 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
14+
MISE_EXPERIMENTAL: 1
2415

2516
defaults: &defaults
2617
machine:
@@ -32,16 +23,10 @@ setup_minikube: &setup_minikube
3223
command: |
3324
sudo apt update -y
3425
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/
26+
# Get minikube version from mise
27+
MINIKUBE_VERSION=$(mise current asdf:alvarobp/asdf-minikube)
28+
K8S_VERSION=v$(mise current kubectl)
29+
setup-minikube --k8s-version "$K8S_VERSION" --minikube-version "v$MINIKUBE_VERSION"
4530
4631
install_gruntwork_utils: &install_gruntwork_utils
4732
name: install gruntwork utils
@@ -50,36 +35,16 @@ install_gruntwork_utils: &install_gruntwork_utils
5035
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_CIRCLECI_HELPER_VERSION}"
5136
gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
5237
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
38+
39+
# Install mise and all tools from mise.toml
40+
curl https://mise.run | sh
41+
export PATH="$HOME/.local/bin:$PATH"
42+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $BASH_ENV
43+
echo 'eval "$($HOME/.local/bin/mise activate bash)"' >> $BASH_ENV
44+
mise trust
45+
mise install
46+
echo "Installed tools:"
47+
mise ls
8348
8449
install_terragrunt_latest: &install_terragrunt_latest
8550
name: Install Terragrunt (latest test version)
@@ -139,15 +104,13 @@ jobs:
139104
paths:
140105
- $HOME/go/src/
141106

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
107+
# Add Go bin to PATH for go install tools
108+
- run: echo 'export PATH=$HOME/go/bin:$PATH' >> $BASH_ENV
145109

146110
# Run pre-commit hooks and fail the build if any hook finds required changes.
147111
- run:
148112
name: run precommit
149113
command: |
150-
go install golang.org/x/tools/cmd/goimports@latest
151114
# Install the latest minor version for v2
152115
pip install pre-commit~=2.9
153116
pre-commit install
@@ -199,10 +162,6 @@ jobs:
199162
- run:
200163
<<: *install_docker_buildx
201164

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-
206165
# Run the tests. Note that we set the "-p 1" flag to tell Go to run tests in each package sequentially. Without
207166
# this, Go buffers all log output until all packages are done, which with slower running tests can cause CircleCI
208167
# to kill the build after more than 10 minutes without log output.
@@ -239,14 +198,11 @@ jobs:
239198
<<: *install_gruntwork_utils
240199
- run:
241200
<<: *install_docker_buildx
242-
- run:
243-
<<: *install_tofu
244201

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

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-
294246
- run:
295247
<<: *configure_environment_for_gcp
296248

@@ -324,10 +276,6 @@ jobs:
324276
- run:
325277
<<: *install_gruntwork_utils
326278

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-
331279
- run:
332280
<<: *setup_minikube
333281

@@ -363,16 +311,9 @@ jobs:
363311
- run:
364312
<<: *install_gruntwork_utils
365313

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-
370314
- run:
371315
<<: *setup_minikube
372316

373-
- run:
374-
<<: *install_helm
375-
376317
# Run the Helm tests. These tests are run because the helm build tag is included, and we explicitly
377318
# select the helm tests
378319
- run:
@@ -409,10 +350,6 @@ jobs:
409350
- run:
410351
<<: *install_docker_buildx
411352

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-
416353
# Run the terragrunt-specific tests. These tests specifically target the terragrunt module
417354
# and require terragrunt binary to be available (which is installed via install_gruntwork_utils)
418355
- run:
@@ -442,20 +379,15 @@ jobs:
442379

443380
- run:
444381
<<: *install_gruntwork_utils
445-
- run:
446-
<<: *install_tofu
447382
- run:
448383
<<: *install_terragrunt_latest
449384
- run:
450385
<<: *install_docker_buildx
451386

452-
# The weird way you have to set PATH in Circle 2.0
387+
# Use tofu instead of terraform for this test
453388
- 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
456389
sudo rm -f $(which terraform)
457-
# Verify tofu is available
458-
which tofu
390+
sudo ln -s $(mise which tofu) /usr/local/bin/terraform
459391
tofu --version
460392
461393
# Run the terragrunt-specific tests with tofu as the backend

mise.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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"
11+
"go:golang.org/x/tools/cmd/goimports" = "latest"

0 commit comments

Comments
 (0)