Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into github-app
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/actions/build-image/action.yaml
#	docs/usage.md
  • Loading branch information
djeebus committed Nov 12, 2024
2 parents 9db9664 + 4e317be commit 6e23981
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 13 deletions.
14 changes: 9 additions & 5 deletions .github/actions/build-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
image_tag:
description: The image tag
required: true
push:
description: True to push image after building, false otherwise
required: false
default: "false"
tag_latest:
description: Tag latest as well as the provided tag
default: "false"
Expand All @@ -21,7 +25,7 @@ runs:
using: composite

steps:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: all
Expand All @@ -32,7 +36,7 @@ runs:
with: { version: "v${{ env.EARTHLY_TOOL_VERSION }}" }

- name: login to registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -41,10 +45,10 @@ runs:
- name: Build and push the Docker image
shell: bash
run: >-
./earthly.sh
--push
./earthly.sh
${{ inputs.push == 'true' && '--push' || '' }}
+docker-multiarch
${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }}
${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }}
--GIT_TAG=${{ inputs.image_tag }}
--IMAGE_NAME=ghcr.io/${{ github.repository }}:${{ inputs.image_tag }}
if: github.repository == 'zapier/kubechecks'
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ jobs:
- uses: ./.github/actions/build-image
id: build-image
with:
push: '${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}'
image_tag: ${{ env.FS_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: mshick/add-pr-comment@v2
with:
message: |
Temporary image available at `${{ steps.build-image.outputs.image }}`.
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
1 change: 1 addition & 0 deletions .github/workflows/on_push_to_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:

- uses: ./.github/actions/build-image
with:
push: 'true'
image_tag: ${{ env.GIT_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func init() {
)
boolFlag(flags, "persist-log-level", "Persists the set log level down to other module loggers.")
stringFlag(flags, "vcs-base-url", "VCS base url, useful if self hosting gitlab, enterprise github, etc.")
stringFlag(flags, "vcs-upload-url", "VCS upload url, required for enterprise github.")
stringFlag(flags, "vcs-type", "VCS type. One of gitlab or github. Defaults to gitlab.",
newStringOpts().
withChoices("github", "gitlab").
Expand Down
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ The full list of supported environment variables is described below:
|`KUBECHECKS_VCS_EMAIL`|VCS Email.||
|`KUBECHECKS_VCS_TOKEN`|VCS API token.||
|`KUBECHECKS_VCS_TYPE`|VCS type. One of gitlab or github.|`gitlab`|
|`KUBECHECKS_VCS_UPLOAD_URL`|VCS upload url, required for enterprise github.||
|`KUBECHECKS_VCS_USERNAME`|VCS Username.||
|`KUBECHECKS_WEBHOOK_SECRET`|Optional secret key for validating the source of incoming webhooks.||
|`KUBECHECKS_WEBHOOK_URL_BASE`|The endpoint to listen on for incoming PR/MR event webhooks. For example, 'https://checker.mycompany.com'.||
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/prometheus/client_golang v1.20.2
github.com/rikatz/kubepug v1.4.0
github.com/rs/zerolog v1.32.0
github.com/sashabaranov/go-openai v1.30.3
github.com/rs/zerolog v1.33.0
github.com/sashabaranov/go-openai v1.31.0
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand All @@ -930,8 +930,8 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
github.com/sashabaranov/go-openai v1.30.3 h1:TEdRP3otRXX2A7vLoU+kI5XpoSo7VUUlM/rEttUqgek=
github.com/sashabaranov/go-openai v1.30.3/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sashabaranov/go-openai v1.31.0 h1:rGe77x7zUeCjtS2IS7NCY6Tp4bQviXNMhkQM6hz/UC4=
github.com/sashabaranov/go-openai v1.31.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
Expand Down
3 changes: 3 additions & 0 deletions pkg/commitState.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func (s CommitState) BareString() string {

var stateString = map[CommitState]string{
StateNone: "",
StateSkip: "Skipped",
StateSuccess: "Passed",
StateRunning: "Running",
StateWarning: "Warning",
Expand Down Expand Up @@ -62,6 +63,8 @@ func ParseCommitState(s string) (CommitState, error) {
return StateError, nil
case "panic":
return StatePanic, nil
case "skip", "skipped":
return StateSkip, nil
default:
return StateNone, fmt.Errorf("unknown commit state: %s", s)

Expand Down
2 changes: 1 addition & 1 deletion pkg/vcs/github_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func toGithubCommitStatus(state pkg.CommitState) *string {
return pkg.Pointer("failure")
case pkg.StateRunning:
return pkg.Pointer("pending")
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone, pkg.StateSkip:
return pkg.Pointer("success")
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/vcs/gitlab_client/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func convertState(state pkg.CommitState) gitlab.BuildStateValue {
return gitlab.Running
case pkg.StateFailure, pkg.StateError, pkg.StatePanic:
return gitlab.Failed
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone, pkg.StateSkip:
return gitlab.Success
}

Expand Down

0 comments on commit 6e23981

Please sign in to comment.