From 173cb1ebdc610aa1d32b4de43426cce401f5276a Mon Sep 17 00:00:00 2001 From: i4k Date: Sat, 14 Sep 2024 03:11:11 +0100 Subject: [PATCH] chore: use scripts + TMC sync in CI tests. Signed-off-by: i4k --- .github/workflows/ci.yml | 151 +++++++++++++++++----- .gitignore | 1 + _test_mock.tf | 6 + cloud/_test_mock.tf | 6 + cloud/deployment/_test_mock.tf | 6 + cloud/deployment/stack.tm.hcl | 9 ++ cloud/drift/_test_mock.tf | 6 + cloud/drift/stack.tm.hcl | 9 ++ cloud/preview/_test_mock.tf | 6 + cloud/preview/stack.tm.hcl | 9 ++ cloud/stack.tm.hcl | 9 ++ cloud/stack/_test_mock.tf | 6 + cloud/stack/stack.tm.hcl | 9 ++ cloud/testserver/_test_mock.tf | 6 + cloud/testserver/cloudstore/_test_mock.tf | 6 + cloud/testserver/cloudstore/stack.tm.hcl | 9 ++ cloud/testserver/stack.tm.hcl | 9 ++ cmd/terramate/cli/cliconfig/_test_mock.tf | 6 + cmd/terramate/cli/cliconfig/stack.tm.hcl | 9 ++ cmd/terramate/cli/github/_test_mock.tf | 6 + cmd/terramate/cli/github/stack.tm.hcl | 9 ++ cmd/terramate/cli/gitlab/_test_mock.tf | 6 + cmd/terramate/cli/gitlab/stack.tm.hcl | 9 ++ cmd/terramate/cli/out/_test_mock.tf | 6 + cmd/terramate/cli/out/stack.tm.hcl | 9 ++ config/_test_mock.tf | 6 + config/filter/_test_mock.tf | 6 + config/filter/stack.tm.hcl | 9 ++ config/stack.tm.hcl | 9 ++ e2etests/cloud/_test_mock.tf | 6 + e2etests/cloud/generate-e2e-testserver.tm | 9 +- e2etests/cloud/stack.tm.hcl | 9 ++ e2etests/core/_test_mock.tf | 6 + e2etests/core/stack.tm.hcl | 9 ++ e2etests/internal/runner/runner.go | 16 ++- errors/_test_mock.tf | 6 + errors/stack.tm.hcl | 9 ++ event/_test_mock.tf | 6 + event/stack.tm.hcl | 9 ++ fs/_test_mock.tf | 6 + fs/stack.tm.hcl | 9 ++ generate/_test_mock.tf | 6 + generate/genfile/_test_mock.tf | 6 + generate/genfile/stack.tm.hcl | 9 ++ generate/genhcl/_test_mock.tf | 6 + generate/genhcl/stack.tm.hcl | 9 ++ generate/stack.tm.hcl | 9 ++ git/_test_mock.tf | 6 + git/stack.tm.hcl | 9 ++ globals/_test_mock.tf | 6 + globals/stack.tm.hcl | 9 ++ golangci.tm | 2 +- hack/check-stacks.sh | 20 +++ hack/create-stacks.sh | 29 +++++ hack/packages.sh | 16 +++ hcl/_test_mock.tf | 6 + hcl/ast/_test_mock.tf | 6 + hcl/ast/stack.tm.hcl | 9 ++ hcl/eval/_test_mock.tf | 6 + hcl/eval/stack.tm.hcl | 9 ++ hcl/fmt/_test_mock.tf | 6 + hcl/fmt/stack.tm.hcl | 9 ++ hcl/info/_test_mock.tf | 6 + hcl/info/stack.tm.hcl | 9 ++ hcl/stack.tm.hcl | 9 ++ ls/_test_mock.tf | 6 + ls/stack.tm.hcl | 9 ++ makefiles/common.mk | 4 +- makefiles/unix.mk | 14 ++ modvendor/download/_test_mock.tf | 6 + modvendor/download/stack.tm.hcl | 9 ++ printer/_test_mock.tf | 6 + printer/stack.tm.hcl | 9 ++ project/_test_mock.tf | 6 + project/stack.tm.hcl | 9 ++ run/_test_mock.tf | 6 + run/dag/_test_mock.tf | 6 + run/dag/stack.tm.hcl | 9 ++ run/stack.tm.hcl | 9 ++ scheduler/_test_mock.tf | 6 + scheduler/stack.tm.hcl | 9 ++ scripts.tm | 46 +++++++ stack/_test_mock.tf | 6 + stack/stack.tm.hcl | 9 ++ stack/trigger/_test_mock.tf | 6 + stack/trigger/stack.tm.hcl | 9 ++ stdlib/_test_mock.tf | 6 + stdlib/stack.tm.hcl | 9 ++ terramate.tm | 26 +++- test/_test_mock.tf | 6 + test/hclwrite/_test_mock.tf | 6 + test/hclwrite/stack.tm.hcl | 9 ++ test/sandbox/_test_mock.tf | 6 + test/sandbox/stack.tm.hcl | 9 ++ test/stack.tm.hcl | 9 ++ tf/_test_mock.tf | 6 + tf/stack.tm.hcl | 9 ++ tg/_test_mock.tf | 6 + tg/stack.tm.hcl | 9 ++ versions/_test_mock.tf | 6 + versions/stack.tm.hcl | 9 ++ 101 files changed, 949 insertions(+), 51 deletions(-) create mode 100644 _test_mock.tf create mode 100644 cloud/_test_mock.tf create mode 100644 cloud/deployment/_test_mock.tf create mode 100644 cloud/deployment/stack.tm.hcl create mode 100644 cloud/drift/_test_mock.tf create mode 100644 cloud/drift/stack.tm.hcl create mode 100644 cloud/preview/_test_mock.tf create mode 100644 cloud/preview/stack.tm.hcl create mode 100644 cloud/stack.tm.hcl create mode 100644 cloud/stack/_test_mock.tf create mode 100644 cloud/stack/stack.tm.hcl create mode 100644 cloud/testserver/_test_mock.tf create mode 100644 cloud/testserver/cloudstore/_test_mock.tf create mode 100644 cloud/testserver/cloudstore/stack.tm.hcl create mode 100644 cloud/testserver/stack.tm.hcl create mode 100644 cmd/terramate/cli/cliconfig/_test_mock.tf create mode 100644 cmd/terramate/cli/cliconfig/stack.tm.hcl create mode 100644 cmd/terramate/cli/github/_test_mock.tf create mode 100644 cmd/terramate/cli/github/stack.tm.hcl create mode 100644 cmd/terramate/cli/gitlab/_test_mock.tf create mode 100644 cmd/terramate/cli/gitlab/stack.tm.hcl create mode 100644 cmd/terramate/cli/out/_test_mock.tf create mode 100644 cmd/terramate/cli/out/stack.tm.hcl create mode 100644 config/_test_mock.tf create mode 100644 config/filter/_test_mock.tf create mode 100644 config/filter/stack.tm.hcl create mode 100644 config/stack.tm.hcl create mode 100644 e2etests/cloud/_test_mock.tf create mode 100644 e2etests/cloud/stack.tm.hcl create mode 100644 e2etests/core/_test_mock.tf create mode 100644 e2etests/core/stack.tm.hcl create mode 100644 errors/_test_mock.tf create mode 100644 errors/stack.tm.hcl create mode 100644 event/_test_mock.tf create mode 100644 event/stack.tm.hcl create mode 100644 fs/_test_mock.tf create mode 100644 fs/stack.tm.hcl create mode 100644 generate/_test_mock.tf create mode 100644 generate/genfile/_test_mock.tf create mode 100644 generate/genfile/stack.tm.hcl create mode 100644 generate/genhcl/_test_mock.tf create mode 100644 generate/genhcl/stack.tm.hcl create mode 100644 generate/stack.tm.hcl create mode 100644 git/_test_mock.tf create mode 100644 git/stack.tm.hcl create mode 100644 globals/_test_mock.tf create mode 100644 globals/stack.tm.hcl create mode 100755 hack/check-stacks.sh create mode 100755 hack/create-stacks.sh create mode 100644 hack/packages.sh create mode 100644 hcl/_test_mock.tf create mode 100644 hcl/ast/_test_mock.tf create mode 100644 hcl/ast/stack.tm.hcl create mode 100644 hcl/eval/_test_mock.tf create mode 100644 hcl/eval/stack.tm.hcl create mode 100644 hcl/fmt/_test_mock.tf create mode 100644 hcl/fmt/stack.tm.hcl create mode 100644 hcl/info/_test_mock.tf create mode 100644 hcl/info/stack.tm.hcl create mode 100644 hcl/stack.tm.hcl create mode 100644 ls/_test_mock.tf create mode 100644 ls/stack.tm.hcl create mode 100644 modvendor/download/_test_mock.tf create mode 100644 modvendor/download/stack.tm.hcl create mode 100644 printer/_test_mock.tf create mode 100644 printer/stack.tm.hcl create mode 100644 project/_test_mock.tf create mode 100644 project/stack.tm.hcl create mode 100644 run/_test_mock.tf create mode 100644 run/dag/_test_mock.tf create mode 100644 run/dag/stack.tm.hcl create mode 100644 run/stack.tm.hcl create mode 100644 scheduler/_test_mock.tf create mode 100644 scheduler/stack.tm.hcl create mode 100644 scripts.tm create mode 100644 stack/_test_mock.tf create mode 100644 stack/stack.tm.hcl create mode 100644 stack/trigger/_test_mock.tf create mode 100644 stack/trigger/stack.tm.hcl create mode 100644 stdlib/_test_mock.tf create mode 100644 stdlib/stack.tm.hcl create mode 100644 test/_test_mock.tf create mode 100644 test/hclwrite/_test_mock.tf create mode 100644 test/hclwrite/stack.tm.hcl create mode 100644 test/sandbox/_test_mock.tf create mode 100644 test/sandbox/stack.tm.hcl create mode 100644 test/stack.tm.hcl create mode 100644 tf/_test_mock.tf create mode 100644 tf/stack.tm.hcl create mode 100644 tg/_test_mock.tf create mode 100644 tg/stack.tm.hcl create mode 100644 versions/_test_mock.tf create mode 100644 versions/stack.tm.hcl diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b558007b40..1a508b37d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,48 +11,43 @@ on: pull_request: 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: build Terramate - run: make build - - - name: checking go mod tidyness - run: ./bin/terramate run --tags golang --changed -- make mod/check - - - name: linting code - run: ./bin/terramate run --tags golang --changed -- make lint - - - name: checking license on source code - run: ./bin/terramate run --tags golang --changed -- make license/check - build_test: name: Build and Test - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os.value }} + permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout + pull-requests: write + checks: read strategy: + fail-fast: false matrix: - os: ["ubuntu-20.04", "macos-13"] + os: + - name: ubuntu-focal + value: "ubuntu-20.04" + - name: macos-ventura + value: "macos-13" go: ["1.21"] steps: + - name: Prepare pull request comment + if: github.event.pull_request + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: preview-${{ matrix.os.name }}-go-${{matrix.go}} + message: | + ## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests in ${{ github.event.pull_request.head.sha }} + + :warning: being created... please stand by! + - uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} fetch-depth: 0 - + - uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} @@ -63,20 +58,109 @@ jobs: tofu_wrapper: false github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: "1.7.5" + + - name: Install Terramate + uses: terramate-io/terramate-action@i4k-fix-macos + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: build Terramate - run: make build + run: make build && cp -v ./bin/terramate /usr/local/bin/terramate-bin - name: make generate run: make generate - - name: make test + ### Check for changed stacks + + - name: List changed stacks + id: list + run: terramate list --tags golang --changed + + ### Linting + + - name: linting code + if: steps.list.outputs.stdout + run: make lint + + - name: checking go mod tidyness + if: steps.list.outputs.stdout + run: make mod/check + + - name: checking license on source code + if: steps.list.outputs.stdout + run: make license/check + + - name: Check Terramate formatting + run: terramate fmt --check + + - name: Check Terraform formatting + if: steps.list.outputs.stdout + run: terraform fmt -recursive -check -diff + + ### Run the Terramate tests and create a Cloud Preview + + - name: Temporary PR Preview Link generation + run: echo >preview_url.txt "https://cloud.terramate.io/o/terramate/review-requests" + + - name: Run Terraform preview on changed + if: steps.list.outputs.stdout timeout-minutes: 30 - run: ./bin/terramate run --tags golang --changed -- make test + run: terramate script run --tags golang --target ${{ matrix.os.name }} --parallel 12 --changed preview env: + GITHUB_TOKEN: ${{ github.token }} TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5" - - name: check cloud info - run: ./bin/terramate run --tags golang --changed -- ./bin/terramate -vv experimental cloud info + ### Update Pull Request comment + + - name: Generate Preview Comment + if: steps.list.outputs.stdout + id: comment + run: | + echo >>pr-comment.txt "## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests 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: Inform about no Changed Stacks + if: success() && !steps.list.outputs.stdout + run: | + echo >>pr-comment.txt "## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests 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: Inform about failure + if: failure() + run: | + echo >>pr-comment.txt "## Preview of ${{ matrix.os.name }}/go${{matrix.go}} tests 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 on Terramate Cloud]($(cat preview_url.txt))" + cat pr-comment.txt >>$GITHUB_STEP_SUMMARY + + - name: Publish Plans for Changed Stacks + uses: marocchino/sticky-pull-request-comment@v2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + header: preview-${{ matrix.os.name }}-go-${{matrix.go}} + path: pr-comment.txt gh_integration_test: name: GHA Integration Test @@ -98,7 +182,7 @@ jobs: run: make build - name: make test/ci - run: ./bin/terramate run --tags golang --changed -- make test/ci + run: make test/ci release_dry_run: name: Release Dry Run @@ -158,7 +242,6 @@ jobs: cosign verify-blob --key cosign.pub --signature ${{ env.SIGNATURE_FILE }} ${{ env.CHECKSUM_FILE }} ci: needs: - - checks - build_test - gh_integration_test runs-on: ubuntu-20.04 diff --git a/.gitignore b/.gitignore index 9ee7410dee..fc2604bade 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ coverage.txt cpu.prof mem.prof *.test +*.tfplan *.plan # Go Workspaces artifacts diff --git a/_test_mock.tf b/_test_mock.tf new file mode 100644 index 0000000000..5cc938b7a7 --- /dev/null +++ b/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "terramate" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/_test_mock.tf b/cloud/_test_mock.tf new file mode 100644 index 0000000000..968ce80f8b --- /dev/null +++ b/cloud/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package cloud // import \"github.com/terramate-io/terramate/cloud\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/deployment/_test_mock.tf b/cloud/deployment/_test_mock.tf new file mode 100644 index 0000000000..330052637e --- /dev/null +++ b/cloud/deployment/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package deployment // import \"github.com/terramate-io/terramate/cloud/deployment\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/deployment/stack.tm.hcl b/cloud/deployment/stack.tm.hcl new file mode 100644 index 0000000000..5dcc01c239 --- /dev/null +++ b/cloud/deployment/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package deployment // import \"github.com/terramate-io/terramate/cloud/deployment\"" + description = "package deployment // import \"github.com/terramate-io/terramate/cloud/deployment\"" + tags = ["cloud", "deployment", "golang"] + id = "8f7fced1-1649-4c71-bdb1-5d861141a953" +} diff --git a/cloud/drift/_test_mock.tf b/cloud/drift/_test_mock.tf new file mode 100644 index 0000000000..7714242318 --- /dev/null +++ b/cloud/drift/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package drift // import \"github.com/terramate-io/terramate/cloud/drift\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/drift/stack.tm.hcl b/cloud/drift/stack.tm.hcl new file mode 100644 index 0000000000..11bcfb89c0 --- /dev/null +++ b/cloud/drift/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package drift // import \"github.com/terramate-io/terramate/cloud/drift\"" + description = "package drift // import \"github.com/terramate-io/terramate/cloud/drift\"" + tags = ["cloud", "drift", "golang"] + id = "feadf9e7-6cee-4f5e-9f75-a91c98ce4679" +} diff --git a/cloud/preview/_test_mock.tf b/cloud/preview/_test_mock.tf new file mode 100644 index 0000000000..9710f1c990 --- /dev/null +++ b/cloud/preview/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package preview // import \"github.com/terramate-io/terramate/cloud/preview\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/preview/stack.tm.hcl b/cloud/preview/stack.tm.hcl new file mode 100644 index 0000000000..c92d4a80da --- /dev/null +++ b/cloud/preview/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package preview // import \"github.com/terramate-io/terramate/cloud/preview\"" + description = "package preview // import \"github.com/terramate-io/terramate/cloud/preview\"" + tags = ["cloud", "golang", "preview"] + id = "90d86bc8-5cac-4576-9241-cfa9f9adc93d" +} diff --git a/cloud/stack.tm.hcl b/cloud/stack.tm.hcl new file mode 100644 index 0000000000..a18f88b3ea --- /dev/null +++ b/cloud/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package cloud // import \"github.com/terramate-io/terramate/cloud\"" + description = "package cloud // import \"github.com/terramate-io/terramate/cloud\"" + tags = ["cloud", "golang"] + id = "1d457835-4401-4ed9-bbbf-d4676c0e9b0c" +} diff --git a/cloud/stack/_test_mock.tf b/cloud/stack/_test_mock.tf new file mode 100644 index 0000000000..61973c9359 --- /dev/null +++ b/cloud/stack/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package stack // import \"github.com/terramate-io/terramate/cloud/stack\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/stack/stack.tm.hcl b/cloud/stack/stack.tm.hcl new file mode 100644 index 0000000000..e21454e75d --- /dev/null +++ b/cloud/stack/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package stack // import \"github.com/terramate-io/terramate/cloud/stack\"" + description = "package stack // import \"github.com/terramate-io/terramate/cloud/stack\"" + tags = ["cloud", "golang", "stack"] + id = "6b9cce64-2b44-43ed-bb2c-dc9525dd2585" +} diff --git a/cloud/testserver/_test_mock.tf b/cloud/testserver/_test_mock.tf new file mode 100644 index 0000000000..5f0743d546 --- /dev/null +++ b/cloud/testserver/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package testserver // import \"github.com/terramate-io/terramate/cloud/testserver\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/testserver/cloudstore/_test_mock.tf b/cloud/testserver/cloudstore/_test_mock.tf new file mode 100644 index 0000000000..0ee22b9f01 --- /dev/null +++ b/cloud/testserver/cloudstore/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package cloudstore // import \"github.com/terramate-io/terramate/cloud/testserver/cloudstore\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cloud/testserver/cloudstore/stack.tm.hcl b/cloud/testserver/cloudstore/stack.tm.hcl new file mode 100644 index 0000000000..4cc1322eb0 --- /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 = "package cloudstore // import \"github.com/terramate-io/terramate/cloud/testserver/cloudstore\"" + description = "package cloudstore // import \"github.com/terramate-io/terramate/cloud/testserver/cloudstore\"" + tags = ["cloud", "cloudstore", "golang", "testserver"] + id = "264e8e28-bddc-4244-a2c9-9dfb4e9cfd33" +} diff --git a/cloud/testserver/stack.tm.hcl b/cloud/testserver/stack.tm.hcl new file mode 100644 index 0000000000..0cb8303977 --- /dev/null +++ b/cloud/testserver/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package testserver // import \"github.com/terramate-io/terramate/cloud/testserver\"" + description = "package testserver // import \"github.com/terramate-io/terramate/cloud/testserver\"" + tags = ["cloud", "golang", "testserver"] + id = "6f6e494b-d500-4024-95ef-b273f459b61c" +} diff --git a/cmd/terramate/cli/cliconfig/_test_mock.tf b/cmd/terramate/cli/cliconfig/_test_mock.tf new file mode 100644 index 0000000000..8d40431a17 --- /dev/null +++ b/cmd/terramate/cli/cliconfig/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package cliconfig // import \"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cmd/terramate/cli/cliconfig/stack.tm.hcl b/cmd/terramate/cli/cliconfig/stack.tm.hcl new file mode 100644 index 0000000000..7a74f56a46 --- /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 = "package cliconfig // import \"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig\"" + description = "package cliconfig // import \"github.com/terramate-io/terramate/cmd/terramate/cli/cliconfig\"" + tags = ["cli", "cliconfig", "cmd", "golang", "terramate"] + id = "d9636c0a-f69c-47c7-8657-9ff5cdc454f3" +} diff --git a/cmd/terramate/cli/github/_test_mock.tf b/cmd/terramate/cli/github/_test_mock.tf new file mode 100644 index 0000000000..ea875b1481 --- /dev/null +++ b/cmd/terramate/cli/github/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package github // import \"github.com/terramate-io/terramate/cmd/terramate/cli/github\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cmd/terramate/cli/github/stack.tm.hcl b/cmd/terramate/cli/github/stack.tm.hcl new file mode 100644 index 0000000000..974aa0c03e --- /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 = "package github // import \"github.com/terramate-io/terramate/cmd/terramate/cli/github\"" + description = "package github // import \"github.com/terramate-io/terramate/cmd/terramate/cli/github\"" + tags = ["cli", "cmd", "github", "golang", "terramate"] + id = "6347be57-01f6-47cf-871a-6a7afe89b553" +} diff --git a/cmd/terramate/cli/gitlab/_test_mock.tf b/cmd/terramate/cli/gitlab/_test_mock.tf new file mode 100644 index 0000000000..7ef73e0f55 --- /dev/null +++ b/cmd/terramate/cli/gitlab/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package gitlab // import \"github.com/terramate-io/terramate/cmd/terramate/cli/gitlab\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cmd/terramate/cli/gitlab/stack.tm.hcl b/cmd/terramate/cli/gitlab/stack.tm.hcl new file mode 100644 index 0000000000..6daf904fab --- /dev/null +++ b/cmd/terramate/cli/gitlab/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package gitlab // import \"github.com/terramate-io/terramate/cmd/terramate/cli/gitlab\"" + description = "package gitlab // import \"github.com/terramate-io/terramate/cmd/terramate/cli/gitlab\"" + tags = ["cli", "cmd", "gitlab", "golang", "terramate"] + id = "9be406d8-ca18-48fb-ac5d-6c84efe8ff9d" +} diff --git a/cmd/terramate/cli/out/_test_mock.tf b/cmd/terramate/cli/out/_test_mock.tf new file mode 100644 index 0000000000..fbf2ac7d33 --- /dev/null +++ b/cmd/terramate/cli/out/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package out // import \"github.com/terramate-io/terramate/cmd/terramate/cli/out\"" + filename = "${path.module}/mock.ignore" +} diff --git a/cmd/terramate/cli/out/stack.tm.hcl b/cmd/terramate/cli/out/stack.tm.hcl new file mode 100644 index 0000000000..c095efb90d --- /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 = "package out // import \"github.com/terramate-io/terramate/cmd/terramate/cli/out\"" + description = "package out // import \"github.com/terramate-io/terramate/cmd/terramate/cli/out\"" + tags = ["cli", "cmd", "golang", "out", "terramate"] + id = "db0b206f-34f0-441a-814d-16a4c308183d" +} diff --git a/config/_test_mock.tf b/config/_test_mock.tf new file mode 100644 index 0000000000..a2a1d4c258 --- /dev/null +++ b/config/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package config // import \"github.com/terramate-io/terramate/config\"" + filename = "${path.module}/mock.ignore" +} diff --git a/config/filter/_test_mock.tf b/config/filter/_test_mock.tf new file mode 100644 index 0000000000..e2dcc9345c --- /dev/null +++ b/config/filter/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package filter // import \"github.com/terramate-io/terramate/config/filter\"" + filename = "${path.module}/mock.ignore" +} diff --git a/config/filter/stack.tm.hcl b/config/filter/stack.tm.hcl new file mode 100644 index 0000000000..932ed9b0c0 --- /dev/null +++ b/config/filter/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package filter // import \"github.com/terramate-io/terramate/config/filter\"" + description = "package filter // import \"github.com/terramate-io/terramate/config/filter\"" + tags = ["config", "filter", "golang"] + id = "a0d54dc3-56d1-49d0-b9c9-4cb1af7c1ba8" +} diff --git a/config/stack.tm.hcl b/config/stack.tm.hcl new file mode 100644 index 0000000000..d087f103a7 --- /dev/null +++ b/config/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package config // import \"github.com/terramate-io/terramate/config\"" + description = "package config // import \"github.com/terramate-io/terramate/config\"" + tags = ["config", "golang"] + id = "68518a25-8e45-44ca-898b-f8671370e9f4" +} diff --git a/e2etests/cloud/_test_mock.tf b/e2etests/cloud/_test_mock.tf new file mode 100644 index 0000000000..a4bdd4f512 --- /dev/null +++ b/e2etests/cloud/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "cloud" + filename = "${path.module}/mock.ignore" +} diff --git a/e2etests/cloud/generate-e2e-testserver.tm b/e2etests/cloud/generate-e2e-testserver.tm index 17c379adc3..489e5f8bd5 100644 --- a/e2etests/cloud/generate-e2e-testserver.tm +++ b/e2etests/cloud/generate-e2e-testserver.tm @@ -1,9 +1,8 @@ // Copyright 2023 Terramate GmbH // SPDX-License-Identifier: MPL-2.0 -generate_file "/e2etests/cloud/testdata/cloud.data.json" { - context = root - +generate_file "testdata/cloud.data.json" { + inherit = false lets { well_known = { required_version = "> 0.4.3" @@ -58,8 +57,8 @@ generate_file "/e2etests/cloud/testdata/cloud.data.json" { } lets { - github_get_pull_request_response = tm_jsondecode(tm_file("e2etests/cloud/testdata/github/get_pull_request_response.json")) - github_get_commit_response = tm_jsondecode(tm_file("e2etests/cloud/testdata/github/get_commit_response.json")) + github_get_pull_request_response = tm_try(tm_jsondecode(tm_file("testdata/github/get_pull_request_response.json")), null) + github_get_commit_response = tm_try(tm_jsondecode(tm_file("testdata/github/get_commit_response.json")), null) } content = tm_jsonencode({ diff --git a/e2etests/cloud/stack.tm.hcl b/e2etests/cloud/stack.tm.hcl new file mode 100644 index 0000000000..5bf7e46bd7 --- /dev/null +++ b/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 = ["cloud", "e2etests", "golang"] + id = "630a9ef7-e7e6-406d-816c-b7c6be5973cc" +} diff --git a/e2etests/core/_test_mock.tf b/e2etests/core/_test_mock.tf new file mode 100644 index 0000000000..dcf9e006a1 --- /dev/null +++ b/e2etests/core/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "core" + filename = "${path.module}/mock.ignore" +} diff --git a/e2etests/core/stack.tm.hcl b/e2etests/core/stack.tm.hcl new file mode 100644 index 0000000000..ba6f78febc --- /dev/null +++ b/e2etests/core/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "core" + description = "core" + tags = ["core", "e2etests", "golang"] + id = "a1337cb5-9e73-4773-94dd-77c9f0bdfeec" +} diff --git a/e2etests/internal/runner/runner.go b/e2etests/internal/runner/runner.go index 5323d874a1..7b38efcf99 100644 --- a/e2etests/internal/runner/runner.go +++ b/e2etests/internal/runner/runner.go @@ -10,6 +10,7 @@ import ( "os/exec" "path/filepath" "regexp" + "slices" "strings" "sync" "testing" @@ -83,14 +84,25 @@ func NewCLI(t *testing.T, chdir string, env ...string) CLI { // by default, it's assumed human mode env = RemoveEnv(os.Environ(), "CI", "GITHUB_ACTIONS", "GITHUB_TOKEN") } + // environments below are never used in automation. + env = RemoveEnv(env, "TMC_API_HOST", "TMC_API_DEBUG", "TMC_API_IDP_KEY") + // this needs to be deleted from environment otherwise CLI GHA tests will try to issue JWT tokens. + env = RemoveEnv(env, "ACTIONS_ID_TOKEN_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_TOKEN") + // this must be always disabled otherwise we contaminate the telemetry endpoint. env = append(env, "CHECKPOINT_DISABLE=1") + + // sanity check for cases where user has this configured in their environment. + if index := slices.Index(env, "TMC_API_URL"); index >= 0 { + apiURL := env[index] + if !strings.HasPrefix(apiURL, "http://") { + panic("tests are picking up the wrong API URL") + } + } // custom cliconfig file tm.userDir = test.TempDir(t) cliConfigPath := test.WriteFile(t, tm.userDir, "terramate.rc", fmt.Sprintf(testCliConfigFormat, strings.Replace(tm.userDir, "\\", "\\\\", -1))) env = append(env, "TM_CLI_CONFIG_FILE="+cliConfigPath, - "ACTIONS_ID_TOKEN_REQUEST_URL=", - "ACTIONS_ID_TOKEN_REQUEST_TOKEN=", ) tm.environ = env return tm diff --git a/errors/_test_mock.tf b/errors/_test_mock.tf new file mode 100644 index 0000000000..5f8d520639 --- /dev/null +++ b/errors/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package errors // import \"github.com/terramate-io/terramate/errors\"" + filename = "${path.module}/mock.ignore" +} diff --git a/errors/stack.tm.hcl b/errors/stack.tm.hcl new file mode 100644 index 0000000000..043f2d6092 --- /dev/null +++ b/errors/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package errors // import \"github.com/terramate-io/terramate/errors\"" + description = "package errors // import \"github.com/terramate-io/terramate/errors\"" + tags = ["errors", "golang"] + id = "c252e50b-e808-42a7-b81f-f369e99c3728" +} diff --git a/event/_test_mock.tf b/event/_test_mock.tf new file mode 100644 index 0000000000..c678be7c14 --- /dev/null +++ b/event/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package event // import \"github.com/terramate-io/terramate/event\"" + filename = "${path.module}/mock.ignore" +} diff --git a/event/stack.tm.hcl b/event/stack.tm.hcl new file mode 100644 index 0000000000..42f6fac228 --- /dev/null +++ b/event/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package event // import \"github.com/terramate-io/terramate/event\"" + description = "package event // import \"github.com/terramate-io/terramate/event\"" + tags = ["event", "golang"] + id = "d8c0a185-8850-427f-96db-cbaab7d92472" +} diff --git a/fs/_test_mock.tf b/fs/_test_mock.tf new file mode 100644 index 0000000000..cc0e483b2e --- /dev/null +++ b/fs/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package fs // import \"github.com/terramate-io/terramate/fs\"" + filename = "${path.module}/mock.ignore" +} diff --git a/fs/stack.tm.hcl b/fs/stack.tm.hcl new file mode 100644 index 0000000000..875144691e --- /dev/null +++ b/fs/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package fs // import \"github.com/terramate-io/terramate/fs\"" + description = "package fs // import \"github.com/terramate-io/terramate/fs\"" + tags = ["fs", "golang"] + id = "fa006eea-04bf-4959-a6c3-01c626609fd5" +} diff --git a/generate/_test_mock.tf b/generate/_test_mock.tf new file mode 100644 index 0000000000..1c4983fabb --- /dev/null +++ b/generate/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package generate // import \"github.com/terramate-io/terramate/generate\"" + filename = "${path.module}/mock.ignore" +} diff --git a/generate/genfile/_test_mock.tf b/generate/genfile/_test_mock.tf new file mode 100644 index 0000000000..bebf42c375 --- /dev/null +++ b/generate/genfile/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package genfile // import \"github.com/terramate-io/terramate/generate/genfile\"" + filename = "${path.module}/mock.ignore" +} diff --git a/generate/genfile/stack.tm.hcl b/generate/genfile/stack.tm.hcl new file mode 100644 index 0000000000..3f7bf7e125 --- /dev/null +++ b/generate/genfile/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package genfile // import \"github.com/terramate-io/terramate/generate/genfile\"" + description = "package genfile // import \"github.com/terramate-io/terramate/generate/genfile\"" + tags = ["generate", "genfile", "golang"] + id = "a81515e9-82c6-4375-97e8-0eb6cf305b7b" +} diff --git a/generate/genhcl/_test_mock.tf b/generate/genhcl/_test_mock.tf new file mode 100644 index 0000000000..c40e5fafda --- /dev/null +++ b/generate/genhcl/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package genhcl // import \"github.com/terramate-io/terramate/generate/genhcl\"" + filename = "${path.module}/mock.ignore" +} diff --git a/generate/genhcl/stack.tm.hcl b/generate/genhcl/stack.tm.hcl new file mode 100644 index 0000000000..7331828862 --- /dev/null +++ b/generate/genhcl/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package genhcl // import \"github.com/terramate-io/terramate/generate/genhcl\"" + description = "package genhcl // import \"github.com/terramate-io/terramate/generate/genhcl\"" + tags = ["generate", "genhcl", "golang"] + id = "ff690fdc-0ba1-47bb-9ec7-4bb87f3925f5" +} diff --git a/generate/stack.tm.hcl b/generate/stack.tm.hcl new file mode 100644 index 0000000000..3aa6f671d0 --- /dev/null +++ b/generate/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package generate // import \"github.com/terramate-io/terramate/generate\"" + description = "package generate // import \"github.com/terramate-io/terramate/generate\"" + tags = ["generate", "golang"] + id = "f839a3c7-35b5-4ddb-8ece-cda62d49ab3d" +} diff --git a/git/_test_mock.tf b/git/_test_mock.tf new file mode 100644 index 0000000000..d53cf4f77d --- /dev/null +++ b/git/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package git // import \"github.com/terramate-io/terramate/git\"" + filename = "${path.module}/mock.ignore" +} diff --git a/git/stack.tm.hcl b/git/stack.tm.hcl new file mode 100644 index 0000000000..cb977a5657 --- /dev/null +++ b/git/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package git // import \"github.com/terramate-io/terramate/git\"" + description = "package git // import \"github.com/terramate-io/terramate/git\"" + tags = ["git", "golang"] + id = "db5c782c-96b5-4ae9-9e9b-680f5c580c96" +} diff --git a/globals/_test_mock.tf b/globals/_test_mock.tf new file mode 100644 index 0000000000..d3518a5c15 --- /dev/null +++ b/globals/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package globals // import \"github.com/terramate-io/terramate/globals\"" + filename = "${path.module}/mock.ignore" +} diff --git a/globals/stack.tm.hcl b/globals/stack.tm.hcl new file mode 100644 index 0000000000..0fbe936af3 --- /dev/null +++ b/globals/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package globals // import \"github.com/terramate-io/terramate/globals\"" + description = "package globals // import \"github.com/terramate-io/terramate/globals\"" + tags = ["globals", "golang"] + id = "314f9cbe-7cf9-420b-83bd-5111aeb32d50" +} diff --git a/golangci.tm b/golangci.tm index 239e0d3f67..4f022abf24 100644 --- a/golangci.tm +++ b/golangci.tm @@ -18,7 +18,7 @@ generate_file "/.golangci.toml" { "exclude-rules" = [ { path = "(.+)_test\\.go" - text = "dot-imports:" + text = "dot-imports:" linters = ["revive"] } ] diff --git a/hack/check-stacks.sh b/hack/check-stacks.sh new file mode 100755 index 0000000000..f91b568b3f --- /dev/null +++ b/hack/check-stacks.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + + +source "$(dirname "$0")/packages.sh" + +rootdir=$(git rev-parse --show-toplevel) + +for pkg in $(packages_with_tests); do + cd $pkg + projdir=${pkg#"$rootdir"} + if [ "x${projdir}" == "x" ]; then + projdir="/" + fi + if ! test -f stack.tm -o -f stack.tm.hcl; then + echo "Stack ${projdir} must be created! Please run ./hack/create-stacks.sh" + exit 1 + fi +done diff --git a/hack/create-stacks.sh b/hack/create-stacks.sh new file mode 100755 index 0000000000..8cd71874c7 --- /dev/null +++ b/hack/create-stacks.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + + +source "$(dirname "$0")/packages.sh" + +rootdir=$(git rev-parse --show-toplevel) + +for pkg in $(packages_with_tests); do + cd $pkg + projdir=${pkg#"$rootdir"} + if [ "x${projdir}" == "x" ]; then + projdir="/" + fi + if test -f stack.tm -o -f stack.tm.hcl; then + continue + fi + name=$(go doc . | head -n1) + desc=$(go doc .) + tags=$(terramate experimental eval 'tm_join(",", [for p in tm_split("/", "'$projdir'") : p if p != ""])') + if ! test -z $tags; then + tags="--tags=golang,${tags}" + fi + terramate create . \ + --name="$name" \ + --description="$doc" \ + $tags +done diff --git a/hack/packages.sh b/hack/packages.sh new file mode 100644 index 0000000000..a5291b5122 --- /dev/null +++ b/hack/packages.sh @@ -0,0 +1,16 @@ +# Copyright 2024 Terramate GmbH +# SPDX-License-Identifier: MPL-2.0 + +packages() { + go list -f '{{.Dir}}' ./... | sort +} + +packages_with_tests() { + pkgs=$(packages) + for p in ${pkgs}; do + testfiles=$(ls "$p" | grep '_test.go$') + if ! test -z "$testfiles"; then + echo $p + fi + done +} diff --git a/hcl/_test_mock.tf b/hcl/_test_mock.tf new file mode 100644 index 0000000000..8044a6cf63 --- /dev/null +++ b/hcl/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package hcl // import \"github.com/terramate-io/terramate/hcl\"" + filename = "${path.module}/mock.ignore" +} diff --git a/hcl/ast/_test_mock.tf b/hcl/ast/_test_mock.tf new file mode 100644 index 0000000000..ae5c4eb804 --- /dev/null +++ b/hcl/ast/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package ast // import \"github.com/terramate-io/terramate/hcl/ast\"" + filename = "${path.module}/mock.ignore" +} diff --git a/hcl/ast/stack.tm.hcl b/hcl/ast/stack.tm.hcl new file mode 100644 index 0000000000..ad6f6e2919 --- /dev/null +++ b/hcl/ast/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package ast // import \"github.com/terramate-io/terramate/hcl/ast\"" + description = "package ast // import \"github.com/terramate-io/terramate/hcl/ast\"" + tags = ["ast", "golang", "hcl"] + id = "e27eaeed-8f95-4036-8a58-2c87a2297c05" +} diff --git a/hcl/eval/_test_mock.tf b/hcl/eval/_test_mock.tf new file mode 100644 index 0000000000..18098595d1 --- /dev/null +++ b/hcl/eval/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package eval // import \"github.com/terramate-io/terramate/hcl/eval\"" + filename = "${path.module}/mock.ignore" +} diff --git a/hcl/eval/stack.tm.hcl b/hcl/eval/stack.tm.hcl new file mode 100644 index 0000000000..6d3ded33bf --- /dev/null +++ b/hcl/eval/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package eval // import \"github.com/terramate-io/terramate/hcl/eval\"" + description = "package eval // import \"github.com/terramate-io/terramate/hcl/eval\"" + tags = ["eval", "golang", "hcl"] + id = "2d187f5b-7220-423f-b2ff-edd5683fb5c8" +} diff --git a/hcl/fmt/_test_mock.tf b/hcl/fmt/_test_mock.tf new file mode 100644 index 0000000000..351e9eb9cd --- /dev/null +++ b/hcl/fmt/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package fmt // import \"github.com/terramate-io/terramate/hcl/fmt\"" + filename = "${path.module}/mock.ignore" +} diff --git a/hcl/fmt/stack.tm.hcl b/hcl/fmt/stack.tm.hcl new file mode 100644 index 0000000000..2a6ea3ad58 --- /dev/null +++ b/hcl/fmt/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package fmt // import \"github.com/terramate-io/terramate/hcl/fmt\"" + description = "package fmt // import \"github.com/terramate-io/terramate/hcl/fmt\"" + tags = ["fmt", "golang", "hcl"] + id = "ae69565a-b6fd-4567-83de-659506f5e5e1" +} diff --git a/hcl/info/_test_mock.tf b/hcl/info/_test_mock.tf new file mode 100644 index 0000000000..c9674fee44 --- /dev/null +++ b/hcl/info/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package info // import \"github.com/terramate-io/terramate/hcl/info\"" + filename = "${path.module}/mock.ignore" +} diff --git a/hcl/info/stack.tm.hcl b/hcl/info/stack.tm.hcl new file mode 100644 index 0000000000..bc4cf78fc8 --- /dev/null +++ b/hcl/info/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package info // import \"github.com/terramate-io/terramate/hcl/info\"" + description = "package info // import \"github.com/terramate-io/terramate/hcl/info\"" + tags = ["golang", "hcl", "info"] + id = "178b6aaa-0cfe-4988-84fd-85e266e22bb3" +} diff --git a/hcl/stack.tm.hcl b/hcl/stack.tm.hcl new file mode 100644 index 0000000000..1c38a13d7f --- /dev/null +++ b/hcl/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package hcl // import \"github.com/terramate-io/terramate/hcl\"" + description = "package hcl // import \"github.com/terramate-io/terramate/hcl\"" + tags = ["golang", "hcl"] + id = "e9c09f01-42a8-4d30-b3fb-0ea70638bc9a" +} diff --git a/ls/_test_mock.tf b/ls/_test_mock.tf new file mode 100644 index 0000000000..d259dda316 --- /dev/null +++ b/ls/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package tmls // import \"github.com/terramate-io/terramate/ls\"" + filename = "${path.module}/mock.ignore" +} diff --git a/ls/stack.tm.hcl b/ls/stack.tm.hcl new file mode 100644 index 0000000000..0aadb3c4e2 --- /dev/null +++ b/ls/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package tmls // import \"github.com/terramate-io/terramate/ls\"" + description = "package tmls // import \"github.com/terramate-io/terramate/ls\"" + tags = ["golang", "ls"] + id = "70160527-f2ff-4137-8b83-14ef52396ea6" +} diff --git a/makefiles/common.mk b/makefiles/common.mk index f297656ec5..4f52c75d0c 100644 --- a/makefiles/common.mk +++ b/makefiles/common.mk @@ -1,7 +1,7 @@ GO_RELEASER_VERSION=v1.14.0 GOLANGCI_LINT_VERSION ?= v1.60.3 COVERAGE_REPORT ?= coverage.txt -RUN_ADD_LICENSE=go run github.com/google/addlicense@v1.0.0 -l mpl -s=only -ignore 'docs/**' +RUN_ADD_LICENSE=go run github.com/google/addlicense@v1.0.0 -l mpl -s=only -ignore 'docs/**' -ignore '**/*.tf' BENCH_CHECK=go run github.com/madlambda/benchcheck/cmd/benchcheck@743137fbfd827958b25ab6b13fa1180e0e933eb1 ## Build terramate tools into bin directory @@ -56,7 +56,7 @@ fmt: ## lint code .PHONY: lint lint: - go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run ./... + go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run . ## tidy up go modules .PHONY: mod diff --git a/makefiles/unix.mk b/makefiles/unix.mk index 16281e46f9..ffc2ccd248 100644 --- a/makefiles/unix.mk +++ b/makefiles/unix.mk @@ -41,6 +41,20 @@ test: test/helper build TM_TEST_ROOT_TEMPDIR=$(tempdir) ./bin/terramate run --no-recursive -- go test -race -count=1 -timeout 30m ./... ./bin/helper rm $(tempdir) +## test/sync code +.PHONY: test/sync +tempdir=$(shell ./bin/helper tempdir) +test/sync: test/helper build +# Using `terramate` because it detects and fails if the generated files are outdated. + TMC_API_HOST=api.stg.terramate.io \ + TM_TEST_ROOT_TEMPDIR=$(tempdir) \ + TM_CLOUD_ORGANIZATION=test \ + GITHUB_TOKEN=$(shell cat ../my_github_token.txt) \ + NO_COLOR=1 \ + CI=1 \ + ./bin/terramate script run --tags golang --parallel=10 preview + ./bin/helper rm $(tempdir) + ## test/interop .PHONY: test/interop test/interop: org?=test diff --git a/modvendor/download/_test_mock.tf b/modvendor/download/_test_mock.tf new file mode 100644 index 0000000000..40f547d374 --- /dev/null +++ b/modvendor/download/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package download // import \"github.com/terramate-io/terramate/modvendor/download\"" + filename = "${path.module}/mock.ignore" +} diff --git a/modvendor/download/stack.tm.hcl b/modvendor/download/stack.tm.hcl new file mode 100644 index 0000000000..08ffbb6aa5 --- /dev/null +++ b/modvendor/download/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package download // import \"github.com/terramate-io/terramate/modvendor/download\"" + description = "package download // import \"github.com/terramate-io/terramate/modvendor/download\"" + tags = ["download", "golang", "modvendor"] + id = "6adbc361-8f01-4c17-9d52-6927f8598a85" +} diff --git a/printer/_test_mock.tf b/printer/_test_mock.tf new file mode 100644 index 0000000000..0b38a2e7c0 --- /dev/null +++ b/printer/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package printer // import \"github.com/terramate-io/terramate/printer\"" + filename = "${path.module}/mock.ignore" +} diff --git a/printer/stack.tm.hcl b/printer/stack.tm.hcl new file mode 100644 index 0000000000..c344e83f44 --- /dev/null +++ b/printer/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package printer // import \"github.com/terramate-io/terramate/printer\"" + description = "package printer // import \"github.com/terramate-io/terramate/printer\"" + tags = ["golang", "printer"] + id = "f9b0dbd9-866b-4e52-a90e-7c514e448830" +} diff --git a/project/_test_mock.tf b/project/_test_mock.tf new file mode 100644 index 0000000000..87afcd8fe2 --- /dev/null +++ b/project/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package project // import \"github.com/terramate-io/terramate/project\"" + filename = "${path.module}/mock.ignore" +} diff --git a/project/stack.tm.hcl b/project/stack.tm.hcl new file mode 100644 index 0000000000..6c98276dce --- /dev/null +++ b/project/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package project // import \"github.com/terramate-io/terramate/project\"" + description = "package project // import \"github.com/terramate-io/terramate/project\"" + tags = ["golang", "project"] + id = "b4e7c08f-1435-4f70-bd68-368133752191" +} diff --git a/run/_test_mock.tf b/run/_test_mock.tf new file mode 100644 index 0000000000..651045a38c --- /dev/null +++ b/run/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package run // import \"github.com/terramate-io/terramate/run\"" + filename = "${path.module}/mock.ignore" +} diff --git a/run/dag/_test_mock.tf b/run/dag/_test_mock.tf new file mode 100644 index 0000000000..82729cdb61 --- /dev/null +++ b/run/dag/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package dag // import \"github.com/terramate-io/terramate/run/dag\"" + filename = "${path.module}/mock.ignore" +} diff --git a/run/dag/stack.tm.hcl b/run/dag/stack.tm.hcl new file mode 100644 index 0000000000..5ec4b925ea --- /dev/null +++ b/run/dag/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package dag // import \"github.com/terramate-io/terramate/run/dag\"" + description = "package dag // import \"github.com/terramate-io/terramate/run/dag\"" + tags = ["dag", "golang", "run"] + id = "6502948b-daec-430a-802c-8ed41d72f3c2" +} diff --git a/run/stack.tm.hcl b/run/stack.tm.hcl new file mode 100644 index 0000000000..fb33326b70 --- /dev/null +++ b/run/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package run // import \"github.com/terramate-io/terramate/run\"" + description = "package run // import \"github.com/terramate-io/terramate/run\"" + tags = ["golang", "run"] + id = "669b4e1e-6770-4575-9745-0d802a1459e8" +} diff --git a/scheduler/_test_mock.tf b/scheduler/_test_mock.tf new file mode 100644 index 0000000000..058537240c --- /dev/null +++ b/scheduler/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package scheduler // import \"github.com/terramate-io/terramate/scheduler\"" + filename = "${path.module}/mock.ignore" +} diff --git a/scheduler/stack.tm.hcl b/scheduler/stack.tm.hcl new file mode 100644 index 0000000000..7a53cfe402 --- /dev/null +++ b/scheduler/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package scheduler // import \"github.com/terramate-io/terramate/scheduler\"" + description = "package scheduler // import \"github.com/terramate-io/terramate/scheduler\"" + tags = ["golang", "scheduler"] + id = "8c46cc73-50cf-4e90-b64f-f9a3987133df" +} diff --git a/scripts.tm b/scripts.tm new file mode 100644 index 0000000000..750bca6030 --- /dev/null +++ b/scripts.tm @@ -0,0 +1,46 @@ + + + +globals { + planfile = "out.tfplan" +} + +script "preview" { + name = "Preview Terramate tests" + + job { + commands = [ + ["bash", "-c", "terraform init -lock=false >/dev/null"], + ["bash", "-c", "terraform plan -out=${global.planfile} >/dev/null"] + ] + } + + job { + command = [ + "go", "test", "-race", "-count=1", "-timeout", "30m", { + sync_preview = true, + terraform_plan_file = global.planfile, + } + ] + } +} + +script "deploy" { + name = "Deploy Terramate tests" + + job { + commands = [ + ["bash", "-c", "terraform init -lock=false >/dev/null"], + ["bash", "-c", "terraform plan -out=${global.planfile} >/dev/null"] + ] + } + + job { + command = [ + "go", "test", "-race", "-count=1", "-timeout", "30m", { + sync_deployment = true, + terraform_plan_file = global.planfile, + } + ] + } +} diff --git a/stack/_test_mock.tf b/stack/_test_mock.tf new file mode 100644 index 0000000000..fbfd9746f7 --- /dev/null +++ b/stack/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package stack // import \"github.com/terramate-io/terramate/stack\"" + filename = "${path.module}/mock.ignore" +} diff --git a/stack/stack.tm.hcl b/stack/stack.tm.hcl new file mode 100644 index 0000000000..b0288ad8a8 --- /dev/null +++ b/stack/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package stack // import \"github.com/terramate-io/terramate/stack\"" + description = "package stack // import \"github.com/terramate-io/terramate/stack\"" + tags = ["golang", "stack"] + id = "6acb76e1-670a-4161-b7ce-163fff861699" +} diff --git a/stack/trigger/_test_mock.tf b/stack/trigger/_test_mock.tf new file mode 100644 index 0000000000..37fad96896 --- /dev/null +++ b/stack/trigger/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package trigger // import \"github.com/terramate-io/terramate/stack/trigger\"" + filename = "${path.module}/mock.ignore" +} diff --git a/stack/trigger/stack.tm.hcl b/stack/trigger/stack.tm.hcl new file mode 100644 index 0000000000..d27c7a2759 --- /dev/null +++ b/stack/trigger/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package trigger // import \"github.com/terramate-io/terramate/stack/trigger\"" + description = "package trigger // import \"github.com/terramate-io/terramate/stack/trigger\"" + tags = ["golang", "stack", "trigger"] + id = "ce7cc771-6a83-4098-9ba4-61d336e75b0e" +} diff --git a/stdlib/_test_mock.tf b/stdlib/_test_mock.tf new file mode 100644 index 0000000000..7fbf315086 --- /dev/null +++ b/stdlib/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package stdlib // import \"github.com/terramate-io/terramate/stdlib\"" + filename = "${path.module}/mock.ignore" +} diff --git a/stdlib/stack.tm.hcl b/stdlib/stack.tm.hcl new file mode 100644 index 0000000000..3f19a9b54f --- /dev/null +++ b/stdlib/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package stdlib // import \"github.com/terramate-io/terramate/stdlib\"" + description = "package stdlib // import \"github.com/terramate-io/terramate/stdlib\"" + tags = ["golang", "stdlib"] + id = "247fd494-a2b5-4a35-9d73-a0a011f41cee" +} diff --git a/terramate.tm b/terramate.tm index 822623c752..5d0a6193a5 100644 --- a/terramate.tm +++ b/terramate.tm @@ -1,15 +1,9 @@ // Copyright 2023 Terramate GmbH // SPDX-License-Identifier: MPL-2.0 -# This file is here just to e2etest on Windows if the `terramate run` respects -# the `terramate.config.run.env.PATH` environment variable. -# This behavior is not tested in Go because it requires a lot of "unsafe" -# non-portable code. -# It's used by the `make test` implemented for Windows at ./makefiles/windows.mk - terramate { config { - experiments = ["toml-functions"] + experiments = ["toml-functions", "scripts", "targets"] run { env { PATH = "${terramate.root.path.fs.absolute}/bin${global.PS}${env.PATH}" @@ -21,6 +15,14 @@ terramate { check_uncommitted = false check_remote = false } + + cloud { + organization = "terramate-tests" + + targets { + enabled = true + } + } } } @@ -28,3 +30,13 @@ globals { # TODO(i4k): very brittle but works for now. PS = tm_fileexists("/etc/hosts") ? ":" : ";" } + +generate_hcl "_test_mock.tf" { + condition = tm_contains(terramate.stack.tags, "golang") + content { + resource "local_file" "foo" { + content = terramate.stack.name + filename = "${path.module}/mock.ignore" + } + } +} diff --git a/test/_test_mock.tf b/test/_test_mock.tf new file mode 100644 index 0000000000..96bb0111b9 --- /dev/null +++ b/test/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package test // import \"github.com/terramate-io/terramate/test\"" + filename = "${path.module}/mock.ignore" +} diff --git a/test/hclwrite/_test_mock.tf b/test/hclwrite/_test_mock.tf new file mode 100644 index 0000000000..cd7264e201 --- /dev/null +++ b/test/hclwrite/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package hclwrite // import \"github.com/terramate-io/terramate/test/hclwrite\"" + filename = "${path.module}/mock.ignore" +} diff --git a/test/hclwrite/stack.tm.hcl b/test/hclwrite/stack.tm.hcl new file mode 100644 index 0000000000..fceaeccb8f --- /dev/null +++ b/test/hclwrite/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package hclwrite // import \"github.com/terramate-io/terramate/test/hclwrite\"" + description = "package hclwrite // import \"github.com/terramate-io/terramate/test/hclwrite\"" + tags = ["golang", "hclwrite", "test"] + id = "a64ecd0b-87b3-4141-bae0-c842a82b8bff" +} diff --git a/test/sandbox/_test_mock.tf b/test/sandbox/_test_mock.tf new file mode 100644 index 0000000000..b70ad758b5 --- /dev/null +++ b/test/sandbox/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package sandbox // import \"github.com/terramate-io/terramate/test/sandbox\"" + filename = "${path.module}/mock.ignore" +} diff --git a/test/sandbox/stack.tm.hcl b/test/sandbox/stack.tm.hcl new file mode 100644 index 0000000000..ce2a3c2125 --- /dev/null +++ b/test/sandbox/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package sandbox // import \"github.com/terramate-io/terramate/test/sandbox\"" + description = "package sandbox // import \"github.com/terramate-io/terramate/test/sandbox\"" + tags = ["golang", "sandbox", "test"] + id = "6825af18-653a-4f02-a054-bf1af14a7ccd" +} diff --git a/test/stack.tm.hcl b/test/stack.tm.hcl new file mode 100644 index 0000000000..d2acf7dd49 --- /dev/null +++ b/test/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package test // import \"github.com/terramate-io/terramate/test\"" + description = "package test // import \"github.com/terramate-io/terramate/test\"" + tags = ["golang", "test"] + id = "a8e3f50d-efdb-4ae6-808b-83b5a935621f" +} diff --git a/tf/_test_mock.tf b/tf/_test_mock.tf new file mode 100644 index 0000000000..be9747bdc0 --- /dev/null +++ b/tf/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package tf // import \"github.com/terramate-io/terramate/tf\"" + filename = "${path.module}/mock.ignore" +} diff --git a/tf/stack.tm.hcl b/tf/stack.tm.hcl new file mode 100644 index 0000000000..03b9531792 --- /dev/null +++ b/tf/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package tf // import \"github.com/terramate-io/terramate/tf\"" + description = "package tf // import \"github.com/terramate-io/terramate/tf\"" + tags = ["golang", "tf"] + id = "ddbc17e4-9222-4cb6-8232-44330b0256f2" +} diff --git a/tg/_test_mock.tf b/tg/_test_mock.tf new file mode 100644 index 0000000000..a44a206454 --- /dev/null +++ b/tg/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package tg // import \"github.com/terramate-io/terramate/tg\"" + filename = "${path.module}/mock.ignore" +} diff --git a/tg/stack.tm.hcl b/tg/stack.tm.hcl new file mode 100644 index 0000000000..80adb5fcb8 --- /dev/null +++ b/tg/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package tg // import \"github.com/terramate-io/terramate/tg\"" + description = "package tg // import \"github.com/terramate-io/terramate/tg\"" + tags = ["golang", "tg"] + id = "99a9adef-11eb-47da-abae-68ff24d933fb" +} diff --git a/versions/_test_mock.tf b/versions/_test_mock.tf new file mode 100644 index 0000000000..87b79d6ca1 --- /dev/null +++ b/versions/_test_mock.tf @@ -0,0 +1,6 @@ +// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT + +resource "local_file" "foo" { + content = "package versions // import \"github.com/terramate-io/terramate/versions\"" + filename = "${path.module}/mock.ignore" +} diff --git a/versions/stack.tm.hcl b/versions/stack.tm.hcl new file mode 100644 index 0000000000..8b1b9a5e0d --- /dev/null +++ b/versions/stack.tm.hcl @@ -0,0 +1,9 @@ +// Copyright 2024 Terramate GmbH +// SPDX-License-Identifier: MPL-2.0 + +stack { + name = "package versions // import \"github.com/terramate-io/terramate/versions\"" + description = "package versions // import \"github.com/terramate-io/terramate/versions\"" + tags = ["golang", "versions"] + id = "fe9d75c0-35fa-4ac8-9200-30e6f4de7ea3" +}