File tree Expand file tree Collapse file tree 8 files changed +28
-22
lines changed Expand file tree Collapse file tree 8 files changed +28
-22
lines changed Original file line number Diff line number Diff line change 1
1
.DEFAULT_GOAL := apply
2
2
3
+ # Local build
3
4
build :
4
- @docker build -t urielc12/argocd-plugin:v0.1.0 .
5
- @kind load docker-image urielc12/argocd-plugin:v0.1.0 --name argo-workflows-plugin-argocd
6
5
@scripts/build_plugin.sh
7
6
8
7
apply : build
9
- @kubectl apply -n argo -f out /argocd-executor-plugin-configmap.yaml
8
+ @kubectl apply -n argo -f deployments /argocd-executor-plugin-configmap.yaml
10
9
@kubectl apply -n argo -f examples/rbac.yaml
11
10
12
11
submit :
13
12
@argo submit -n argo examples/argocd-example-wf.yaml
13
+
14
+ setup :
15
+ @scripts/create_cluster.sh
16
+
17
+ clean :
18
+ @scripts/delete_cluster.sh
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ COPY go.mod ./
12
12
COPY go.sum ./
13
13
RUN go mod download
14
14
COPY . .
15
- RUN GOOS=linux go build -o plugin cmd/main.go
15
+ RUN GOOS=linux go build -o plugin cmd/argocd-plugin/ main.go
16
16
17
17
FROM alpine:3.15
18
18
WORKDIR /app
Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ package main
3
3
import (
4
4
"context"
5
5
"net/http"
6
+
7
+ "github.com/UrielCohen456/argo-workflows-argocd-executor-plugin/common"
8
+ argocd "github.com/UrielCohen456/argo-workflows-argocd-executor-plugin/internal/argocd-plugin"
6
9
)
7
10
8
11
func main () {
9
- ctx := context .Background ()
10
- http .HandleFunc ("/api/v1/template.execute" , ArgocdPlugin (ctx ))
12
+ ctx := context .WithValue ( context . Background (), "namespace" , common . Namespace ());
13
+ http .HandleFunc ("/api/v1/template.execute" , argocd . ArgocdPlugin (ctx ))
11
14
http .ListenAndServe (":4355" , nil )
12
15
}
Original file line number Diff line number Diff line change 6
6
"strings"
7
7
)
8
8
9
+ // Returns the namespace the pod runs in.
9
10
func Namespace () string {
10
11
// This way assumes you've set the POD_NAMESPACE environment variable using the downward API.
11
- // This check has to be done first for backwards compatibility with the way InClusterConfig was originally set up
12
12
if ns , ok := os .LookupEnv ("POD_NAMESPACE" ); ok {
13
13
return ns
14
14
}
Original file line number Diff line number Diff line change 4
4
"context"
5
5
"fmt"
6
6
"net/http"
7
- "os/exec"
8
7
9
- "github.com/UrielCohen456/argo-workflows-argocd-executor-plugin/common"
8
+ // "os/exec"
9
+
10
10
// "k8s.io/apimachinery/pkg/api/errors"
11
11
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
12
12
"k8s.io/client-go/kubernetes"
@@ -15,13 +15,11 @@ import (
15
15
16
16
func ArgocdPlugin (ctx context.Context ) func (w http.ResponseWriter , req * http.Request ) {
17
17
return func (w http.ResponseWriter , req * http.Request ) {
18
- ctx := context .WithValue (ctx , "namespace" , common .Namespace ());
19
-
20
- output , err := exec .Command ("argocd" ).Output ()
21
- if err != nil {
22
- fmt .Println (err .Error ())
23
- }
24
- fmt .Println (string (output ))
18
+ // output, err := exec.Command("argocd").Output()
19
+ // if err!=nil {
20
+ // fmt.Println(err.Error())
21
+ // }
22
+ // fmt.Println(string(output))
25
23
26
24
config , err := rest .InClusterConfig ()
27
25
if err != nil {
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
#! /bin/env bash
2
2
3
3
argo executor-plugin build ./deployments
4
- # mv cmd/README.md out/
5
- # mv cmd /argocd-executor- plugin-configmap.yaml out/
4
+ docker build -t urielc12/argocd-plugin -f ./build/Dockerfile .
5
+ kind load docker-image urielc12 /argocd-plugin --name argo-workflows-plugin-argocd
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ kubectl config set-context --current --namespace argo > /dev/null 2>&1
22
22
echo " Setting up the argo tools..."
23
23
scripts/setup_argo_workflows.sh
24
24
scripts/setup_argocd.sh
25
- make apply
26
25
27
26
SECRET=$( kubectl get sa argo-server -n argo -o=jsonpath=' {.secrets[0].name}' )
28
27
ARGO_TOKEN=" Bearer $( kubectl get secret -n argo $SECRET -o=jsonpath=' {.data.token}' | base64 --decode) "
@@ -31,9 +30,10 @@ ARGO_TOKEN="Bearer $(kubectl get secret -n argo $SECRET -o=jsonpath='{.data.toke
31
30
echo " ----------------------------------------------------------------"
32
31
echo
33
32
echo " Finished creating the cluster enviornment! To get started: "
34
- echo " 1. Run 'make submit' to create a workflow running the plugin. "
35
- echo " 2. Connect to the argocd server by typing localhost:8080 in your browser"
36
- echo " 3. To connect to the argo server instead of using the argo cli: "
33
+ echo " 1. Run 'make apply' to create the plugin."
34
+ echo " 2. Run 'make submit' to apply a workflow running the plugin."
35
+ echo " 3. Connect to the argocd server by typing localhost:8080 in your browser."
36
+ echo " 4. To connect to the argo server instead of using the argo cli: "
37
37
echo " Copy the following token then port forward your argo-server service and use that token to login to it."
38
38
echo
39
39
echo $ARGO_TOKEN
You can’t perform that action at this time.
0 commit comments