Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hashicorp/terraform into liamcervan…
Browse files Browse the repository at this point in the history
…te/log-ignore-changes
  • Loading branch information
liamcervante committed Jan 3, 2025
2 parents d6611bf + 3b42e0a commit be9609f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-terraform-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
name: Terraform ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.product-version }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ inputs.go-version }}
- name: Build Terraform
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ name: build

on:
workflow_dispatch:
push:
workflow_run:
workflows: ["Quick Checks"]
types:
- completed
branches:
- main
- 'v[0-9]+.[0-9]+'
- releng/**
- tsccr-auto-pinning/**
- dependabot/**
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

Expand All @@ -27,6 +31,7 @@ permissions:
jobs:
get-product-version:
name: "Determine intended Terraform version"
if: ${{ github.event.action != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
outputs:
product-version: ${{ steps.get-product-version.outputs.product-version }}
Expand Down Expand Up @@ -190,7 +195,7 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}

Expand All @@ -207,7 +212,7 @@ jobs:
bash ./internal/command/e2etest/make-archive.sh
- name: Save test harness to cache
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: ${{ steps.set-cache-values.outputs.e2e-cache-path }}
key: ${{ steps.set-cache-values.outputs.e2e-cache-key }}_${{ matrix.goos }}_${{ matrix.goarch }}
Expand Down Expand Up @@ -247,7 +252,7 @@ jobs:
if: ${{ (matrix.goos == 'linux') || (matrix.goos == 'darwin') }}
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Restore cache"
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
id: e2etestpkg
with:
path: ${{ needs.e2etest-build.outputs.e2e-cache-path }}
Expand Down Expand Up @@ -300,7 +305,7 @@ jobs:

steps:
- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Download Terraform CLI package
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
Expand All @@ -83,15 +83,15 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
Expand Down Expand Up @@ -121,15 +121,15 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
Expand All @@ -155,15 +155,15 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: "~/go/pkg"
key: go-mod-${{ hashFiles('go.sum') }}
Expand All @@ -182,7 +182,7 @@ jobs:
fi
- name: Cache protobuf tools
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: "tools/protobuf-compile/.workdir"
key: protobuf-tools-${{ hashFiles('tools/protobuf-compile/protobuf-compile.go') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/equivalence-test-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}
cache-dependency-path: go.sum
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/equivalence-test-manual-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}
cache-dependency-path: go.sum
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/equivalence-test-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
uses: ./.github/actions/go-version

- name: Install Go toolchain
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.go.outputs.version }}
cache-dependency-path: go.sum
Expand Down
30 changes: 24 additions & 6 deletions internal/command/modules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"os"
"reflect"
"runtime"
"sort"
"strings"
"testing"
Expand Down Expand Up @@ -41,10 +42,29 @@ func TestModules_noJsonFlag(t *testing.T) {

actual := done(t).All()

for _, part := range expectedOutputHuman {
if !strings.Contains(actual, part) {
t.Fatalf("unexpected output: %s\n", part)
}
expectedOutputHuman := `
Modules declared by configuration:
.
├── "other"[./mods/other]
└── "test"[./mods/test]
└── "test2"[./test2]
└── "test3"[./test3]
`
if runtime.GOOS == "windows" {
expectedOutputHuman = `
Modules declared by configuration:
.
├── "other"[.\mods\other]
└── "test"[.\mods\test]
└── "test2"[.\test2]
└── "test3"[.\test3]
`
}

if diff := cmp.Diff(expectedOutputHuman, actual); diff != "" {
t.Fatalf("unexpected output:\n%s\n", diff)
}
}

Expand Down Expand Up @@ -185,5 +205,3 @@ func compareJSONOutput(t *testing.T, got string, want string) {
}

var expectedOutputJSON = `{"format_version":"1.0","modules":[{"key":"test","source":"./mods/test","version":""},{"key":"test2","source":"./test2","version":""},{"key":"test3","source":"./test3","version":""},{"key":"other","source":"./mods/other","version":""}]}`

var expectedOutputHuman = []string{"── \"other\"[./mods/other]", "── \"test\"[./mods/test]\n └── \"test2\"[./test2]\n └── \"test3\"[./test3]"}

0 comments on commit be9609f

Please sign in to comment.