Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support to set the comment identity #16

Merged
merged 1 commit into from
Jan 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
build:
CGO_ENABLE=0 go build -ldflags "-w -s" -o bin/gogit
plugin-build:
CGO_ENABLE=0 go build -ldflags "-w -s" -o bin/gogit-executor-plugin cmd/argoworkflow/main.go
copy: build
cp bin/gogit /usr/local/bin
test:
go test ./... -coverprofile coverage.out
pre-commit: test
pre-commit: test build plugin-build
goreleaser:
goreleaser build --snapshot --rm-dist
image:
Expand Down
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Or in the following use cases:

Install as an Argo workflow executor plugin:

```yaml
```shell
cat <<EOF | kubectl apply -f -
---
apiVersion: v1
kind: ServiceAccount
Expand All @@ -54,6 +55,7 @@ data:
- gitlab
- --target
- http://argo.argo-server.svc:2746 # should be an external address
- --create-comment=true # create a comment to show the status of Workflow
image: ghcr.io/linuxsuren/workflow-executor-gogit:master
command:
- workflow-executor-gogit
Expand All @@ -78,10 +80,12 @@ metadata:
workflows.argoproj.io/configmap-type: ExecutorPlugin
name: gogit-executor-plugin
namespace: argo
EOF
```

then, create a WorkflowTemplate:
```yaml
```shell
cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
Expand Down Expand Up @@ -111,6 +115,35 @@ spec:
repo: test
pr: "3"
label: test
EOF
cat <<EOF | kubectl create -f -
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: plugin
namespace: default
spec:
workflowTemplateRef:
name: plugin
EOF
```

It could create (and update) a comment on target pull request to show the status of the Workflow. See also:

```yaml
hello-world is Succeeded. It takes 3m30.19239846s. Please check log output from [here](https://10.121.218.184:30298/workflows/default/hello-world-r2lqm).

| Stage | Status | Duration |
|---|---|---|
| test | Succeeded | 38s |
| scan | Succeeded | 54s |
| build | Succeeded | 2m54s |
| clone | Succeeded | 26s |
| check | Succeeded | 33s |
| build(0) | Succeeded | 2m44s |


Comment from [gogit](/~https://github.com/linuxsuren/gogit).
```

## TODO
Expand Down
15 changes: 14 additions & 1 deletion cmd/argoworkflow/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/argoproj/argo-workflows/v3 v3.4.4
github.com/linuxsuren/gogit v0.0.5-0.20230106063430-7d96e708cf7d
github.com/linuxsuren/gogit v0.0.5-0.20230108073958-1962f90e6d0f
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.1
k8s.io/apimachinery v0.26.0
Expand All @@ -14,10 +14,23 @@ require (
require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-git/v5 v5.4.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)

require (
Expand Down
Loading