-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: (CCIE-1585) Add more detailed ownership tags to fogg components (…
…#918) * skeleton for obtaining tags from config * add tags to template * stub stamps * feat: fill in github repository for tags * golden files * CCIE-1806 * deadcode * feat: compute file path tag (#930) * chore: first change * feat: add filepath of template being executed * tag name change * fix: add func for git origin (#931) * fix: add func for git origin * move test; deadcode * timestamp * update golden files * fix git remote url test * stamp cleanup and fix git remote test * remove user from template * update golden files * progress * update golden files * ci update golden files * update actions * token * commit from ci -- updated golden files * fix: populate git related tags with templated terraform (#934) * progress * handle git log errors in script * fix json string formatting * add git data source to template * git helper tags * branch tag * cleanup * add git authors to tags * commit from ci -- updated golden files * git author query formatting * commit from ci -- updated golden files --------- Co-authored-by: Jake Heath <[email protected]> Co-authored-by: Jake Heath <[email protected]> Co-authored-by: jakeyheath <[email protected]> Co-authored-by: dtsai-czi <[email protected]>
- Loading branch information
1 parent
bf8d37e
commit 6832494
Showing
100 changed files
with
2,628 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,49 @@ | ||
on: pull_request | ||
|
||
jobs: | ||
golden: | ||
runs-on: [self-hosted, ARM64, linux] | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: chanzuckerberg/[email protected] | ||
with: | ||
app_id: ${{ secrets.CZI_RELEASE_PLEASE_APP_ID }} | ||
private_key: ${{ secrets.CZI_RELEASE_PLEASE_PK }} | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
- name: Run tests | ||
run: make update-golden-files | ||
- name: Commit updated mod tidy | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: -A | ||
message: commit from ci -- updated golden files | ||
test: | ||
runs-on: self-hosted | ||
runs-on: [self-hosted, ARM64, linux] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v3 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
- name: Run tests | ||
run: make test-ci | ||
|
||
lint: | ||
runs-on: self-hosted | ||
runs-on: [self-hosted, ARM64, linux] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v3 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: go.mod | ||
cache: true | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,25 @@ func init() { | |
logrus.SetFormatter(formatter) | ||
} | ||
|
||
type testGitRemote struct { | ||
path string | ||
expectedRemotes []string | ||
} | ||
|
||
func TestGetGitRemoteOriginURL(t *testing.T) { | ||
r := require.New(t) | ||
sshRemote := "[email protected]:chanzuckerberg/fogg" | ||
httpsRemote := "https://github.com/chanzuckerberg/fogg" | ||
acceptableRemotes := []string{sshRemote, httpsRemote} | ||
tests := []testGitRemote{ | ||
{path: ".", expectedRemotes: acceptableRemotes}, | ||
} | ||
for _, test := range tests { | ||
remote := getGitRemoteOriginURL(test.path) | ||
r.Contains(test.expectedRemotes, remote) | ||
} | ||
} | ||
|
||
func randomString(n int) string { | ||
var letter = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{ define "make_git_helpers" }} | ||
SHELL := bash | ||
soft_git_log: | ||
@git log --pretty=format:"{ \"sha\": \"%H\" }" -1 HEAD || echo "{ \"sha\": \"unknown\" }" | ||
soft_git_user: | ||
@echo "{\"name\": \"$$(git config --global --get user.name)\"}" || echo "{ \"user\": \"unknown\" }" | ||
soft_git_email: | ||
@echo "{\"email\": \"$$(git config --global --get user.email)\"}" || echo "{ \"email\": \"unknown\" }" | ||
soft_git_branch: | ||
@echo "{\"branch\": \"$$(git rev-parse --abbrev-ref HEAD)\"}" || echo "{ \"branch\": \"unknown\" }" | ||
soft_git_authors: | ||
@echo "{\"authors\": \"$$(git log --format=\"%an\" -- . | grep -v "[bot]" | head -10)\"}" || echo "{ \"authors\": \"unknown\" }" | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{{ template "fogg_header" }} | ||
{{ template "make_vars" . }} | ||
{{ template "make_help" }} | ||
{{ template "make_git_helpers" }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
testdata/auth0_provider_yaml/terraform/accounts/foo/Makefile
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 43 additions & 5 deletions
48
testdata/auth0_provider_yaml/terraform/accounts/foo/fogg.tf
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
testdata/auth0_provider_yaml/terraform/envs/bar/bam/Makefile
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.