test the build

This commit is contained in:
2024-07-03 00:09:11 +02:00
parent 2b1dec7e52
commit 9d30b49396
4 changed files with 47 additions and 19 deletions

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
}
}
}