From 4d2b783577aeeec71689a2f4751acdf6323a18c5 Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Mon, 29 Nov 2021 10:09:20 -0800 Subject: [PATCH 1/4] get mad when someone puts in an email instead of team --- internal/check/valid_owner.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/check/valid_owner.go b/internal/check/valid_owner.go index b3e1e67..9fde35e 100644 --- a/internal/check/valid_owner.go +++ b/internal/check/valid_owner.go @@ -125,7 +125,8 @@ func (v *ValidOwner) selectValidateFn(name string) func(context.Context, string) return v.validateTeam case isEmailAddress(name): // TODO(mszostok): try to check if e-mail really exists - return func(context.Context, string) *validateError { return nil } + //return func(context.Context, string) *validateError { return nil } + return newValidateError("Not a GitHub team - Email addresses are not permitted: %v", err) default: return func(_ context.Context, name string) *validateError { return newValidateError("Not valid owner definition %q", name) From 1df0da303d3f79a87e7b0e18f7d8efcaf4a29a0d Mon Sep 17 00:00:00 2001 From: Mariah Arnold Date: Mon, 29 Nov 2021 14:56:22 -0800 Subject: [PATCH 2/4] trying again --- .dockerignore | 4 ++-- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .goreleaser.yml | 8 ++++---- Dockerfile | 4 ++-- README.md | 20 +++++++++---------- action.yml | 5 +++-- docs/assets/usage.svg | 2 +- docs/gh-action.md | 6 +++--- .../investigation/file_exists_checker/glob.md | 2 +- docs/investigation/file_exists_checker/go.mod | 2 +- go.mod | 2 +- install.sh | 6 +++--- internal/check/api.go | 4 ++-- internal/check/api_test.go | 2 +- internal/check/duplicated_pattern.go | 4 ++-- internal/check/duplicated_pattern_test.go | 6 +++--- internal/check/file_exists.go | 2 +- internal/check/file_exists_test.go | 4 ++-- internal/check/helpers_test.go | 2 +- internal/check/package_test.go | 2 +- internal/check/valid_owner.go | 17 +++++++++------- internal/check/valid_owner_test.go | 2 +- internal/check/valid_syntax.go | 2 +- internal/check/valid_syntax_test.go | 6 +++--- internal/ctxutil/check_test.go | 2 +- internal/envconfig/envconfig_test.go | 2 +- internal/github/client.go | 2 +- internal/load/load.go | 6 +++--- internal/printer/tty.go | 2 +- internal/printer/tty_test.go | 4 ++-- internal/runner/runner_worker.go | 6 +++--- main.go | 12 +++++------ pkg/codeowners/owners_example_test.go | 2 +- pkg/codeowners/owners_test.go | 2 +- pkg/url/canonical_test.go | 2 +- .../TestCheckFailures/duppatterns.golden.txt | 2 +- 36 files changed, 82 insertions(+), 78 deletions(-) diff --git a/.dockerignore b/.dockerignore index df9a858..c50c42d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ # Ignore everything -** +#** # Allow binary -!/codeowners-validator +#!/codeowners-validator diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 82acc7c..9bb7bd4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Report a bug in the project title: '' labels: bug -assignees: mszostok +assignees: stitchfix --- diff --git a/.goreleaser.yml b/.goreleaser.yml index 3d134eb..c3f0636 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -12,7 +12,7 @@ builds: - amd64 - 386 ldflags: - - -s -w -X github.com/mszostok/codeowners-validator/pkg/version.version={{.Version}} -X github.com/mszostok/codeowners-validator/pkg/version.commit={{.ShortCommit}} -X github.com/mszostok/codeowners-validator/pkg/version.buildDate={{.Date}} + - -s -w -X github.com/stitchfix/codeowners-validator/pkg/version.version={{.Version}} -X github.com/stitchfix/codeowners-validator/pkg/version.commit={{.ShortCommit}} -X github.com/stitchfix/codeowners-validator/pkg/version.buildDate={{.Date}} # List of combinations of GOOS + GOARCH + GOARM to ignore. # Default is empty. ignore: @@ -44,6 +44,6 @@ dockers: binaries: - codeowners-validator image_templates: - - "mszostok/codeowners-validator:latest" - - "mszostok/codeowners-validator:{{ .Tag }}" - - "mszostok/codeowners-validator:v{{ .Major }}.{{ .Minor }}" + - "stitchfix/codeowners-validator:latest" + - "stitchfix/codeowners-validator:{{ .Tag }}" + - "stitchfix/codeowners-validator:v{{ .Major }}.{{ .Minor }}" diff --git a/Dockerfile b/Dockerfile index e263062..0b00952 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN apk --no-cache add ca-certificates git FROM scratch -LABEL source=https://github.com/mszostok/codeowners-validator.git +LABEL source=https://github.com/stitchfix/codeowners-validator.git COPY ./codeowners-validator /codeowners-validator @@ -16,4 +16,4 @@ COPY --from=deps /usr/bin/xargs /usr/bin/xargs COPY --from=deps /lib /lib COPY --from=deps /usr/lib /usr/lib -CMD ["/codeowners-validator"] +ENTRYPOINT ["/codeowners-validator"] diff --git a/README.md b/README.md index fd06457..c0a85d8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## Codeowners Validator Software License -Go Report Card +Go Report Card Twitter Follow The Codeowners Validator project validates the GitHub [CODEOWNERS](https://help.github.com/articles/about-code-owners/) file based on [specified checks](#checks). It supports public and private GitHub repositories and also GitHub Enterprise installations. @@ -29,7 +29,7 @@ docker run --rm -v $(pwd):/repo -w /repo \ -e GITHUB_ACCESS_TOKEN="$GH_TOKEN" \ -e EXPERIMENTAL_CHECKS="notowned" \ -e OWNER_CHECKER_REPOSITORY="org-name/rep-name" \ - mszostok/codeowners-validator:v0.6.0 + stitchfix/codeowners-validator:v0.6.0 ``` #### Command line @@ -46,7 +46,7 @@ env REPOSITORY_PATH="." \ #### GitHub Action ```yaml -- uses: mszostok/codeowners-validator@v0.6.0 +- uses: stitchfix/codeowners-validator@v0.6.0 with: checks: "files,owners,duppatterns" experimental_checks: "notowned" @@ -62,7 +62,7 @@ Check the [Configuration](#configuration) section for more info on how to enable ## Installation -It's highly recommended to install a fixed version of `codeowners-validator`. Releases are available on the [releases page](https://github.com/mszostok/codeowners-validator/releases). +It's highly recommended to install a fixed version of `codeowners-validator`. Releases are available on the [releases page](https://github.com/stitchfix/codeowners-validator/releases). #### From Release @@ -70,23 +70,23 @@ Here is the recommended way to install `codeowners-validator`: ```bash # binary installed into ./bin/ -curl -sfL https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s v0.6.0 +curl -sfL https://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh | sh -s v0.6.0 # binary installed into $(go env GOPATH)/bin/codeowners-validator -curl -sfL https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s -- -b $(go env GOPATH)/bin v0.6.0 +curl -sfL https://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh | sh -s -- -b $(go env GOPATH)/bin v0.6.0 # In alpine linux (as it does not come with curl by default) -wget -O - -q https://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh | sh -s v0.6.0 +wget -O - -q https://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh | sh -s v0.6.0 # Print version. Add `--short` to print just the version number. codeowners-validator -v ``` -You can also download [latest version](https://github.com/mszostok/codeowners-validator/releases/latest) from release page manually. +You can also download [latest version](https://github.com/stitchfix/codeowners-validator/releases/latest) from release page manually. #### From Sources -You can install `codeowners-validator` with `go install github.com/mszostok/codeowners-validator@v0.6.0`. +You can install `codeowners-validator` with `go install github.com/stitchfix/codeowners-validator@v0.6.0`. > NOTE: please use Go 1.16 or greater. @@ -148,6 +148,6 @@ Contributions are greatly appreciated! The project follows the typical GitHub pu ## Roadmap -The [codeowners-validator roadmap uses Github milestones](https://github.com/mszostok/codeowners-validator/milestone/1) to track the progress of the project. +The [codeowners-validator roadmap uses Github milestones](https://github.com/stitchfix/codeowners-validator/milestone/1) to track the progress of the project. They are sorted with priority. First are most important. diff --git a/action.yml b/action.yml index 3d04fc8..ac2e0ce 100644 --- a/action.yml +++ b/action.yml @@ -49,10 +49,11 @@ inputs: runs: using: 'docker' - image: 'docker://mszostok/codeowners-validator:v0.6.0' + image: '870660286712.dkr.ecr.us-east-1.amazonaws.com/mariah-test-ecr-repo:codeowners-validatorv0.6.3' + entrypoint: '/codeowners-validator' env: ENVS_PREFIX: "INPUT" - +#TODO: build container separately, make new action that just uses the image. branding: icon: "shield" color: "gray-dark" diff --git a/docs/assets/usage.svg b/docs/assets/usage.svg index 687ed61..3b1cdca 100644 --- a/docs/assets/usage.svg +++ b/docs/assets/usage.svg @@ -1 +1 @@ -OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\#Downloadcodeowners-validatorbinary/binv0.2.0curl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/local/binv0.2.0mszostok/codeowners-validatorinfocheckingGitHubfortag'v0.2.0'mszostok/codeowners-validatorinfofoundversion:0.2.0forv0.2.0/Darwin/x86_64mszostok/codeowners-validatorinfoinstalled/usr/local/bin/codeowners-validator#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERSgitclonegit@github.com:gh-codeowners/codeowners-samples.gitCloninginto'codeowners-samples'...remote:Enumeratingobjects:8,done.remote:Countingobjects:100%(8/8),done.remote:Compressingobjects:100%(3/3),done.remote:Total8(delta0),reused8(delta0),pack-reused0Receivingobjects:100%(8/8),done.#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepositoryEXPERIMENTAL_CHECKS="notowned"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\#Downloadcodeowners-validatorbinarycodeowners-validatorenvREPOSITORY_PATH="./codeowners-samples"\EXPERIMENTAL_CHECKS="notowned"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\codeowners-validator==>ExecutingFileExistChecker(1.240501ms)[err]line13:"/scripts/"doesnotmatchanyfilesinrepository==>ExecutingDuplicatedPatternChecker(1.820841ms)[err]Pattern"/some/awesome/dir"isdefined2timesinlines:*10:withowners:[@mszostok@owner-a]*11:withowners:[@octocat]==>Executing[Experimental]NotOwnedFileChecker(38.920431ms)CheckOK==>ExecutingValidOwnerChecker(1.238375347s)[err]line8:User"@mszostok"isnotamemberoftheorganization[err]line10:User"@owner-a"doesnothavegithubaccount[err]line11:User"@octocat"isnotamemberoftheorganization4check(s)executed,3failure(s)#Downloadcodeowners-validatorbinary#Downloadcodeowners-validatorbinary#Downloadcodeowners-validatorbinarycurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/mszostok/codeowners-validator/main/install.sh|sh-s---b/usr/local/binv0.2.0/binv0.2.0/binv0.2.0/binv0.2.0#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERSgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitReceivingobjects:12%(1/8)Receivingobjects:100%(8/8)#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepositoryenvREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\EXPERIMENTAL_CHECKS="notowned"\EXPERIMENTAL_CHECKS="notowned"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\codeowners-validator[err] +OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\#Downloadcodeowners-validatorbinary/binv0.2.0curl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/local/binv0.2.0stitchfix/codeowners-validatorinfocheckingGitHubfortag'v0.2.0'stitchfix/codeowners-validatorinfofoundversion:0.2.0forv0.2.0/Darwin/x86_64stitchfix/codeowners-validatorinfoinstalled/usr/local/bin/codeowners-validator#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERSgitclonegit@github.com:gh-codeowners/codeowners-samples.gitCloninginto'codeowners-samples'...remote:Enumeratingobjects:8,done.remote:Countingobjects:100%(8/8),done.remote:Compressingobjects:100%(3/3),done.remote:Total8(delta0),reused8(delta0),pack-reused0Receivingobjects:100%(8/8),done.#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepositoryEXPERIMENTAL_CHECKS="notowned"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\#Downloadcodeowners-validatorbinarycodeowners-validatorenvREPOSITORY_PATH="./codeowners-samples"\EXPERIMENTAL_CHECKS="notowned"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\codeowners-validator==>ExecutingFileExistChecker(1.240501ms)[err]line13:"/scripts/"doesnotmatchanyfilesinrepository==>ExecutingDuplicatedPatternChecker(1.820841ms)[err]Pattern"/some/awesome/dir"isdefined2timesinlines:*10:withowners:[@stitchfix@owner-a]*11:withowners:[@octocat]==>Executing[Experimental]NotOwnedFileChecker(38.920431ms)CheckOK==>ExecutingValidOwnerChecker(1.238375347s)[err]line8:User"@stitchfix"isnotamemberoftheorganization[err]line10:User"@owner-a"doesnothavegithubaccount[err]line11:User"@octocat"isnotamemberoftheorganization4check(s)executed,3failure(s)#Downloadcodeowners-validatorbinary#Downloadcodeowners-validatorbinary#Downloadcodeowners-validatorbinarycurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/localcurl-sfLhttps://raw.githubusercontent.com/stitchfix/codeowners-validator/main/install.sh|sh-s---b/usr/local/binv0.2.0/binv0.2.0/binv0.2.0/binv0.2.0#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERS#CloneexamplerepositorywithsampleCODEOWNERSgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitgitclonegit@github.com:gh-codeowners/codeowners-samples.gitReceivingobjects:12%(1/8)Receivingobjects:100%(8/8)#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepository#Executecodeowners-validatoragainstclonedrepositoryenvREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\envREPOSITORY_PATH="./codeowners-samples"\EXPERIMENTAL_CHECKS="notowned"\EXPERIMENTAL_CHECKS="notowned"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\GITHUB_ACCESS_TOKEN="${GH_TOKEN}"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\OWNER_CHECKER_ORGANIZATION_NAME="gh-codeowners"\codeowners-validator[err] diff --git a/docs/gh-action.md b/docs/gh-action.md index a4572c5..932b60e 100644 --- a/docs/gh-action.md +++ b/docs/gh-action.md @@ -9,10 +9,10 @@

## -The [Codeowners Validator](https://github.com/mszostok/codeowners-validator) is available as a GitHub Action. +The [Codeowners Validator](https://github.com/stitchfix/codeowners-validator) is available as a GitHub Action.

- demo + demo

@@ -35,7 +35,7 @@ jobs: # Checks-out your repository, which is validated in the next step - uses: actions/checkout@v2 - name: GitHub CODEOWNERS Validator - uses: mszostok/codeowners-validator@v0.6.0 + uses: stitchfix/codeowners-validator@v0.6.5 # input parameters with: # "The list of checks that will be executed. By default, all checks are executed. Possible values: files,owners,duppatterns,syntax" diff --git a/docs/investigation/file_exists_checker/glob.md b/docs/investigation/file_exists_checker/glob.md index 3fd3ed7..644dfca 100644 --- a/docs/investigation/file_exists_checker/glob.md +++ b/docs/investigation/file_exists_checker/glob.md @@ -7,7 +7,7 @@ This document describes investigation about [`file exists`](../../../internal/ch A [CODEOWNERS](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax) file uses a pattern that follows the same rules used in [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) files. The gitignore files support two consecutive asterisks ("**") in patterns that match against the full path name. Unfortunately the core Go library `filepath.Glob` does not support [`**`](https://github.com/golang/go/issues/11862) at all. -This caused that for some patterns the [`file exists`](../../../internal/check/file_exists.go) checker didn't work properly, see [issue#22](https://github.com/mszostok/codeowners-validator/issues/22). +This caused that for some patterns the [`file exists`](../../../internal/check/file_exists.go) checker didn't work properly, see [issue#22](https://github.com/stitchfix/codeowners-validator/issues/22). Additionally, we need to support a single asterisk at the beginning of the pattern. For example, `*.js` should check for all JS files in the whole git repository. To achieve that we need to detect that and change from `*.js` to `**/*.js`. diff --git a/docs/investigation/file_exists_checker/go.mod b/docs/investigation/file_exists_checker/go.mod index e95d277..4aebfb8 100644 --- a/docs/investigation/file_exists_checker/go.mod +++ b/docs/investigation/file_exists_checker/go.mod @@ -1,4 +1,4 @@ -module github.com/mszostok/codeowners-validator/docs/investigation/file_exists_checker +module github.com/stitchfix/codeowners-validator/docs/investigation/file_exists_checker go 1.15 diff --git a/go.mod b/go.mod index 27d3afc..f962056 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/mszostok/codeowners-validator +module github.com/stitchfix/codeowners-validator go 1.17 diff --git a/install.sh b/install.sh index 1182a54..3b68d79 100755 --- a/install.sh +++ b/install.sh @@ -6,13 +6,13 @@ set -e usage() { this=$1 cat < Executing Duplicated Pattern Checker () [err] Pattern "/some/awesome/dir" is defined 2 times in lines: - * 10: with owners: [@mszostok @owner-a] + * 10: with owners: [@stitchfix @owner-a] * 11: with owners: [@octocat] 1 check(s) executed, 1 failure(s) From d27fc893b78c3a251587b5d4b5835dc1603fe101 Mon Sep 17 00:00:00 2001 From: Rebecca Dadlani Date: Wed, 5 Jan 2022 18:03:50 -0700 Subject: [PATCH 3/4] wtf --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0b00952..3f8f8bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,20 @@ # Get latest CA certs & git -FROM alpine:3.14.2 as deps +FROM ubuntu:18.04 as deps -# hadolint ignore=DL3018 -RUN apk --no-cache add ca-certificates git +RUN apt update +RUN apt install -y git FROM scratch LABEL source=https://github.com/stitchfix/codeowners-validator.git -COPY ./codeowners-validator /codeowners-validator +COPY ./bin/codeowners-validator /codeowners-validator COPY --from=deps /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=deps /usr/bin/git /usr/bin/git COPY --from=deps /usr/bin/xargs /usr/bin/xargs COPY --from=deps /lib /lib COPY --from=deps /usr/lib /usr/lib +COPY --from=deps /usr/bin/tail /usr/bin/tail -ENTRYPOINT ["/codeowners-validator"] +CMD ["/codeowners-validator"] From 71e6e86d3075dbf23a78c9193e6b0e46a7624d49 Mon Sep 17 00:00:00 2001 From: Rebecca Dadlani Date: Wed, 5 Jan 2022 18:19:38 -0700 Subject: [PATCH 4/4] whatever --- action.yml | 20 ++++++++++---------- install.sh | 4 +--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index ac2e0ce..533fb02 100644 --- a/action.yml +++ b/action.yml @@ -47,13 +47,13 @@ inputs: description: "The comma-separated list of owners that should not be validated. Example: @owner1,@owner2,@org/team1,example@email.com." required: false -runs: - using: 'docker' - image: '870660286712.dkr.ecr.us-east-1.amazonaws.com/mariah-test-ecr-repo:codeowners-validatorv0.6.3' - entrypoint: '/codeowners-validator' - env: - ENVS_PREFIX: "INPUT" -#TODO: build container separately, make new action that just uses the image. -branding: - icon: "shield" - color: "gray-dark" +# runs: +# using: 'docker' +# image: 'docker://histhing' + +# env: +# ENVS_PREFIX: "INPUT" +# #TODO: build container separately, make new action that just uses the image. +# branding: +# icon: "shield" +# color: "gray-dark" diff --git a/install.sh b/install.sh index 3b68d79..db9b9da 100755 --- a/install.sh +++ b/install.sh @@ -45,9 +45,7 @@ parse_args() { execute() { tmpdir=$(mktemp -d) log_debug "downloading files into ${tmpdir}" - http_download "${tmpdir}/${TARBALL}" "${TARBALL_URL}" - http_download "${tmpdir}/${CHECKSUM}" "${CHECKSUM_URL}" - hash_sha256_verify "${tmpdir}/${TARBALL}" "${tmpdir}/${CHECKSUM}" + http_download "https://github.com/stitchfix/codeowners-validator/archive/refs/tags/v0.6.15.tar.gz" srcdir="${tmpdir}" (cd "${tmpdir}" && untar "${TARBALL}") test ! -d "${BINDIR}" && install -d "${BINDIR}"