diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 440a9e7095..0000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2023 Terramate GmbH -# SPDX-License-Identifier: MPL-2.0 - -name: ci -on: [push] - -jobs: - checks: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: actions/setup-go@v4 - with: - go-version: '1.21' - - - name: Configure asdf and plugins needed - uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267 - - - name: checking go mod tidyness - run: terramate run --tags golang --changed -- make mod/check - - - name: linting code - run: terramate run --tags golang --changed -- make lint - - - name: checking license on source code - run: terramate run --tags golang --changed -- make license/check - - build_test: - name: Build and Test - runs-on: ${{ matrix.os }} - permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout - - strategy: - matrix: - os: ["ubuntu-20.04", "macos-12", "macos-13"] - go: ["1.21"] - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - - name: Configure asdf and plugins needed - uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267 - - - name: make generate - run: terramate generate - - - name: make test - run: terramate run --tags golang --changed -- make test - - - name: make build - run: terramate run --tags golang --changed -- make build - - - name: check cloud info - run: terramate run --tags golang --changed -- ./bin/terramate -vv experimental cloud info - - gh_integration_test: - name: GHA Integration Test - - runs-on: "ubuntu-20.04" - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version: '1.21' - - - name: Configure asdf and plugins needed - uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267 - - - name: make test/ci - run: terramate run --tags golang --changed -- make test/ci - - release_dry_run: - name: Release Dry Run - - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - fetch-depth: 0 - - uses: actions/setup-go@v5 - with: - go-version: '1.21' - - - name: Configure asdf and plugins needed - uses: asdf-vm/actions/install@83133f03f5693901c2296a8e622955087dc20267 - - - name: release dry run - run: terramate run --tags golang --changed -- make release/dry-run - - ci: - needs: - - checks - - build_test - - gh_integration_test - runs-on: ubuntu-20.04 - steps: - - uses: Kesin11/actions-timeline@v1 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..47c65767d8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,65 @@ +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + +name: Terramate Deployment +on: + push: + branches: + - main + +jobs: + deploy: + name: Run all tests and create a Terramate Cloud Deployment + + permissions: + id-token: write + contents: read + pull-requests: read + + runs-on: "ubuntu-20.04" + + steps: + ### Check out the code + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + ### Install tooling + + - name: Install Terramate + uses: terramate-io/terramate-action@v1 + + - name: build + run: make build + + - name: check cloud info + run: ./bin/terramate run --tags golang --no-recursive -- ./bin/terramate cloud info || true + env: + TMC_API_HOST: api.stg.terramate.io + + ### Check for changed stacks + + - name: List changed stacks + id: list + run: terramate list --changed + + - name: checking go mod tidyness + if: steps.list.outputs.stdout + run: make mod/check + + - name: linting code + if: steps.list.outputs.stdout + run: make lint + + - name: checking license on source code + if: steps.list.outputs.stdout + run: make license/check + + - name: check and test all + if: steps.list.outputs.stdout + run: ./bin/terramate script run --parallel=5 --changed --tags=golang -- test deploy + env: + TMC_API_HOST: api.stg.terramate.io + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000000..4fd9e90904 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,178 @@ +# Copyright 2023 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + +name: preview + +on: + pull_request: + branches: + - main + +jobs: + preview: + name: Changed Terramate stacks + runs-on: ${{ matrix.os }} + + permissions: + id-token: write + contents: read + pull-requests: write + + strategy: + matrix: + os: ["ubuntu-20.04", "macos-12", "macos-13"] + go: ["1.22"] + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + ### Create Pull Request comment + + - name: Prepare pull request preview comment + if: github.event.pull_request + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: preview + message: | + ## Preview of Project changes in ${{ github.event.pull_request.head.sha }} + + :warning: preview is being created... please stand by! + + ### Install tooling + + - name: Install Terramate + uses: terramate-io/terramate-action@i4k-fix-macos + + # TODO(i4k): remove this once v0.5.0 is released. + - name: build Terramate + shell: bash + run: make build + + - name: Check Terramate formatting + shell: bash + run: terramate fmt --check + + - name: List changed stacks + shell: bash + id: list + run: terramate list --changed + + - name: checking go mod tidyness + shell: bash + if: steps.list.outputs.stdout && matrix.os == 'ubuntu-20.04' + run: make mod/check + + - name: linting code + shell: bash + if: steps.list.outputs.stdout && matrix.os == 'ubuntu-20.04' + run: make lint + + - name: checking license on source code + shell: bash + if: steps.list.outputs.stdout && matrix.os == 'ubuntu-20.04' + run: make license/check + + ### Run the terramate preview script + + - name: check cloud info + shell: bash + if: steps.list.outputs.stdout + run: terramate run --tags golang --no-recursive -- terramate cloud info || true + env: + TMC_API_HOST: api.stg.terramate.io + + - name: Golang test preview + shell: bash + if: steps.list.outputs.stdout + run: | + echo >preview_url.txt "https://cloud.stg.terramate.io/o/test/review-requests" + ./bin/terramate script run --parallel=10 --tags golang --changed -- test preview + env: + TMC_API_HOST: api.stg.terramate.io + GITHUB_TOKEN: ${{ github.token }} + + ### Update Pull Request comment + + - name: Generate preview details + shell: bash + if: steps.list.outputs.stdout + id: comment + run: | + echo >>pr-comment.txt "## Preview of Terramate changes in ${{ github.event.pull_request.head.sha }}" + echo >>pr-comment.txt + echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud]($(cat preview_url.txt))" + echo >>pr-comment.txt + echo >>pr-comment.txt "### Changed Stacks" + echo >>pr-comment.txt + echo >>pr-comment.txt '```bash' + echo >>pr-comment.txt "${{ steps.list.outputs.stdout }}" + echo >>pr-comment.txt '```' + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Generate preview when no stacks changed + shell: bash + if: success() && !steps.list.outputs.stdout + run: | + echo >>pr-comment.txt "## Preview of Terramate changes in ${{ github.event.pull_request.head.sha }}" + echo >>pr-comment.txt + echo >>pr-comment.txt "### Changed Stacks" + echo >>pr-comment.txt + echo >>pr-comment.txt 'No changed stacks, no detailed preview will be generated.' + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Generate preview when things failed + shell: bash + if: failure() + run: | + echo >>pr-comment.txt "## Preview of Terraform changes in ${{ github.event.pull_request.head.sha }}" + echo >>pr-comment.txt + echo >>pr-comment.txt "[:mag: View Details on Terramate Cloud]($(cat preview_url.txt))" + echo >>pr-comment.txt + echo >>pr-comment.txt "### Changed Stacks" + echo >>pr-comment.txt + echo >>pr-comment.txt '```bash' + echo >>pr-comment.txt "${{ steps.list.outputs.stdout }}" + echo >>pr-comment.txt '```' + echo >>pr-comment.txt ':boom: Generating preview failed. Please see details in Actions output.' + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Publish generated preview as GitHub commnent + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: preview + path: pr-comment.txt + + release_dry_run: + name: Release Dry Run + + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + fetch-depth: 0 + + - uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: release dry run + run: make release/dry-run + + required_checks: + needs: + - preview + runs-on: ubuntu-20.04 + steps: + - uses: Kesin11/actions-timeline@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f37ed529df..963e3d0dec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: '1.21' diff --git a/.tool-versions b/.tool-versions index f95c824bf8..586a0db42c 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -terramate 0.4.0 +terramate 0.5.0-rc4 diff --git a/cloud/deployment/stack.tm.hcl b/cloud/deployment/stack.tm.hcl new file mode 100644 index 0000000000..1450ca4637 --- /dev/null +++ b/cloud/deployment/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "deployment" + description = "deployment" + tags = ["golang"] + id = "3705120e-4f6f-42a6-9c45-5a1ff31110da" +} diff --git a/cloud/drift/stack.tm.hcl b/cloud/drift/stack.tm.hcl new file mode 100644 index 0000000000..2ab05e1873 --- /dev/null +++ b/cloud/drift/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "drift" + description = "drift" + tags = ["golang"] + id = "8e7c2d56-0a76-42b7-b6c6-a9e85ba3f17e" +} diff --git a/cloud/log_syncer_test.go b/cloud/log_syncer_test.go index eccd7e8add..82841abe2c 100644 --- a/cloud/log_syncer_test.go +++ b/cloud/log_syncer_test.go @@ -313,7 +313,7 @@ func TestCloudLogSyncer(t *testing.T) { {channel: cloud.StdoutLogChannel, data: []byte("first write\n")}, { // make this lower than tc.idleDuration to fail the test. - idle: 300 * time.Millisecond, + idle: 500 * time.Millisecond, channel: cloud.StdoutLogChannel, data: []byte("write after idle time\n"), }, diff --git a/cloud/stack.tm.hcl b/cloud/stack.tm.hcl new file mode 100644 index 0000000000..7d92e232da --- /dev/null +++ b/cloud/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cloud" + description = "cloud" + tags = ["golang"] + id = "22a16004-771d-433f-9732-be34e6f3ffbb" +} diff --git a/cloud/stack/stack.tm.hcl b/cloud/stack/stack.tm.hcl new file mode 100644 index 0000000000..293a0f431e --- /dev/null +++ b/cloud/stack/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "stack" + description = "stack" + tags = ["golang"] + id = "8b514d12-9d03-4fbd-8c1b-4c43207abc0f" +} diff --git a/cloud/testserver/cloudstore/stack.tm.hcl b/cloud/testserver/cloudstore/stack.tm.hcl new file mode 100644 index 0000000000..f91fb30ce4 --- /dev/null +++ b/cloud/testserver/cloudstore/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cloudstore" + description = "cloudstore" + tags = ["golang"] + id = "bd761edc-3458-4388-b29f-a109c6359bac" +} diff --git a/cloud/testserver/cmd/testserver/stack.tm.hcl b/cloud/testserver/cmd/testserver/stack.tm.hcl new file mode 100644 index 0000000000..455ab559e7 --- /dev/null +++ b/cloud/testserver/cmd/testserver/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "testserver" + description = "testserver" + tags = ["golang"] + id = "c8fa9f2e-fc1f-470f-b78a-80f22abe9cb9" +} diff --git a/cloud/testserver/stack.tm.hcl b/cloud/testserver/stack.tm.hcl new file mode 100644 index 0000000000..d579fffb20 --- /dev/null +++ b/cloud/testserver/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "testserver" + description = "testserver" + tags = ["golang"] + id = "8abcb189-5731-4024-ab62-022b7d3d6a45" +} diff --git a/cmd/terramate-ls/stack.tm.hcl b/cmd/terramate-ls/stack.tm.hcl new file mode 100644 index 0000000000..1ba7c2bba9 --- /dev/null +++ b/cmd/terramate-ls/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "terramate-ls" + description = "terramate-ls" + tags = ["golang"] + id = "d65b5013-40fb-4af0-a8bb-d73ed29de250" +} diff --git a/cmd/terramate/cli/cliconfig/stack.tm.hcl b/cmd/terramate/cli/cliconfig/stack.tm.hcl new file mode 100644 index 0000000000..cfe29e035a --- /dev/null +++ b/cmd/terramate/cli/cliconfig/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cliconfig" + description = "cliconfig" + tags = ["golang"] + id = "b9c060f8-758c-4f96-ab2c-1ad2cc818790" +} diff --git a/cmd/terramate/cli/clitest/stack.tm.hcl b/cmd/terramate/cli/clitest/stack.tm.hcl new file mode 100644 index 0000000000..f7f2e99ba9 --- /dev/null +++ b/cmd/terramate/cli/clitest/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "clitest" + description = "clitest" + tags = ["golang"] + id = "2e323174-46b3-44a0-8237-c47871f6d33a" +} diff --git a/cmd/terramate/cli/github/stack.tm.hcl b/cmd/terramate/cli/github/stack.tm.hcl new file mode 100644 index 0000000000..1179042160 --- /dev/null +++ b/cmd/terramate/cli/github/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "github" + description = "github" + tags = ["golang"] + id = "3f5750a7-e88b-4305-846a-36a390b4d4ae" +} diff --git a/cmd/terramate/cli/out/stack.tm.hcl b/cmd/terramate/cli/out/stack.tm.hcl new file mode 100644 index 0000000000..b42760f759 --- /dev/null +++ b/cmd/terramate/cli/out/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "out" + description = "out" + tags = ["golang"] + id = "91e696bb-6b73-4d23-a144-8bf2c09e83cd" +} diff --git a/cmd/terramate/cli/stack.tm.hcl b/cmd/terramate/cli/stack.tm.hcl new file mode 100644 index 0000000000..a9af294070 --- /dev/null +++ b/cmd/terramate/cli/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cli" + description = "cli" + tags = ["golang"] + id = "1de68a08-1a7c-45b8-9712-48cce89df9a2" +} diff --git a/cmd/terramate/e2etests/cloud/cloud_status_test.go b/cmd/terramate/e2etests/cloud/cloud_status_test.go index f4c5b15255..d7786c4ea8 100644 --- a/cmd/terramate/e2etests/cloud/cloud_status_test.go +++ b/cmd/terramate/e2etests/cloud/cloud_status_test.go @@ -5,7 +5,6 @@ package cloud_test import ( "fmt" - "os" "path/filepath" "sort" "strconv" @@ -387,7 +386,7 @@ func TestCloudStatus(t *testing.T) { _, err := store.UpsertStack(org.UUID, st) assert.NoError(t, err) } - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr, "CI=") if tc.perPage != 0 { env = append(env, "TMC_API_PAGESIZE="+strconv.Itoa(tc.perPage)) diff --git a/cmd/terramate/e2etests/cloud/exp_trigger_cloud_test.go b/cmd/terramate/e2etests/cloud/exp_trigger_cloud_test.go index 08e30b4fe8..9a60bc47d8 100644 --- a/cmd/terramate/e2etests/cloud/exp_trigger_cloud_test.go +++ b/cmd/terramate/e2etests/cloud/exp_trigger_cloud_test.go @@ -5,7 +5,6 @@ package cloud_test import ( "fmt" - "os" "path/filepath" "testing" @@ -60,7 +59,7 @@ func TestTriggerUnhealthyStacks(t *testing.T) { assert.NoError(t, err) git.SetRemoteURL("origin", fmt.Sprintf(`https://%s.git`, repository)) - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr, "CI=") cli := NewCLI(t, s.RootDir(), env...) AssertRunResult(t, cli.Run("experimental", "trigger", "--cloud-status=unhealthy"), RunExpected{ @@ -541,7 +540,7 @@ func TestCloudTriggerUnhealthy(t *testing.T) { _, err := store.UpsertStack(org.UUID, st) assert.NoError(t, err) } - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr, "CI=") cli := NewCLI(t, filepath.Join(s.RootDir(), tc.workingDir), env...) args := []string{"experimental", "trigger"} diff --git a/cmd/terramate/e2etests/cloud/generate-e2e-testserver.tm b/cmd/terramate/e2etests/cloud/generate-e2e-testserver.tm index 46918fa917..c068d39675 100644 --- a/cmd/terramate/e2etests/cloud/generate-e2e-testserver.tm +++ b/cmd/terramate/e2etests/cloud/generate-e2e-testserver.tm @@ -1,8 +1,12 @@ // Copyright 2023 Terramate GmbH // SPDX-License-Identifier: MPL-2.0 -generate_file "/cmd/terramate/e2etests/cloud/testdata/cloud.data.json" { - context = root +generate_file "testdata/cloud.data.json" { + stack_filter { + project_paths = [ + "/cmd/terramate/e2etests/cloud" + ] + } lets { well_known = { diff --git a/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/basic-drift/stack.tm.hcl b/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/basic-drift/stack.tm.hcl index 451e40faf1..975783369e 100644 --- a/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/basic-drift/stack.tm.hcl +++ b/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/basic-drift/stack.tm.hcl @@ -5,5 +5,5 @@ stack { name = "basic-drift" description = "basic-drift" id = "2530f1b3-2691-48dc-b418-e966f7e1441c" - after = ["../empty"] # only used for visualizing the graph. + tags = ["testdata"] } diff --git a/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/empty/stack.tm.hcl b/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/empty/stack.tm.hcl index be733071e5..6ac826272d 100644 --- a/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/empty/stack.tm.hcl +++ b/cmd/terramate/e2etests/cloud/interop/testdata/interop-stacks/empty/stack.tm.hcl @@ -5,5 +5,5 @@ stack { name = "empty" description = "empty" id = "04437b1f-27a9-4eab-8e63-1df968b76f6b" - before = ["/testdata/example-stack", "/testdata/testserver"] + tags = ["testdata"] } diff --git a/cmd/terramate/e2etests/cloud/run_cloud_config_test.go b/cmd/terramate/e2etests/cloud/run_cloud_config_test.go index 39eadad34c..914ae9867b 100644 --- a/cmd/terramate/e2etests/cloud/run_cloud_config_test.go +++ b/cmd/terramate/e2etests/cloud/run_cloud_config_test.go @@ -8,7 +8,6 @@ import ( "fmt" "net" "net/http" - "os" "testing" "time" @@ -166,7 +165,7 @@ func TestCloudConfig(t *testing.T) { } s.BuildTree(layout) s.Git().CommitAll("created stacks") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() for k, v := range tc.customEnv { env = append(env, fmt.Sprintf("%v=%v", k, v)) diff --git a/cmd/terramate/e2etests/cloud/run_cloud_deployment_test.go b/cmd/terramate/e2etests/cloud/run_cloud_deployment_test.go index c6e02e4445..11e6ddff90 100644 --- a/cmd/terramate/e2etests/cloud/run_cloud_deployment_test.go +++ b/cmd/terramate/e2etests/cloud/run_cloud_deployment_test.go @@ -392,7 +392,7 @@ func TestCLIRunWithCloudSyncDeployment(t *testing.T) { s.BuildTree(genIdsLayout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr) env = append(env, tc.env...) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) diff --git a/cmd/terramate/e2etests/cloud/run_cloud_drift_test.go b/cmd/terramate/e2etests/cloud/run_cloud_drift_test.go index b29e27df15..f08cea8635 100644 --- a/cmd/terramate/e2etests/cloud/run_cloud_drift_test.go +++ b/cmd/terramate/e2etests/cloud/run_cloud_drift_test.go @@ -518,7 +518,7 @@ func TestCLIRunWithCloudSyncDriftStatus(t *testing.T) { s.BuildTree(tc.layout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, tc.env...) env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) diff --git a/cmd/terramate/e2etests/cloud/run_cloud_signal_test.go b/cmd/terramate/e2etests/cloud/run_cloud_signal_test.go index 35fbef20ea..250a1eda7c 100644 --- a/cmd/terramate/e2etests/cloud/run_cloud_signal_test.go +++ b/cmd/terramate/e2etests/cloud/run_cloud_signal_test.go @@ -4,7 +4,6 @@ package cloud_test import ( - "os" "path/filepath" "strings" "testing" @@ -108,7 +107,7 @@ func TestCLIRunWithCloudSyncDeploymentWithSignals(t *testing.T) { s.BuildTree(genIdsLayout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) @@ -210,7 +209,7 @@ func TestCLIRunWithCloudSyncDriftStatusWithSignals(t *testing.T) { s.BuildTree(tc.layout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) diff --git a/cmd/terramate/e2etests/cloud/run_cloud_uimode_test.go b/cmd/terramate/e2etests/cloud/run_cloud_uimode_test.go index 8444018387..52d9f05841 100644 --- a/cmd/terramate/e2etests/cloud/run_cloud_uimode_test.go +++ b/cmd/terramate/e2etests/cloud/run_cloud_uimode_test.go @@ -9,7 +9,6 @@ import ( "fmt" "net" "net/http" - "os" "regexp" "testing" "time" @@ -1259,7 +1258,7 @@ func TestCloudSyncUIMode(t *testing.T) { if len(subcase.cmd) == 0 { t.Fatal("invalid testcase: cmd not set") } - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() if subcase.uimode == cli.AutomationMode { env = append(env, "CI=true") } diff --git a/cmd/terramate/e2etests/cloud/run_script_cloud_deployment_test.go b/cmd/terramate/e2etests/cloud/run_script_cloud_deployment_test.go index e57e5a86c2..97174e845d 100644 --- a/cmd/terramate/e2etests/cloud/run_script_cloud_deployment_test.go +++ b/cmd/terramate/e2etests/cloud/run_script_cloud_deployment_test.go @@ -5,7 +5,6 @@ package cloud_test import ( "fmt" - "os" "path/filepath" "strings" "testing" @@ -228,7 +227,7 @@ func TestCLIScriptRunWithCloudSyncDeployment(t *testing.T) { s.BuildTree(genLayout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) diff --git a/cmd/terramate/e2etests/cloud/run_script_cloud_drift_test.go b/cmd/terramate/e2etests/cloud/run_script_cloud_drift_test.go index 422c8a1df4..897be493a6 100644 --- a/cmd/terramate/e2etests/cloud/run_script_cloud_drift_test.go +++ b/cmd/terramate/e2etests/cloud/run_script_cloud_drift_test.go @@ -499,7 +499,7 @@ func TestScriptRunDriftStatus(t *testing.T) { s.BuildTree(tc.layout) s.Git().CommitAll("all stacks committed") - env := RemoveEnv(os.Environ(), "CI") + env := CleanEnv() env = append(env, tc.env...) env = append(env, "TMC_API_URL=http://"+addr) cli := NewCLI(t, filepath.Join(s.RootDir(), filepath.FromSlash(tc.workingDir)), env...) diff --git a/cmd/terramate/e2etests/cloud/stack.tm.hcl b/cmd/terramate/e2etests/cloud/stack.tm.hcl new file mode 100644 index 0000000000..4ef2b091e0 --- /dev/null +++ b/cmd/terramate/e2etests/cloud/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cloud" + description = "cloud" + tags = ["golang", "e2e"] + id = "669cf56e-1bbb-423f-8bd3-d4f4dd0c52e1" +} diff --git a/cmd/terramate/e2etests/cmd/helper/stack.tm.hcl b/cmd/terramate/e2etests/cmd/helper/stack.tm.hcl new file mode 100644 index 0000000000..8d0d08885c --- /dev/null +++ b/cmd/terramate/e2etests/cmd/helper/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "helper" + description = "helper" + tags = ["golang"] + id = "26a4dea4-3d62-4ad7-9ee6-d0b950f9987e" +} diff --git a/cmd/terramate/e2etests/core/stack.tm.hcl b/cmd/terramate/e2etests/core/stack.tm.hcl new file mode 100644 index 0000000000..f9ce0c0eb7 --- /dev/null +++ b/cmd/terramate/e2etests/core/stack.tm.hcl @@ -0,0 +1,10 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "core" + description = "core" + tags = ["e2e"] + id = "947bb1ba-8c6d-4e1e-a90f-a6735b86d33a" + wanted_by = ["/cloud"] +} diff --git a/cmd/terramate/e2etests/internal/runner/runner.go b/cmd/terramate/e2etests/internal/runner/runner.go index c3c4e76900..c673a4dde6 100644 --- a/cmd/terramate/e2etests/internal/runner/runner.go +++ b/cmd/terramate/e2etests/internal/runner/runner.go @@ -73,8 +73,7 @@ func NewCLI(t *testing.T, chdir string, env ...string) CLI { Chdir: chdir, } if len(env) == 0 { - // by default, it's assumed human mode - env = RemoveEnv(os.Environ(), "CI", "GITHUB_ACTIONS") + env = CleanEnv() } env = append(env, "CHECKPOINT_DISABLE=1") // custom cliconfig file @@ -119,6 +118,25 @@ func (tm *CLI) PrependToPath(dir string) { } } +// CleanEnv returns environment variables without Terramate specific ones. +func CleanEnv() []string { + env := os.Environ() + var cleanEnv []string + for _, e := range env { + if !strings.HasPrefix(e, "TM_") && !strings.HasPrefix(e, "TMC_") { + cleanEnv = append(cleanEnv, e) + } + } + return RemoveEnv( + cleanEnv, + "CI", + "CHECKPOINT_DISABLE", + "GITHUB_TOKEN", + "ACTIONS_ID_TOKEN_REQUEST_URL", + "ACTIONS_ID_TOKEN_REQUEST_TOKEN", + ) +} + // buffer provides a concurrency safe implementation of a bytes.Buffer // It is not safe to copy the buffer. type buffer struct { diff --git a/cmd/terramate/e2etests/internal/runner/stack.tm.hcl b/cmd/terramate/e2etests/internal/runner/stack.tm.hcl new file mode 100644 index 0000000000..0d07da9f45 --- /dev/null +++ b/cmd/terramate/e2etests/internal/runner/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "runner" + description = "runner" + tags = ["golang"] + id = "e66b6869-7b16-4a81-bbeb-0bb63f9357a5" +} diff --git a/cmd/terramate/stack.tm.hcl b/cmd/terramate/stack.tm.hcl new file mode 100644 index 0000000000..aa864a3f69 --- /dev/null +++ b/cmd/terramate/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "terramate" + description = "terramate" + tags = ["golang"] + id = "9995d678-4d46-4205-986e-16e32d99e7d7" +} diff --git a/commands.tm b/commands.tm new file mode 100644 index 0000000000..57e5033d7c --- /dev/null +++ b/commands.tm @@ -0,0 +1,52 @@ +// Copyright 2023 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +script "test" { + description = "Run Terramate tests" + job { + command = global.cmd.test.command + } +} + +script "test" "preview" { + description = "Create a Terramate Cloud Preview" + job { + command = tm_concat(global.cmd.test.command, [{ + cloud_sync_preview = true, + cloud_sync_terraform_plan_file = "test.plan" + }]) + } +} + +script "test" "deploy" { + description = "Create a Terramate Cloud Deployment" + job { + command = tm_concat(global.cmd.test.command, [{ + cloud_sync_deployment = true, + }]) + } +} + +script "create" "stack" { + description = <<-EOF + Creates a new stack. + + Usage: + TAGS=golang,mytag STACK_PATH=./stackdir terramate script run -- create stack + + EOF + job { + # hack until we support context=root + command = (global.is_root ? + ["terramate", "create", "--tags", env.TAGS, env.STACK_PATH] : + ["true"]) + } +} + +# Command variables + +# Defines the "tm script run -- test" command. +globals "cmd" "test" { + command = ["go", "test", "-race", "-count=1"] +} + diff --git a/config/filter/stack.tm.hcl b/config/filter/stack.tm.hcl new file mode 100644 index 0000000000..0c09c26ac7 --- /dev/null +++ b/config/filter/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "filter" + description = "filter" + tags = ["golang"] + id = "8fb2eccc-f0ff-4e77-a371-7cb935a59403" +} diff --git a/config/stack.tm.hcl b/config/stack.tm.hcl new file mode 100644 index 0000000000..f05cfc252c --- /dev/null +++ b/config/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "config" + description = "config" + tags = ["golang"] + id = "b9ee9772-5640-43e2-bd61-34234ce2b7d7" +} diff --git a/config/tag/stack.tm.hcl b/config/tag/stack.tm.hcl new file mode 100644 index 0000000000..11cf0efb67 --- /dev/null +++ b/config/tag/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "tag" + description = "tag" + tags = ["golang"] + id = "6a4e732a-cf37-46b4-a50d-24794ae78889" +} diff --git a/errors/errlog/stack.tm.hcl b/errors/errlog/stack.tm.hcl new file mode 100644 index 0000000000..3903d28540 --- /dev/null +++ b/errors/errlog/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "errlog" + description = "errlog" + tags = ["golang"] + id = "f2f27f76-2cd2-4b42-9042-5b4c2b9744d3" +} diff --git a/errors/stack.tm.hcl b/errors/stack.tm.hcl new file mode 100644 index 0000000000..0bd923e76e --- /dev/null +++ b/errors/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "errors" + description = "errors" + tags = ["golang"] + id = "ce216b58-a25f-4970-9c94-4540857532f7" +} diff --git a/event/stack.tm.hcl b/event/stack.tm.hcl new file mode 100644 index 0000000000..d39c6a5c76 --- /dev/null +++ b/event/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "event" + description = "event" + tags = ["golang"] + id = "2d360bd3-1951-4b49-866f-245b935c332b" +} diff --git a/fs/stack.tm.hcl b/fs/stack.tm.hcl new file mode 100644 index 0000000000..6fc529bce9 --- /dev/null +++ b/fs/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "fs" + description = "fs" + tags = ["golang"] + id = "449d7c2e-384b-4d7f-a547-e68379ecfd8d" +} diff --git a/generate/genfile/stack.tm.hcl b/generate/genfile/stack.tm.hcl new file mode 100644 index 0000000000..f0146d3e0b --- /dev/null +++ b/generate/genfile/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "genfile" + description = "genfile" + tags = ["golang"] + id = "19ae1e9f-c363-433d-96bd-d8abb5c525d3" +} diff --git a/generate/genhcl/stack.tm.hcl b/generate/genhcl/stack.tm.hcl new file mode 100644 index 0000000000..613c47fbf5 --- /dev/null +++ b/generate/genhcl/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "genhcl" + description = "genhcl" + tags = ["golang"] + id = "7d4d7597-2b32-4dd8-8a47-980b5ce707a2" +} diff --git a/generate/stack.tm.hcl b/generate/stack.tm.hcl new file mode 100644 index 0000000000..d1ee9c7613 --- /dev/null +++ b/generate/stack.tm.hcl @@ -0,0 +1,10 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "generate" + description = "generate" + tags = ["golang"] + id = "3d713212-6ef9-4c41-9afb-fe3c0e18f8df" + after = ["/globals"] +} diff --git a/git/stack.tm.hcl b/git/stack.tm.hcl new file mode 100644 index 0000000000..9595b9162d --- /dev/null +++ b/git/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "git" + description = "git" + tags = ["golang"] + id = "8b5378ad-41a2-4588-bb59-0e29f992deee" +} diff --git a/globals/stack.tm.hcl b/globals/stack.tm.hcl new file mode 100644 index 0000000000..059389d2cf --- /dev/null +++ b/globals/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "globals" + description = "globals" + tags = ["golang"] + id = "6c707b84-6217-4f68-a262-e16910ed029b" +} diff --git a/hcl/ast/stack.tm.hcl b/hcl/ast/stack.tm.hcl new file mode 100644 index 0000000000..95ecf5d772 --- /dev/null +++ b/hcl/ast/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "ast" + description = "ast" + tags = ["golang"] + id = "c55d20bc-1ba6-44ce-a3f8-ecb951981437" +} diff --git a/hcl/eval/stack.tm.hcl b/hcl/eval/stack.tm.hcl new file mode 100644 index 0000000000..2396df33fe --- /dev/null +++ b/hcl/eval/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "eval" + description = "eval" + tags = ["golang"] + id = "ce846cc0-6891-401a-a6c0-169b598dbbee" +} diff --git a/hcl/fmt/stack.tm.hcl b/hcl/fmt/stack.tm.hcl new file mode 100644 index 0000000000..93f7cafe9f --- /dev/null +++ b/hcl/fmt/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "fmt" + description = "fmt" + tags = ["golang"] + id = "4707da1c-40c7-47d4-bf6d-3544a72e0986" +} diff --git a/hcl/info/stack.tm.hcl b/hcl/info/stack.tm.hcl new file mode 100644 index 0000000000..c0115ce64d --- /dev/null +++ b/hcl/info/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "info" + description = "info" + tags = ["golang"] + id = "6a5c2713-0fb6-4717-abf4-e9ce0cbeb5ad" +} diff --git a/hcl/stack.tm.hcl b/hcl/stack.tm.hcl new file mode 100644 index 0000000000..c1499a82bc --- /dev/null +++ b/hcl/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "hcl" + description = "hcl" + tags = ["golang"] + id = "2ac23e42-0b2f-403e-855e-8cb328f984a3" +} diff --git a/lets/stack.tm.hcl b/lets/stack.tm.hcl new file mode 100644 index 0000000000..a636c2c60b --- /dev/null +++ b/lets/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "lets" + description = "lets" + tags = ["golang"] + id = "00284908-570b-4c11-8701-c8b860615116" +} diff --git a/ls/stack.tm.hcl b/ls/stack.tm.hcl new file mode 100644 index 0000000000..00601189f4 --- /dev/null +++ b/ls/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "ls" + description = "ls" + tags = ["golang"] + id = "b16c33b8-7dd1-4624-af25-0680d86e61f8" +} diff --git a/makefiles/unix.mk b/makefiles/unix.mk index bebbebc270..4e849f1d7b 100644 --- a/makefiles/unix.mk +++ b/makefiles/unix.mk @@ -42,6 +42,15 @@ test: test/helper build TM_TEST_ROOT_TEMPDIR=$(tempdir) ./bin/terramate run --no-recursive -- go test -race -count=1 ./... ./bin/helper rm $(tempdir) +## test/script run tests throught script run +.PHONY: test/script +tempdir=$(shell ./bin/helper tempdir) +test/script: parallel?=10 +test/script: test/helper build +# Using `terramate` because it detects and fails if the generated files are outdated. + TM_TEST_ROOT_TEMPDIR=$(tempdir) ./bin/terramate script run --parallel=$(parallel) --changed --tags=golang -- test + ./bin/helper rm $(tempdir) + ## test/interop .PHONY: test/interop test/interop: org?=test diff --git a/mapexpr/stack.tm.hcl b/mapexpr/stack.tm.hcl new file mode 100644 index 0000000000..6662920100 --- /dev/null +++ b/mapexpr/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "mapexpr" + description = "mapexpr" + tags = ["golang"] + id = "b5a3a333-9fb7-4cf8-84b7-2170b307555b" +} diff --git a/mapexpr/test/stack.tm.hcl b/mapexpr/test/stack.tm.hcl new file mode 100644 index 0000000000..1bcd2ce2be --- /dev/null +++ b/mapexpr/test/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "test" + description = "test" + tags = ["golang"] + id = "9da3e8a9-01f9-4120-a046-1760ea342112" +} diff --git a/modvendor/download/stack.tm.hcl b/modvendor/download/stack.tm.hcl new file mode 100644 index 0000000000..7616be78b0 --- /dev/null +++ b/modvendor/download/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "download" + description = "download" + tags = ["golang"] + id = "8054dffa-59bf-441c-b21c-4bdd907b26bb" +} diff --git a/modvendor/manifest/stack.tm.hcl b/modvendor/manifest/stack.tm.hcl new file mode 100644 index 0000000000..df9acbffe8 --- /dev/null +++ b/modvendor/manifest/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "manifest" + description = "manifest" + tags = ["golang"] + id = "ee6ce6c0-62c8-42a9-899f-d9d251ba6177" +} diff --git a/modvendor/stack.tm.hcl b/modvendor/stack.tm.hcl new file mode 100644 index 0000000000..46112a216f --- /dev/null +++ b/modvendor/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "modvendor" + description = "modvendor" + tags = ["golang"] + id = "1f960e4e-f2b8-4605-a9a5-6b77d51f0057" +} diff --git a/printer/stack.tm.hcl b/printer/stack.tm.hcl new file mode 100644 index 0000000000..5c506ef865 --- /dev/null +++ b/printer/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "printer" + description = "printer" + tags = ["golang"] + id = "fd3c1152-e3fa-49b1-8b8d-1f7255aa7c88" +} diff --git a/project/stack.tm.hcl b/project/stack.tm.hcl new file mode 100644 index 0000000000..55896600c3 --- /dev/null +++ b/project/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "project" + description = "project" + tags = ["golang"] + id = "b37ca64a-75c1-45e8-b846-77f8c4ab87da" +} diff --git a/run/dag/stack.tm.hcl b/run/dag/stack.tm.hcl new file mode 100644 index 0000000000..c56dc53776 --- /dev/null +++ b/run/dag/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "dag" + description = "dag" + tags = ["golang"] + id = "82c25e22-9d75-4e11-843f-7062d0080476" +} diff --git a/run/stack.tm.hcl b/run/stack.tm.hcl new file mode 100644 index 0000000000..9822b0d60f --- /dev/null +++ b/run/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "run" + description = "run" + tags = ["golang"] + id = "ee5226c0-82fd-4917-8357-571331577ae0" +} diff --git a/safeguard/stack.tm.hcl b/safeguard/stack.tm.hcl new file mode 100644 index 0000000000..43bc3862bd --- /dev/null +++ b/safeguard/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "safeguard" + description = "safeguard" + tags = ["golang"] + id = "50d8af26-0896-48ee-aeb1-2e548faf25a8" +} diff --git a/stack/stack.tm.hcl b/stack/stack.tm.hcl new file mode 100644 index 0000000000..a8ecbf045d --- /dev/null +++ b/stack/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "stack" + description = "stack" + tags = ["golang"] + id = "1ed6cdd7-edaf-4452-85b2-fe156b784bd7" +} diff --git a/stack/trigger/stack.tm.hcl b/stack/trigger/stack.tm.hcl new file mode 100644 index 0000000000..ad900ff89e --- /dev/null +++ b/stack/trigger/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "trigger" + description = "trigger" + tags = ["golang"] + id = "069383f1-e3a4-4059-9e72-1f45c6a494c5" +} diff --git a/stdlib/stack.tm.hcl b/stdlib/stack.tm.hcl new file mode 100644 index 0000000000..948f8d072b --- /dev/null +++ b/stdlib/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "stdlib" + description = "stdlib" + tags = ["golang"] + id = "3eb8b211-634d-4476-85fd-8c346a3cd274" +} diff --git a/strconv/stack.tm.hcl b/strconv/stack.tm.hcl new file mode 100644 index 0000000000..73449a8efd --- /dev/null +++ b/strconv/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "strconv" + description = "strconv" + tags = ["golang"] + id = "c27a3c7b-3866-42fe-9bfa-0aca229f6b2a" +} diff --git a/terramate.tm b/terramate.tm index a753630b43..f783d8f674 100644 --- a/terramate.tm +++ b/terramate.tm @@ -9,9 +9,11 @@ terramate { config { + experiments = ["scripts"] run { env { - PATH = "${terramate.root.path.fs.absolute}/bin${global.PS}${env.PATH}" + PATH = "${terramate.root.path.fs.absolute}/bin${global.PS}${env.PATH}" + NO_COLOR = "1" } } @@ -20,6 +22,10 @@ terramate { check_uncommitted = false check_remote = false } + + cloud { + organization = "test" + } } } diff --git a/test/cloud/stack.tm.hcl b/test/cloud/stack.tm.hcl new file mode 100644 index 0000000000..ac3dfa5ed1 --- /dev/null +++ b/test/cloud/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "cloud" + description = "cloud" + tags = ["golang"] + id = "caef4d2a-a404-4d1a-9b6d-9870a3c14959" +} diff --git a/test/errors/stack.tm.hcl b/test/errors/stack.tm.hcl new file mode 100644 index 0000000000..4088f62123 --- /dev/null +++ b/test/errors/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "errors" + description = "errors" + tags = ["golang"] + id = "d4344dc8-8c7d-4776-87a0-4ea331d3faaf" +} diff --git a/test/hclutils/info/stack.tm.hcl b/test/hclutils/info/stack.tm.hcl new file mode 100644 index 0000000000..d63f84a0dd --- /dev/null +++ b/test/hclutils/info/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "info" + description = "info" + tags = ["golang"] + id = "c834a93a-0058-4b02-bed1-ed58f0ce0240" +} diff --git a/test/hclutils/stack.tm.hcl b/test/hclutils/stack.tm.hcl new file mode 100644 index 0000000000..180a7d6979 --- /dev/null +++ b/test/hclutils/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "hclutils" + description = "hclutils" + tags = ["golang"] + id = "f1cdf97d-5bb1-4e65-ad43-919bc3e4ae6c" +} diff --git a/test/hclwrite/hclutils/stack.tm.hcl b/test/hclwrite/hclutils/stack.tm.hcl new file mode 100644 index 0000000000..4fec80cb42 --- /dev/null +++ b/test/hclwrite/hclutils/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "hclutils" + description = "hclutils" + tags = ["golang"] + id = "891ce33e-512b-4a2c-bc26-93401ef28156" +} diff --git a/test/hclwrite/stack.tm.hcl b/test/hclwrite/stack.tm.hcl new file mode 100644 index 0000000000..3c03741271 --- /dev/null +++ b/test/hclwrite/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "hclwrite" + description = "hclwrite" + tags = ["golang"] + id = "903529d4-5a12-417f-9f0b-585016e084fe" +} diff --git a/test/ls/stack.tm.hcl b/test/ls/stack.tm.hcl new file mode 100644 index 0000000000..b8054f2fc0 --- /dev/null +++ b/test/ls/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "ls" + description = "ls" + tags = ["golang"] + id = "772a6d18-3278-4fbf-b21a-f6c41b9cf867" +} diff --git a/test/sandbox/stack.tm.hcl b/test/sandbox/stack.tm.hcl new file mode 100644 index 0000000000..ef67e7fa3f --- /dev/null +++ b/test/sandbox/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "sandbox" + description = "sandbox" + tags = ["golang"] + id = "a0e95917-b18d-42e4-b871-cb912e98d59d" +} diff --git a/test/stack.tm.hcl b/test/stack.tm.hcl new file mode 100644 index 0000000000..bda3c337f4 --- /dev/null +++ b/test/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "test" + description = "test" + tags = ["golang"] + id = "7a6046da-af3e-4804-a58a-049b7092047f" +} diff --git a/tf/stack.tm.hcl b/tf/stack.tm.hcl new file mode 100644 index 0000000000..3efd1fd815 --- /dev/null +++ b/tf/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "tf" + description = "tf" + tags = ["golang"] + id = "5f48e9d4-9ab2-49e8-80a1-13392098c43c" +} diff --git a/versions/stack.tm.hcl b/versions/stack.tm.hcl new file mode 100644 index 0000000000..2d5b0f6992 --- /dev/null +++ b/versions/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "versions" + description = "versions" + tags = ["golang"] + id = "4c676b8f-b081-4df5-9d29-ff55f596bbb5" +}