test the build

This commit is contained in:
Nikolai Rodionov 2024-07-03 00:09:11 +02:00
parent 2b1dec7e52
commit 9d30b49396
Signed by: allanger
GPG Key ID: 0AA46A90E25592AD
4 changed files with 47 additions and 19 deletions

29
.woodpecker.yaml Normal file
View 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

View File

@ -89,7 +89,8 @@ spec:
args:
- --leader-elect
- --health-probe-bind-address=:8081
image: controller:latest
# image: controller:latest
image: git.badhouseplants.net/allanger/gitops-diff-operator:latest
name: manager
env:
- name: SSH_KNOWN_HOSTS

View File

@ -11,6 +11,7 @@ require (
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.29.6
k8s.io/apiextensions-apiserver v0.29.6
k8s.io/apimachinery 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/warnings.v0 v0.1.2 // 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/cli-runtime v0.29.6 // indirect
k8s.io/component-base v0.29.6 // indirect

View File

@ -93,7 +93,7 @@ func (r *DiffReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
client, err := apiclient.NewClient(&argocdclient.ClientOptions{
ServerAddr: "argocd-server.argo-system.svc.cluster.local:80",
Insecure: true,
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJhbGljZTphcGlLZXkiLCJuYmYiOjE3MTk5MzIwOTEsImlhdCI6MTcxOTkzMjA5MSwianRpIjoiN2VmM2Y2OTYtYjU4Zi00NDIyLTk4YTktNjFlYjMyNjNhNDUxIn0.XmQThdSp_WWUbWv6Ur95URqXnY9-LCXxmcun9kBoYTQ",
AuthToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmdvY2QiLCJzdWIiOiJkcm9uZTphcGlLZXkiLCJuYmYiOjE3MTk5NTc1OTMsImlhdCI6MTcxOTk1NzU5MywianRpIjoidGVzdC1kaWZmIn0.eJ-MOONUca0JEtoQlfNFdV_U-dULjyg37u8jrc2boYc",
})
if err != nil {
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.Spec.SyncPolicy = &argoappv1.SyncPolicy{}
app, err := appCl.Create(ctx, &application.ApplicationCreateRequest{
Application: app,
})
cl, err := appCl.GetManifestsWithFiles(ctx)
if err != nil {
return "", err
}
output, err := getManifestsFromArgo(ctx, application.ApplicationManifestQuery{
AppNamespace: &app.ObjectMeta.Namespace,
Name: &app.ObjectMeta.Name,
}, appCl)
chunk := &application.ApplicationManifestQueryWithFilesWrapper_Chunk{
Chunk: &application.FileChunk{
Chunk: yamlBytes,
},
}
if err := cl.Send(&application.ApplicationManifestQueryWithFilesWrapper{
Part: chunk,
}); err != nil {
return "", err
}
rawManifest, err := cl.CloseAndRecv()
if err != nil {
return "", err
}
_, err = appCl.Delete(ctx, &application.ApplicationDeleteRequest{
Name: app.GetMetadata().Name,
AppNamespace: &app.ObjectMeta.Namespace,
})
if err != nil {
return "", err
for _, m := range rawManifest.Manifests {
resources += fmt.Sprintf("---\n%s\n", m)
}
resources += output
}
}
}