Skip to content

Commit 6e23981

Browse files
committed
Merge remote-tracking branch 'origin/main' into github-app
# Conflicts: # .github/actions/build-image/action.yaml # docs/usage.md
2 parents 9db9664 + 4e317be commit 6e23981

File tree

10 files changed

+25
-13
lines changed

10 files changed

+25
-13
lines changed

.github/actions/build-image/action.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
image_tag:
66
description: The image tag
77
required: true
8+
push:
9+
description: True to push image after building, false otherwise
10+
required: false
11+
default: "false"
812
tag_latest:
913
description: Tag latest as well as the provided tag
1014
default: "false"
@@ -21,7 +25,7 @@ runs:
2125
using: composite
2226

2327
steps:
24-
- uses: docker/setup-qemu-action@v1
28+
- uses: docker/setup-qemu-action@v3
2529
with:
2630
image: tonistiigi/binfmt:latest
2731
platforms: all
@@ -32,7 +36,7 @@ runs:
3236
with: { version: "v${{ env.EARTHLY_TOOL_VERSION }}" }
3337

3438
- name: login to registry
35-
uses: docker/login-action@v1
39+
uses: docker/login-action@v3
3640
with:
3741
registry: ghcr.io
3842
username: ${{ github.repository_owner }}
@@ -41,10 +45,10 @@ runs:
4145
- name: Build and push the Docker image
4246
shell: bash
4347
run: >-
44-
./earthly.sh
45-
--push
48+
./earthly.sh
49+
${{ inputs.push == 'true' && '--push' || '' }}
4650
+docker-multiarch
47-
${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }}
51+
${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }}
4852
--GIT_TAG=${{ inputs.image_tag }}
4953
--IMAGE_NAME=ghcr.io/${{ github.repository }}:${{ inputs.image_tag }}
5054
if: github.repository == 'zapier/kubechecks'

.github/workflows/on_pull_request.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ jobs:
3232
- uses: ./.github/actions/build-image
3333
id: build-image
3434
with:
35+
push: '${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}'
3536
image_tag: ${{ env.FS_TAG }}
3637
token: ${{ secrets.GITHUB_TOKEN }}
3738

3839
- uses: mshick/add-pr-comment@v2
3940
with:
4041
message: |
4142
Temporary image available at `${{ steps.build-image.outputs.image }}`.
43+
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name

.github/workflows/on_push_to_main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323

2424
- uses: ./.github/actions/build-image
2525
with:
26+
push: 'true'
2627
image_tag: ${{ env.GIT_TAG }}
2728
token: ${{ secrets.GITHUB_TOKEN }}
2829

cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func init() {
5050
)
5151
boolFlag(flags, "persist-log-level", "Persists the set log level down to other module loggers.")
5252
stringFlag(flags, "vcs-base-url", "VCS base url, useful if self hosting gitlab, enterprise github, etc.")
53+
stringFlag(flags, "vcs-upload-url", "VCS upload url, required for enterprise github.")
5354
stringFlag(flags, "vcs-type", "VCS type. One of gitlab or github. Defaults to gitlab.",
5455
newStringOpts().
5556
withChoices("github", "gitlab").

docs/usage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ The full list of supported environment variables is described below:
7272
|`KUBECHECKS_VCS_EMAIL`|VCS Email.||
7373
|`KUBECHECKS_VCS_TOKEN`|VCS API token.||
7474
|`KUBECHECKS_VCS_TYPE`|VCS type. One of gitlab or github.|`gitlab`|
75+
|`KUBECHECKS_VCS_UPLOAD_URL`|VCS upload url, required for enterprise github.||
7576
|`KUBECHECKS_VCS_USERNAME`|VCS Username.||
7677
|`KUBECHECKS_WEBHOOK_SECRET`|Optional secret key for validating the source of incoming webhooks.||
7778
|`KUBECHECKS_WEBHOOK_URL_BASE`|The endpoint to listen on for incoming PR/MR event webhooks. For example, 'https://checker.mycompany.com'.||

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ require (
3333
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
3434
github.com/prometheus/client_golang v1.20.2
3535
github.com/rikatz/kubepug v1.4.0
36-
github.com/rs/zerolog v1.32.0
37-
github.com/sashabaranov/go-openai v1.30.3
36+
github.com/rs/zerolog v1.33.0
37+
github.com/sashabaranov/go-openai v1.31.0
3838
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456
3939
github.com/sirupsen/logrus v1.9.3
4040
github.com/spf13/cobra v1.8.1

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -919,8 +919,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
919919
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
920920
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
921921
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
922-
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
923-
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
922+
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
923+
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
924924
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
925925
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
926926
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -930,8 +930,8 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g
930930
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
931931
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
932932
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
933-
github.com/sashabaranov/go-openai v1.30.3 h1:TEdRP3otRXX2A7vLoU+kI5XpoSo7VUUlM/rEttUqgek=
934-
github.com/sashabaranov/go-openai v1.30.3/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
933+
github.com/sashabaranov/go-openai v1.31.0 h1:rGe77x7zUeCjtS2IS7NCY6Tp4bQviXNMhkQM6hz/UC4=
934+
github.com/sashabaranov/go-openai v1.31.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
935935
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
936936
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
937937
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=

pkg/commitState.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func (s CommitState) BareString() string {
3030

3131
var stateString = map[CommitState]string{
3232
StateNone: "",
33+
StateSkip: "Skipped",
3334
StateSuccess: "Passed",
3435
StateRunning: "Running",
3536
StateWarning: "Warning",
@@ -62,6 +63,8 @@ func ParseCommitState(s string) (CommitState, error) {
6263
return StateError, nil
6364
case "panic":
6465
return StatePanic, nil
66+
case "skip", "skipped":
67+
return StateSkip, nil
6568
default:
6669
return StateNone, fmt.Errorf("unknown commit state: %s", s)
6770

pkg/vcs/github_client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func toGithubCommitStatus(state pkg.CommitState) *string {
204204
return pkg.Pointer("failure")
205205
case pkg.StateRunning:
206206
return pkg.Pointer("pending")
207-
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
207+
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone, pkg.StateSkip:
208208
return pkg.Pointer("success")
209209
}
210210

pkg/vcs/gitlab_client/status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func convertState(state pkg.CommitState) gitlab.BuildStateValue {
6969
return gitlab.Running
7070
case pkg.StateFailure, pkg.StateError, pkg.StatePanic:
7171
return gitlab.Failed
72-
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
72+
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone, pkg.StateSkip:
7373
return gitlab.Success
7474
}
7575

0 commit comments

Comments
 (0)