test the build
This commit is contained in:
parent
2b1dec7e52
commit
9d30b49396
29
.woodpecker.yaml
Normal file
29
.woodpecker.yaml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
build:
|
||||||
|
image: git.badhouseplants.net/badhouseplants/badhouseplants-builder:ff4a98f2acb557ad443f279627036bebf06bc4f1
|
||||||
|
name: Build shoebill operator image
|
||||||
|
privileged: true
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
if [[ "${CI_COMMIT_TAG}" ]]; then
|
||||||
|
export CUSTOM_TAG="${CI_COMMIT_TAG}";
|
||||||
|
fi
|
||||||
|
- build-container
|
||||||
|
secrets:
|
||||||
|
- gitea_token
|
||||||
|
backend_options:
|
||||||
|
kubernetes:
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: 500Mi
|
||||||
|
cpu: 200m
|
||||||
|
limits:
|
||||||
|
memory: 1000Mi
|
||||||
|
cpu: 1000m
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
@ -89,7 +89,8 @@ spec:
|
|||||||
args:
|
args:
|
||||||
- --leader-elect
|
- --leader-elect
|
||||||
- --health-probe-bind-address=:8081
|
- --health-probe-bind-address=:8081
|
||||||
image: controller:latest
|
# image: controller:latest
|
||||||
|
image: git.badhouseplants.net/allanger/gitops-diff-operator:latest
|
||||||
name: manager
|
name: manager
|
||||||
env:
|
env:
|
||||||
- name: SSH_KNOWN_HOSTS
|
- name: SSH_KNOWN_HOSTS
|
||||||
|
@ -11,6 +11,7 @@ require (
|
|||||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
|
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
|
||||||
gopkg.in/src-d/go-git.v4 v4.13.1
|
gopkg.in/src-d/go-git.v4 v4.13.1
|
||||||
gopkg.in/yaml.v2 v2.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
|
k8s.io/api v0.29.6
|
||||||
k8s.io/apiextensions-apiserver v0.29.6
|
k8s.io/apiextensions-apiserver v0.29.6
|
||||||
k8s.io/apimachinery v0.29.6
|
k8s.io/apimachinery v0.29.6
|
||||||
k8s.io/client-go v0.29.6
|
k8s.io/client-go v0.29.6
|
||||||
@ -158,7 +159,6 @@ require (
|
|||||||
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
|
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
k8s.io/api v0.29.6 // indirect
|
|
||||||
k8s.io/apiserver v0.29.6 // indirect
|
k8s.io/apiserver v0.29.6 // indirect
|
||||||
k8s.io/cli-runtime v0.29.6 // indirect
|
k8s.io/cli-runtime v0.29.6 // indirect
|
||||||
k8s.io/component-base v0.29.6 // indirect
|
k8s.io/component-base v0.29.6 // indirect
|
||||||
|
@ -93,7 +93,7 @@ func (r *DiffReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
|
|||||||
client, err := apiclient.NewClient(&argocdclient.ClientOptions{
|
client, err := apiclient.NewClient(&argocdclient.ClientOptions{
|
||||||
ServerAddr: "argocd-server.argo-system.svc.cluster.local:80",
|
ServerAddr: "argocd-server.argo-system.svc.cluster.local:80",
|
||||||
Insecure: true,
|
Insecure: true,
|
||||||
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJhbGljZTphcGlLZXkiLCJuYmYiOjE3MTk5MzIwOTEsImlhdCI6MTcxOTkzMjA5MSwianRpIjoiN2VmM2Y2OTYtYjU4Zi00NDIyLTk4YTktNjFlYjMyNjNhNDUxIn0.XmQThdSp_WWUbWv6Ur95URqXnY9-LCXxmcun9kBoYTQ",
|
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJkcm9uZTphcGlLZXkiLCJuYmYiOjE3MTk5NTc1OTMsImlhdCI6MTcxOTk1NzU5MywianRpIjoidGVzdC1kaWZmIn0.eJ-MOONUca0JEtoQlfNFdV_U-dULjyg37u8jrc2boYc",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return reconcileResult, err
|
return reconcileResult, err
|
||||||
@ -191,30 +191,28 @@ func getManifestsFromArgo(ctx context.Context, q application.ApplicationManifest
|
|||||||
app.ObjectMeta.Name = fmt.Sprintf("%s-%s", "diff", app.ObjectMeta.Name)
|
app.ObjectMeta.Name = fmt.Sprintf("%s-%s", "diff", app.ObjectMeta.Name)
|
||||||
app.Spec.SyncPolicy = &argoappv1.SyncPolicy{}
|
app.Spec.SyncPolicy = &argoappv1.SyncPolicy{}
|
||||||
|
|
||||||
app, err := appCl.Create(ctx, &application.ApplicationCreateRequest{
|
cl, err := appCl.GetManifestsWithFiles(ctx)
|
||||||
Application: app,
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
output, err := getManifestsFromArgo(ctx, application.ApplicationManifestQuery{
|
chunk := &application.ApplicationManifestQueryWithFilesWrapper_Chunk{
|
||||||
AppNamespace: &app.ObjectMeta.Namespace,
|
Chunk: &application.FileChunk{
|
||||||
Name: &app.ObjectMeta.Name,
|
Chunk: yamlBytes,
|
||||||
}, appCl)
|
},
|
||||||
|
}
|
||||||
|
if err := cl.Send(&application.ApplicationManifestQueryWithFilesWrapper{
|
||||||
|
Part: chunk,
|
||||||
|
}); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
rawManifest, err := cl.CloseAndRecv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
for _, m := range rawManifest.Manifests {
|
||||||
_, err = appCl.Delete(ctx, &application.ApplicationDeleteRequest{
|
resources += fmt.Sprintf("---\n%s\n", m)
|
||||||
Name: app.GetMetadata().Name,
|
|
||||||
AppNamespace: &app.ObjectMeta.Namespace,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
}
|
||||||
resources += output
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user