Skip to content

Commit 176d2d9

Browse files
authored
[QT-658] Update the homebrew workflow for the public tap (#129)
* [QT-658] Update the homebrew workflow for the public tap Now that the enos bits are public we can use the public homebrew tap. This updates the template, formula, and publishing location. I also updated the tests to use a version of the formula that I've tested locally and know works. * Update homebrew template and repo * Fix a subtle race in a test that was making it flaky * Update `hashicorp/setup-terraform` to `v3` Signed-off-by: Ryan Cragun <[email protected]>
1 parent d654099 commit 176d2d9

File tree

9 files changed

+68
-90
lines changed

9 files changed

+68
-90
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
9494
with:
9595
go-version-file: go.mod
96-
- uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
96+
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
9797
id: download
9898
with:
9999
name: ${{ needs.profile-binary.outputs.profile-path }}

.github/workflows/update_homebrew_formula.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ on:
4444
version:
4545
required: true
4646
type: string
47-
description: The version number to be used in this release (e.g. 0.0.1)
47+
description: The version number to be used in this release (e.g. 0.0.27)
4848

4949
jobs:
5050
update-formula:
@@ -54,15 +54,15 @@ jobs:
5454
# Note: `gh` CLI automatically looks for and uses `env.GH_TOKEN` for authentication.
5555
# This token must have read:org scope in order to authenticate on a different repo.
5656
GH_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
57-
TARGET_REPO: hashicorp/homebrew-internal
58-
TARGET_REPO_FILEPATH: homebrew-internal-checkout
57+
TARGET_REPO: hashicorp/homebrew-tap
58+
TARGET_REPO_FILEPATH: homebrew-tap-checkout
5959
BASE_BRANCH: main
6060
PR_BRANCH: enos_homebrew_formula_update_v${{ inputs.version }}
6161
PR_TITLE: "Homebrew formula update for Enos version v${{ inputs.version }}"
6262
PR_BODY: "This is an automatically generated PR to update the Homebrew formula for Enos after a release has been completed. It must be manually approved and merged by a reviewer."
6363
COMMIT_MSG: "Update Homebrew formula for Enos version v${{ inputs.version }}"
64-
GIT_USER_EMAIL: team-secure[email protected]
65-
GIT_USER_NAME: Secure Quality Team
64+
GIT_USER_EMAIL: team-vault[email protected]
65+
GIT_USER_NAME: Vault Quality Team
6666
REVIEWER: quality-team
6767
steps:
6868
# Checkout Enos repo and place it in the specified relative path within the runner's main directory,
@@ -99,7 +99,7 @@ jobs:
9999
# Checkout target repo and place it in the specified relative path within the runner's main directory,
100100
# in order to accommodate checking out multiple repos.
101101
# A token with sufficient permissions for the target repo is required.
102-
- name: Checkout homebrew-internal
102+
- name: Checkout homebrew-tap
103103
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
104104
with:
105105
repository: ${{ env.TARGET_REPO }}
@@ -112,8 +112,8 @@ jobs:
112112
git config user.email "${{ env.GIT_USER_EMAIL }}"
113113
git config user.name "${{ env.GIT_USER_NAME }}"
114114
git checkout -b ${{ env.PR_BRANCH }}
115-
mv ../enos-checkout/enos.rb ./HomebrewFormula/enos.rb
116-
git add HomebrewFormula/enos.rb
115+
mv ../enos-checkout/enos.rb ./Formula/enos.rb
116+
git add Formula/enos.rb
117117
git commit -m "${{ env.COMMIT_MSG }}"
118118
git push origin ${{ env.PR_BRANCH }}
119119

.github/workflows/validate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- uses: ./.github/actions/set-up-buf
3030
- uses: ./.github/actions/set-up-gofumpt
3131
- uses: ./.github/actions/set-up-golangci-lint
32-
- uses: hashicorp/setup-terraform@v2
32+
- uses: hashicorp/setup-terraform@v3
3333
with:
3434
# the terraform wrapper will break terraform execution in enos because
3535
# it changes the output to text when we expect it to be JSON.
@@ -56,12 +56,12 @@ jobs:
5656
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
5757
with:
5858
go-version-file: go.mod
59-
- uses: hashicorp/setup-terraform@v2
59+
- uses: hashicorp/setup-terraform@v3
6060
with:
6161
# the terraform wrapper will break terraform execution in enos because
6262
# it changes the output to text when we expect it to be JSON.
6363
terraform_wrapper: false
64-
- uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
64+
- uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
6565
with:
6666
# The github actions service user creds for this account managed in hashicorp/enos-ci
6767
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}

acceptance/scenario_check_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ func TestAcc_Cmd_Scenario_Check_WithWarnings(t *testing.T) {
131131
t.Run(fmt.Sprintf("fail_on_warnings_%t", failOnWarnings), func(t *testing.T) {
132132
t.Parallel()
133133
outDir := filepath.Join(tmpDir, "scenario_generate_has_warnings")
134-
err = os.MkdirAll(outDir, 0o755)
134+
err := os.MkdirAll(outDir, 0o755)
135135
require.NoError(t, err)
136136
outDir, err = filepath.EvalSymlinks(outDir)
137137
require.NoError(t, err)

tools/homebrew/main_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ import (
1717
func Test_decodeMetadata(t *testing.T) {
1818
t.Parallel()
1919

20-
p, err := filepath.Abs("./support/enos_0.0.1_SHA256SUMS")
20+
p, err := filepath.Abs("./support/enos_0.0.27_SHA256SUMS")
2121
require.NoError(t, err)
2222

2323
sums, err := readMetadata(p)
2424
require.NoError(t, err)
2525

2626
expected := &metadata{
27-
DarwinAMD64SHA: "788eda2be1887fa13b2aca2a5bcad4535278310946c8f6f68fa561e72f7a351b",
28-
DarwinARM64SHA: "15d82aa03f5585966bc747e04ee31c025391dc1c80b3ba6419c95f6b764eebbd",
29-
LinuxAMD64SHA: "dc1f9597b024b59bf444d894c633c3fe796b7d57d74d7983ad57c4d7d37a516d",
30-
LinuxARM64SHA: "2a1677b83d6ec24038ef949420afa79269a405e35396aefec432412233cfc251",
31-
Version: "0.0.1",
32-
VersionTag: "v0.0.1",
27+
DarwinARM64SHA: "e10ffb026f933eef8d40b25dc864557b473da344346c5c6fd54ae28062dc4932",
28+
DarwinAMD64SHA: "155dc543097509fb7657867c468cc0a32ea62553eadfec34326f4633a577a043",
29+
LinuxARM64SHA: "81ed9db7983b9dc5e78cb40607afb8227a002b714113c0768bcbbcfcf339f941",
30+
LinuxAMD64SHA: "c4d4ae0d4de8315d18081a6719a634bbe263753e1f9d4a576c0b4650c2137af8",
31+
Version: "0.0.27",
32+
VersionTag: "v0.0.27",
3333
}
3434
require.Equal(t, expected, sums)
3535
}
@@ -38,7 +38,7 @@ func Test_decodeMetadata(t *testing.T) {
3838
func Test_renderHomebrewFormulaTemplate(t *testing.T) {
3939
t.Parallel()
4040

41-
p, err := filepath.Abs("./support/enos_0.0.1_SHA256SUMS")
41+
p, err := filepath.Abs("./support/enos_0.0.27_SHA256SUMS")
4242
require.NoError(t, err)
4343

4444
buf := bytes.Buffer{}

tools/homebrew/support/enos.rb

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,35 @@
1-
require_relative "../Strategies/private_strategy"
21
class Enos < Formula
3-
desc "A tool for powering Software Quality as Code by writing Terraform-based quality requirement scenarios using a composable and shareable declarative language."
2+
desc "A tool for powering Software Quality as Code by writing Terraform-based quality requirement scenarios using a composable, modular, and declarative language."
43
homepage "https://github.com/hashicorp/enos"
5-
version "0.0.1"
4+
version "0.0.27"
65

76
depends_on "hashicorp/tap/terraform"
87

9-
on_macos do
10-
if Hardware::CPU.arm?
11-
url "https://github.com/hashicorp/enos/releases/download/v0.0.1/enos_0.0.1_darwin_arm64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
12-
sha256 "15d82aa03f5585966bc747e04ee31c025391dc1c80b3ba6419c95f6b764eebbd"
8+
if OS.mac? && Hardware::CPU.arm?
9+
url "https://github.com/hashicorp/enos/releases/download/v0.0.27/enos_0.0.27_darwin_arm64.zip"
10+
sha256 "e10ffb026f933eef8d40b25dc864557b473da344346c5c6fd54ae28062dc4932"
11+
end
1312

14-
def install
15-
bin.install "enos"
16-
end
17-
end
18-
if Hardware::CPU.intel?
19-
url "https://github.com/hashicorp/enos/releases/download/v0.0.1/enos_0.0.1_darwin_amd64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
20-
sha256 "788eda2be1887fa13b2aca2a5bcad4535278310946c8f6f68fa561e72f7a351b"
13+
if OS.mac? && Hardware::CPU.intel?
14+
url "https://github.com/hashicorp/enos/releases/download/v0.0.27/enos_0.0.27_darwin_amd64.zip"
15+
sha256 "155dc543097509fb7657867c468cc0a32ea62553eadfec34326f4633a577a043"
16+
end
2117

22-
def install
23-
bin.install "enos"
24-
end
25-
end
18+
if OS.linux? && Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
19+
url "https://github.com/hashicorp/enos/releases/download/v0.0.27/enos_0.0.27_linux_arm64.zip"
20+
sha256 "81ed9db7983b9dc5e78cb40607afb8227a002b714113c0768bcbbcfcf339f941"
2621
end
2722

28-
on_linux do
29-
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
30-
url "https://github.com/hashicorp/enos/releases/download/v0.0.1/enos_0.0.1_linux_arm64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
31-
sha256 "2a1677b83d6ec24038ef949420afa79269a405e35396aefec432412233cfc251"
23+
if OS.linux? && Hardware::CPU.intel?
24+
url "https://github.com/hashicorp/enos/releases/download/v0.0.27/enos_0.0.27_linux_amd64.zip"
25+
sha256 "c4d4ae0d4de8315d18081a6719a634bbe263753e1f9d4a576c0b4650c2137af8"
26+
end
3227

33-
def install
34-
bin.install "enos"
35-
end
36-
end
37-
if Hardware::CPU.intel?
38-
url "https://github.com/hashicorp/enos/releases/download/v0.0.1/enos_0.0.1_linux_amd64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
39-
sha256 "dc1f9597b024b59bf444d894c633c3fe796b7d57d74d7983ad57c4d7d37a516d"
28+
def install
29+
bin.install "enos"
30+
end
4031

41-
def install
42-
bin.install "enos"
43-
end
44-
end
32+
test do
33+
system "#{bin}/enos --version"
4534
end
4635
end
Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,35 @@
1-
require_relative "../Strategies/private_strategy"
21
class Enos < Formula
3-
desc "A tool for powering Software Quality as Code by writing Terraform-based quality requirement scenarios using a composable and shareable declarative language."
2+
desc "A tool for powering Software Quality as Code by writing Terraform-based quality requirement scenarios using a composable, modular, and declarative language."
43
homepage "https://github.com/hashicorp/enos"
54
version "{{.Version}}"
65

76
depends_on "hashicorp/tap/terraform"
87

9-
on_macos do
10-
if Hardware::CPU.arm?
11-
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_darwin_arm64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
12-
sha256 "{{.DarwinARM64SHA}}"
8+
if OS.mac? && Hardware::CPU.arm?
9+
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_darwin_arm64.zip"
10+
sha256 "{{.DarwinARM64SHA}}"
11+
end
1312

14-
def install
15-
bin.install "enos"
16-
end
17-
end
18-
if Hardware::CPU.intel?
19-
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_darwin_amd64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
20-
sha256 "{{.DarwinAMD64SHA}}"
13+
if OS.mac? && Hardware::CPU.intel?
14+
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_darwin_amd64.zip"
15+
sha256 "{{.DarwinAMD64SHA}}"
16+
end
2117

22-
def install
23-
bin.install "enos"
24-
end
25-
end
18+
if OS.linux? && Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
19+
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_linux_arm64.zip"
20+
sha256 "{{.LinuxARM64SHA}}"
2621
end
2722

28-
on_linux do
29-
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
30-
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_linux_arm64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
31-
sha256 "{{.LinuxARM64SHA}}"
23+
if OS.linux? && Hardware::CPU.intel?
24+
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_linux_amd64.zip"
25+
sha256 "{{.LinuxAMD64SHA}}"
26+
end
3227

33-
def install
34-
bin.install "enos"
35-
end
36-
end
37-
if Hardware::CPU.intel?
38-
url "https://github.com/hashicorp/enos/releases/download/{{.VersionTag}}/enos_{{.Version}}_linux_amd64.zip", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
39-
sha256 "{{.LinuxAMD64SHA}}"
28+
def install
29+
bin.install "enos"
30+
end
4031

41-
def install
42-
bin.install "enos"
43-
end
44-
end
32+
test do
33+
system "#{bin}/enos --version"
4534
end
4635
end

tools/homebrew/support/enos_0.0.1_SHA256SUMS

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
155dc543097509fb7657867c468cc0a32ea62553eadfec34326f4633a577a043 enos_0.0.27_darwin_amd64.zip
2+
e10ffb026f933eef8d40b25dc864557b473da344346c5c6fd54ae28062dc4932 enos_0.0.27_darwin_arm64.zip
3+
c4d4ae0d4de8315d18081a6719a634bbe263753e1f9d4a576c0b4650c2137af8 enos_0.0.27_linux_amd64.zip
4+
81ed9db7983b9dc5e78cb40607afb8227a002b714113c0768bcbbcfcf339f941 enos_0.0.27_linux_arm64.zip

0 commit comments

Comments
 (0)