argo-cd/controller/sync.go

642 lines
24 KiB
Go
Raw Normal View History

package controller
import (
"context"
stderrors "errors"
"fmt"
"os"
"strconv"
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
"strings"
"time"
"k8s.io/apimachinery/pkg/util/strategicpatch"
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
cdcommon "github.com/argoproj/argo-cd/v3/common"
gitopsDiff "github.com/argoproj/gitops-engine/pkg/diff"
"github.com/argoproj/gitops-engine/pkg/sync"
"github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/argoproj/gitops-engine/pkg/utils/kube"
jsonpatch "github.com/evanphx/json-patch"
log "github.com/sirupsen/logrus"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
2022-05-31 17:21:22 +00:00
"k8s.io/apimachinery/pkg/util/managedfields"
"k8s.io/client-go/kubernetes/scheme"
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
"k8s.io/client-go/rest"
"k8s.io/kubectl/pkg/util/openapi"
"github.com/argoproj/argo-cd/v3/controller/metrics"
"github.com/argoproj/argo-cd/v3/controller/syncid"
"github.com/argoproj/argo-cd/v3/pkg/apis/application/v1alpha1"
listersv1alpha1 "github.com/argoproj/argo-cd/v3/pkg/client/listers/application/v1alpha1"
applog "github.com/argoproj/argo-cd/v3/util/app/log"
"github.com/argoproj/argo-cd/v3/util/argo"
"github.com/argoproj/argo-cd/v3/util/argo/diff"
"github.com/argoproj/argo-cd/v3/util/glob"
kubeutil "github.com/argoproj/argo-cd/v3/util/kube"
logutils "github.com/argoproj/argo-cd/v3/util/log"
"github.com/argoproj/argo-cd/v3/util/lua"
)
const (
// EnvVarSyncWaveDelay is an environment variable which controls the delay in seconds between
// each sync-wave
EnvVarSyncWaveDelay = "ARGOCD_SYNC_WAVE_DELAY"
chore: Added unit tests and fix e2e tests for application sync decoupling feature (#19966) * fixed doc comments and added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added comments for the newly added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Refactored method name to deriveServiceAccountToImpersonate Signed-off-by: anandf <anjoseph@redhat.com> * Using const name in return value Signed-off-by: anandf <anjoseph@redhat.com> * Added unit tests for argocd proj add-destination-service-accounts Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing e2e tests Signed-off-by: anandf <anjoseph@redhat.com> * Fix linting errors Signed-off-by: anandf <anjoseph@redhat.com> * Using require package instead of assert and fixed code generation Signed-off-by: anandf <anjoseph@redhat.com> * Removed parallel execution of tests for sync with impersonate Signed-off-by: anandf <anjoseph@redhat.com> * Added err checks for glob validations Signed-off-by: anandf <anjoseph@redhat.com> * Fixed e2e tests for sync impersonation Signed-off-by: anandf <anjoseph@redhat.com> * Using consistently based expects in E2E tests Signed-off-by: anandf <anjoseph@redhat.com> * Added more unit tests and fixed go generate Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failed lint errors, unit and e2e test failures Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports linter issue Signed-off-by: anandf <anjoseph@redhat.com> * Added code comments and added few missing unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added missing unit test for GetDestinationServiceAccounts method Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports formatting with local for project_test.go Signed-off-by: anandf <anjoseph@redhat.com> * Corrected typo in a field name additionalObjs Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing unit tests Signed-off-by: anandf <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com>
2024-10-03 14:37:50 +00:00
// serviceAccountDisallowedCharSet contains the characters that are not allowed to be present
// in a DefaultServiceAccount configured for a DestinationServiceAccount
serviceAccountDisallowedCharSet = "!*[]{}\\/"
)
func (m *appStateManager) getOpenAPISchema(server *v1alpha1.Cluster) (openapi.Resources, error) {
cluster, err := m.liveStateCache.GetClusterCache(server)
if err != nil {
return nil, err
}
return cluster.GetOpenAPISchema(), nil
}
func (m *appStateManager) getGVKParser(server *v1alpha1.Cluster) (*managedfields.GvkParser, error) {
2022-05-31 17:21:22 +00:00
cluster, err := m.liveStateCache.GetClusterCache(server)
if err != nil {
return nil, err
}
return cluster.GetGVKParser(), nil
}
// getServerSideDiffDryRunApplier will return the kubectl implementation of the KubeApplier
// interface that provides functionality to dry run apply kubernetes resources. Returns a
feat: Implement Server-Side Diff (#13663) * feat: Implement Server-Side Diff Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * propagate the refreshtype to the diff config Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Create the serverSideDiff config Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * chore: add featureflag utility package Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * remove featureflag package Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * add param Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * make ssd configurable with app annotation Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * add server-side-diff flags Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * apply the same logic regardless of the refresh type Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * fix gitops-engine reference Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * docs: add docs related to server-side-diff Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * docs: update doc Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Add config to include mutation webhooks Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * go mod update Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Add sdd cache test case Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * fix ssd cache unit test Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Update clidocs Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * update manifests Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Fix procfile Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * additional doc changes Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * update gitops-engine version Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> --------- Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2023-12-18 20:37:13 +00:00
// cleanup function that must be called to remove the generated kube config for this
// server.
func (m *appStateManager) getServerSideDiffDryRunApplier(cluster *v1alpha1.Cluster) (gitopsDiff.KubeApplier, func(), error) {
clusterCache, err := m.liveStateCache.GetClusterCache(cluster)
feat: Implement Server-Side Diff (#13663) * feat: Implement Server-Side Diff Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * propagate the refreshtype to the diff config Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Create the serverSideDiff config Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * chore: add featureflag utility package Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * remove featureflag package Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * add param Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * make ssd configurable with app annotation Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * add server-side-diff flags Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * apply the same logic regardless of the refresh type Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * fix gitops-engine reference Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * docs: add docs related to server-side-diff Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * docs: update doc Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Add config to include mutation webhooks Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * go mod update Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Add sdd cache test case Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * fix ssd cache unit test Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Update clidocs Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * update manifests Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Fix procfile Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * additional doc changes Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * update gitops-engine version Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> --------- Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2023-12-18 20:37:13 +00:00
if err != nil {
return nil, nil, fmt.Errorf("error getting cluster cache: %w", err)
}
rawConfig, err := cluster.RawRestConfig()
if err != nil {
return nil, nil, fmt.Errorf("error getting cluster REST config: %w", err)
}
ops, cleanup, err := kubeutil.ManageServerSideDiffDryRuns(rawConfig, clusterCache.GetOpenAPISchema(), m.onKubectlRun)
feat: Implement Server-Side Diff (#13663) * feat: Implement Server-Side Diff Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * propagate the refreshtype to the diff config Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Create the serverSideDiff config Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * chore: add featureflag utility package Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * remove featureflag package Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * add param Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * make ssd configurable with app annotation Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * add server-side-diff flags Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * apply the same logic regardless of the refresh type Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * fix gitops-engine reference Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * docs: add docs related to server-side-diff Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * docs: update doc Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Add config to include mutation webhooks Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Address review comments Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * go mod update Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Add sdd cache test case Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * fix ssd cache unit test Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Update clidocs Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * update manifests Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * Fix procfile Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * additional doc changes Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> * update gitops-engine version Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> --------- Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2023-12-18 20:37:13 +00:00
if err != nil {
return nil, nil, fmt.Errorf("error creating kubectl ResourceOperations: %w", err)
}
return ops, cleanup, nil
}
2019-06-05 01:17:41 +00:00
func (m *appStateManager) SyncAppState(app *v1alpha1.Application, state *v1alpha1.OperationState) {
// Sync requests might be requested with ambiguous revisions (e.g. master, HEAD, v1.2.3).
// This can change meaning when resuming operations (e.g a hook sync). After calculating a
// concrete git commit SHA, the SHA is remembered in the status.operationState.syncResult field.
// This ensures that when resuming an operation, we sync to the same revision that we initially
// started with.
var revision string
2019-06-05 01:17:41 +00:00
var syncOp v1alpha1.SyncOperation
var syncRes *v1alpha1.SyncOperationResult
var source v1alpha1.ApplicationSource
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
var sources []v1alpha1.ApplicationSource
revisions := make([]string, 0)
if state.Operation.Sync == nil {
state.Phase = common.OperationFailed
state.Message = "Invalid operation request: no operation specified"
return
}
syncOp = *state.Operation.Sync
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
isMultiSourceRevision := app.Spec.HasMultipleSources()
rollback := len(syncOp.Sources) > 0 || syncOp.Source != nil
if rollback {
// rollback case
if len(state.Operation.Sync.Sources) > 0 {
sources = state.Operation.Sync.Sources
isMultiSourceRevision = true
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
} else {
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
source = *state.Operation.Sync.Source
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
sources = make([]v1alpha1.ApplicationSource, 0)
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
isMultiSourceRevision = false
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
}
} else {
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
// normal sync case (where source is taken from app.spec.sources)
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
if app.Spec.HasMultipleSources() {
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
sources = app.Spec.Sources
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
} else {
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
// normal sync case (where source is taken from app.spec.source)
source = app.Spec.GetSource()
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
sources = make([]v1alpha1.ApplicationSource, 0)
}
}
if state.SyncResult != nil {
syncRes = state.SyncResult
revision = state.SyncResult.Revision
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
revisions = append(revisions, state.SyncResult.Revisions...)
} else {
2019-06-05 01:17:41 +00:00
syncRes = &v1alpha1.SyncOperationResult{}
// status.operationState.syncResult.source. must be set properly since auto-sync relies
// on this information to decide if it should sync (if source is different than the last
// sync attempt)
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
if isMultiSourceRevision {
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
syncRes.Sources = sources
} else {
syncRes.Source = source
}
state.SyncResult = syncRes
}
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
// if we get here, it means we did not remember a commit SHA which we should be syncing to.
// This typically indicates we are just about to begin a brand new sync/rollback operation.
// Take the value in the requested operation. We will resolve this to a SHA later.
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
if isMultiSourceRevision {
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
if len(revisions) != len(sources) {
revisions = syncOp.Revisions
}
} else {
if revision == "" {
revision = syncOp.Revision
}
}
proj, err := argo.GetAppProject(context.TODO(), app, listersv1alpha1.NewAppProjectLister(m.projInformer.GetIndexer()), m.namespace, m.settingsMgr, m.db)
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("Failed to load application project: %v", err)
return
} else {
isBlocked, err := syncWindowPreventsSync(app, proj)
if isBlocked {
// If the operation is currently running, simply let the user know the sync is blocked by a current sync window
if state.Phase == common.OperationRunning {
state.Message = "Sync operation blocked by sync window"
if err != nil {
state.Message = fmt.Sprintf("%s: %v", state.Message, err)
}
}
return
}
}
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
if !isMultiSourceRevision {
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
sources = []v1alpha1.ApplicationSource{source}
revisions = []string{revision}
}
// ignore error if CompareStateRepoError, this shouldn't happen as noRevisionCache is true
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
compareResult, err := m.CompareAppState(app, proj, revisions, sources, false, true, syncOp.Manifests, isMultiSourceRevision, rollback)
if err != nil && !stderrors.Is(err, ErrCompareStateRepo) {
state.Phase = common.OperationError
state.Message = err.Error()
return
}
// We now have a concrete commit SHA. Save this in the sync result revision so that we remember
// what we should be syncing to when resuming operations.
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
syncRes.Revision = compareResult.syncStatus.Revision
feat: Multiple sources for applications (#2789) (#10432) * feat: support multiple sources for application Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove debug logging and unwanted code Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix lint and unit test errors Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix bug introduced after rebase Signed-off-by: ishitasequeira <ishiseq29@gmail.com> executed make codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> remove unwanted logging Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix ci failures Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix index out of bounds error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * ui fixes Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add revisions to SyncOperation for rollback Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update multiple sources doc Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * path resolution tests (#12) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> do things in better ways Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> consolidate Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add webhook tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> change Source to *ApplicationSource in ApplicationSpec Signed-off-by: ishitasequeira <ishiseq29@gmail.com> address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Retrigger CI pipeline Signed-off-by: ishitasequeira <ishiseq29@gmail.com> rebased with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix env variable read logic for ValueFiles Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Address PR comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add repository lock and checkout target revision Signed-off-by: ishitasequeira <ishiseq29@gmail.com> fix codegen Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * checkout all sources before generating manifest Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * generate mock reposerverclient Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * address comments Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update logic for returning ManifestResponse to avoid nil pointer issues Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix nil reference and key mismatch bugs; add more logs (#6) * fix nil reference and key mismatch bugs; add more logs * remove temporary comment * addressed the lint failure and added chart to RefTargeRevisionMapping * normalize git repo (#7) * do not leak lock releases * prevent deadlock * allow spec update * move settings fetch outside loop * cache busing * return err instead of logging it * no caching in test * fix cache key marshaling Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update grpc field numbers Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add regex check for value of source.ref Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * Added unit tests (#15) * add unit tests 1 * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix application parameters tab, rebased UI changes, tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * More tests (#16) * more tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> fix lint error Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Test get ref sources (#17) * test GetRefSources Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix lint Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: ishitasequeira <ishiseq29@gmail.com> GenerateManifests test (#18) * GenerateManifests test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Fix broken tests (#19) * fix broken tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Symlink test (#20) * check referenced sources for out-of-bounds symlinks Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * unlock the values file repo before doing a symlink check (#22) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * multi source docs (#21) * multi source docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix warning title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * add e2e tests for multiple sources and fix UI lint (#23) * add e2e tests for multiple sources and fix UI lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add auto-sync and hard refresh to e2e tests Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * change refresh type to RefreshTypeNormal for e2e Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * update e2e testcase with helm data Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add TestMultiSourceAppWithSourceOverride Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * add missing yaml file Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * rebase with master Signed-off-by: ishitasequeira <ishiseq29@gmail.com> * fix lint Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: ishitasequeira <ishiseq29@gmail.com> Signed-off-by: Michael Crenshaw <michael@crenshaw.dev> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2022-12-16 20:47:08 +00:00
syncRes.Revisions = compareResult.syncStatus.Revisions
// validates if it should fail the sync if it finds shared resources
hasSharedResource, sharedResourceMessage := hasSharedResourceCondition(app)
if syncOp.SyncOptions.HasOption("FailOnSharedResource=true") &&
hasSharedResource {
state.Phase = common.OperationFailed
state.Message = "Shared resource found: %s" + sharedResourceMessage
return
}
// If there are any comparison or spec errors error conditions do not perform the operation
if errConditions := app.Status.GetConditions(map[v1alpha1.ApplicationConditionType]bool{
v1alpha1.ApplicationConditionComparisonError: true,
v1alpha1.ApplicationConditionInvalidSpecError: true,
}); len(errConditions) > 0 {
state.Phase = common.OperationError
state.Message = argo.FormatAppConditions(errConditions)
return
}
destCluster, err := argo.GetDestinationCluster(context.Background(), app.Spec.Destination, m.db)
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("Failed to get destination cluster: %v", err)
return
}
rawConfig, err := destCluster.RawRestConfig()
if err != nil {
state.Phase = common.OperationError
state.Message = err.Error()
return
}
clusterRESTConfig, err := destCluster.RESTConfig()
if err != nil {
state.Phase = common.OperationError
state.Message = err.Error()
return
}
restConfig := metrics.AddMetricsTransportWrapper(m.metricsServer, app, clusterRESTConfig)
resourceOverrides, err := m.settingsMgr.GetResourceOverrides()
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("Failed to load resource overrides: %v", err)
return
}
syncId, err := syncid.Generate()
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("Failed to generate sync ID: %v", err)
return
}
logEntry := log.WithFields(applog.GetAppLogFields(app)).WithField("syncId", syncId)
initialResourcesRes := make([]common.ResourceSyncResult, len(syncRes.Resources))
for i, res := range syncRes.Resources {
key := kube.ResourceKey{Group: res.Group, Kind: res.Kind, Namespace: res.Namespace, Name: res.Name}
initialResourcesRes[i] = common.ResourceSyncResult{
ResourceKey: key,
Message: res.Message,
Status: res.Status,
HookPhase: res.HookPhase,
HookType: res.HookType,
SyncPhase: res.SyncPhase,
Version: res.Version,
Images: res.Images,
Order: i + 1,
}
}
prunePropagationPolicy := metav1.DeletePropagationForeground
switch {
case syncOp.SyncOptions.HasOption("PrunePropagationPolicy=background"):
prunePropagationPolicy = metav1.DeletePropagationBackground
case syncOp.SyncOptions.HasOption("PrunePropagationPolicy=foreground"):
prunePropagationPolicy = metav1.DeletePropagationForeground
case syncOp.SyncOptions.HasOption("PrunePropagationPolicy=orphan"):
prunePropagationPolicy = metav1.DeletePropagationOrphan
}
clientSideApplyManager := common.DefaultClientSideApplyMigrationManager
// Check for custom field manager from application annotation
if managerValue := app.GetAnnotation(cdcommon.AnnotationClientSideApplyMigrationManager); managerValue != "" {
clientSideApplyManager = managerValue
}
openAPISchema, err := m.getOpenAPISchema(destCluster)
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("failed to load openAPISchema: %v", err)
return
}
reconciliationResult := compareResult.reconciliationResult
// if RespectIgnoreDifferences is enabled, it should normalize the target
// resources which in this case applies the live values in the configured
// ignore differences fields.
if syncOp.SyncOptions.HasOption("RespectIgnoreDifferences=true") {
patchedTargets, err := normalizeTargetResources(compareResult)
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("Failed to normalize target resources: %s", err)
return
}
reconciliationResult.Target = patchedTargets
}
installationID, err := m.settingsMgr.GetInstallationID()
if err != nil {
log.Errorf("Could not get installation ID: %v", err)
return
}
trackingMethod, err := m.settingsMgr.GetTrackingMethod()
if err != nil {
log.Errorf("Could not get trackingMethod: %v", err)
return
}
chore: Added unit tests and fix e2e tests for application sync decoupling feature (#19966) * fixed doc comments and added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added comments for the newly added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Refactored method name to deriveServiceAccountToImpersonate Signed-off-by: anandf <anjoseph@redhat.com> * Using const name in return value Signed-off-by: anandf <anjoseph@redhat.com> * Added unit tests for argocd proj add-destination-service-accounts Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing e2e tests Signed-off-by: anandf <anjoseph@redhat.com> * Fix linting errors Signed-off-by: anandf <anjoseph@redhat.com> * Using require package instead of assert and fixed code generation Signed-off-by: anandf <anjoseph@redhat.com> * Removed parallel execution of tests for sync with impersonate Signed-off-by: anandf <anjoseph@redhat.com> * Added err checks for glob validations Signed-off-by: anandf <anjoseph@redhat.com> * Fixed e2e tests for sync impersonation Signed-off-by: anandf <anjoseph@redhat.com> * Using consistently based expects in E2E tests Signed-off-by: anandf <anjoseph@redhat.com> * Added more unit tests and fixed go generate Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failed lint errors, unit and e2e test failures Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports linter issue Signed-off-by: anandf <anjoseph@redhat.com> * Added code comments and added few missing unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added missing unit test for GetDestinationServiceAccounts method Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports formatting with local for project_test.go Signed-off-by: anandf <anjoseph@redhat.com> * Corrected typo in a field name additionalObjs Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing unit tests Signed-off-by: anandf <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com>
2024-10-03 14:37:50 +00:00
impersonationEnabled, err := m.settingsMgr.IsImpersonationEnabled()
if err != nil {
log.Errorf("could not get impersonation feature flag: %v", err)
return
}
if impersonationEnabled {
serviceAccountToImpersonate, err := deriveServiceAccountToImpersonate(proj, app, destCluster)
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("failed to find a matching service account to impersonate: %v", err)
return
}
logEntry = logEntry.WithFields(log.Fields{"impersonationEnabled": "true", "serviceAccount": serviceAccountToImpersonate})
// set the impersonation headers.
rawConfig.Impersonate = rest.ImpersonationConfig{
UserName: serviceAccountToImpersonate,
}
restConfig.Impersonate = rest.ImpersonationConfig{
UserName: serviceAccountToImpersonate,
}
}
feat: enable metadata to be set on namespaces (#10672) * namespace labels Signed-off-by: pashavictorovich <pavel@codefresh.io> * create namespace should support annotations Signed-off-by: pashavictorovich <pavel@codefresh.io> * handle also modification hook Signed-off-by: pashavictorovich <pavel@codefresh.io> * regenerate entity on modify hook Signed-off-by: pashavictorovich <pavel@codefresh.io> * manifests Signed-off-by: pashavictorovich <pavel@codefresh.io> * feat: enable metadata to be set on namespaces This builds upon the work that @pasha-codefresh did in #10288. The main differences between this PR and the previous one is that we use SSA to diff between different versions of the namespace, as well as having a slightly different API in gitops-engine for setting the namespace modifier. We now also set the ownership of the namespace in ArgoCD. Closes #4628 Closes #6215 Closes #7799 Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: don't always track namespaces For now, only allow namespaces managed with `managedNamespaceMetadata` to have tracking set by Argo. Ideally we'd like new namespaces to also be tracked by Argo, but there's currently an issue with a failing integration test. Also wrap error message if setting the app instance errors on the namespace. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: always return true with `hasManagedMetadata` If `hasManagedMetadata` is set, `true` should always be returned. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * docs: add clarifying docs on resource tracking Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * style: pr tweaks Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: re-add label unsetting Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * Update gitops-engine to current master Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> Signed-off-by: pashavictorovich <pavel@codefresh.io> Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> Co-authored-by: pashavictorovich <pavel@codefresh.io> Co-authored-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2022-11-04 12:59:16 +00:00
opts := []sync.SyncOpt{
sync.WithLogr(logutils.NewLogrusLogger(logEntry)),
sync.WithHealthOverride(lua.ResourceHealthOverrides(resourceOverrides)),
sync.WithPermissionValidator(func(un *unstructured.Unstructured, res *metav1.APIResource) error {
if !proj.IsGroupKindPermitted(un.GroupVersionKind().GroupKind(), res.Namespaced) {
return fmt.Errorf("resource %s:%s is not permitted in project %s", un.GroupVersionKind().Group, un.GroupVersionKind().Kind, proj.Name)
2019-06-05 01:17:41 +00:00
}
if res.Namespaced {
permitted, err := proj.IsDestinationPermitted(destCluster, un.GetNamespace(), func(project string) ([]*v1alpha1.Cluster, error) {
return m.db.GetProjectClusters(context.TODO(), project)
})
if err != nil {
return err
}
if !permitted {
return fmt.Errorf("namespace %v is not permitted in project '%s'", un.GetNamespace(), proj.Name)
}
}
return nil
}),
sync.WithOperationSettings(syncOp.DryRun, syncOp.Prune, syncOp.SyncStrategy.Force(), syncOp.IsApplyStrategy() || len(syncOp.Resources) > 0),
sync.WithInitialState(state.Phase, state.Message, initialResourcesRes, state.StartedAt),
sync.WithResourcesFilter(func(key kube.ResourceKey, target *unstructured.Unstructured, live *unstructured.Unstructured) bool {
return (len(syncOp.Resources) == 0 ||
isPostDeleteHook(target) ||
argo.ContainsSyncResource(key.Name, key.Namespace, schema.GroupVersionKind{Kind: key.Kind, Group: key.Group}, syncOp.Resources)) &&
m.isSelfReferencedObj(live, target, app.GetName(), v1alpha1.TrackingMethod(trackingMethod), installationID)
}),
sync.WithManifestValidation(!syncOp.SyncOptions.HasOption(common.SyncOptionsDisableValidation)),
sync.WithSyncWaveHook(delayBetweenSyncWaves),
sync.WithPruneLast(syncOp.SyncOptions.HasOption(common.SyncOptionPruneLast)),
sync.WithResourceModificationChecker(syncOp.SyncOptions.HasOption("ApplyOutOfSyncOnly=true"), compareResult.diffResultList),
sync.WithPrunePropagationPolicy(&prunePropagationPolicy),
sync.WithReplace(syncOp.SyncOptions.HasOption(common.SyncOptionReplace)),
sync.WithServerSideApply(syncOp.SyncOptions.HasOption(common.SyncOptionServerSideApply)),
sync.WithServerSideApplyManager(cdcommon.ArgoCDSSAManager),
sync.WithClientSideApplyMigration(
!syncOp.SyncOptions.HasOption(common.SyncOptionDisableClientSideApplyMigration),
clientSideApplyManager,
),
sync.WithPruneConfirmed(app.IsDeletionConfirmed(state.StartedAt.Time)),
sync.WithSkipDryRunOnMissingResource(syncOp.SyncOptions.HasOption(common.SyncOptionSkipDryRunOnMissingResource)),
feat: enable metadata to be set on namespaces (#10672) * namespace labels Signed-off-by: pashavictorovich <pavel@codefresh.io> * create namespace should support annotations Signed-off-by: pashavictorovich <pavel@codefresh.io> * handle also modification hook Signed-off-by: pashavictorovich <pavel@codefresh.io> * regenerate entity on modify hook Signed-off-by: pashavictorovich <pavel@codefresh.io> * manifests Signed-off-by: pashavictorovich <pavel@codefresh.io> * feat: enable metadata to be set on namespaces This builds upon the work that @pasha-codefresh did in #10288. The main differences between this PR and the previous one is that we use SSA to diff between different versions of the namespace, as well as having a slightly different API in gitops-engine for setting the namespace modifier. We now also set the ownership of the namespace in ArgoCD. Closes #4628 Closes #6215 Closes #7799 Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: don't always track namespaces For now, only allow namespaces managed with `managedNamespaceMetadata` to have tracking set by Argo. Ideally we'd like new namespaces to also be tracked by Argo, but there's currently an issue with a failing integration test. Also wrap error message if setting the app instance errors on the namespace. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: always return true with `hasManagedMetadata` If `hasManagedMetadata` is set, `true` should always be returned. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * docs: add clarifying docs on resource tracking Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * style: pr tweaks Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: re-add label unsetting Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * Update gitops-engine to current master Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> Signed-off-by: pashavictorovich <pavel@codefresh.io> Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> Co-authored-by: pashavictorovich <pavel@codefresh.io> Co-authored-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2022-11-04 12:59:16 +00:00
}
if syncOp.SyncOptions.HasOption("CreateNamespace=true") {
opts = append(opts, sync.WithNamespaceModifier(syncNamespace(app.Spec.SyncPolicy)))
feat: enable metadata to be set on namespaces (#10672) * namespace labels Signed-off-by: pashavictorovich <pavel@codefresh.io> * create namespace should support annotations Signed-off-by: pashavictorovich <pavel@codefresh.io> * handle also modification hook Signed-off-by: pashavictorovich <pavel@codefresh.io> * regenerate entity on modify hook Signed-off-by: pashavictorovich <pavel@codefresh.io> * manifests Signed-off-by: pashavictorovich <pavel@codefresh.io> * feat: enable metadata to be set on namespaces This builds upon the work that @pasha-codefresh did in #10288. The main differences between this PR and the previous one is that we use SSA to diff between different versions of the namespace, as well as having a slightly different API in gitops-engine for setting the namespace modifier. We now also set the ownership of the namespace in ArgoCD. Closes #4628 Closes #6215 Closes #7799 Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: don't always track namespaces For now, only allow namespaces managed with `managedNamespaceMetadata` to have tracking set by Argo. Ideally we'd like new namespaces to also be tracked by Argo, but there's currently an issue with a failing integration test. Also wrap error message if setting the app instance errors on the namespace. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: always return true with `hasManagedMetadata` If `hasManagedMetadata` is set, `true` should always be returned. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * docs: add clarifying docs on resource tracking Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * style: pr tweaks Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: re-add label unsetting Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * Update gitops-engine to current master Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> Signed-off-by: pashavictorovich <pavel@codefresh.io> Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> Signed-off-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com> Co-authored-by: pashavictorovich <pavel@codefresh.io> Co-authored-by: Leonardo Luz Almeida <leonardo_almeida@intuit.com>
2022-11-04 12:59:16 +00:00
}
syncCtx, cleanup, err := sync.NewSyncContext(
compareResult.syncStatus.Revision,
reconciliationResult,
restConfig,
rawConfig,
m.kubectl,
app.Spec.Destination.Namespace,
openAPISchema,
opts...,
)
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("failed to initialize sync context: %v", err)
return
}
defer cleanup()
start := time.Now()
if state.Phase == common.OperationTerminating {
syncCtx.Terminate()
2019-06-05 01:17:41 +00:00
} else {
syncCtx.Sync()
}
var resState []common.ResourceSyncResult
state.Phase, state.Message, resState = syncCtx.GetState()
state.SyncResult.Resources = nil
fix: Add more context to the sync failed message when resource kind doesn't exist (#12980) * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * improvements, maybe Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * remove unnecessary end quote Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * avoid conflicts with other tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2023-04-03 15:48:50 +00:00
fix: update managed namespace metadata (#13074) * fix: update managed namespace metadata This commit fixes an issue where a namespace does not get updated unless a sync is performed. Since the `managedNamespaceMetadata` is not a part of the Application Git state, we need a way to force a sync once the metadata has changed. In order to do that, we need to add state to compare with. Once a sync is performed, the `ManagedNamespaceMetadata` gets copied to `SyncResult`, which will then be compared with on subsequent syncs. If there's a mismatch between `app.Spec.SyncPolicy.ManagedNamespaceMetadata` and `app.Status.OperationState.SyncResult.ManagedNamespaceMetadata` we mark the Application as `OutOfSync`. Fixes #12661. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: nil check Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: allow empty apps to be updated If an app is empty but still differs in terms of `managedNamespaceMetadata`, it should still be kept up to date. Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * test: add unit tests in appcontroller Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * fix: rebase Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * refactor: extract method Consolidate checks to `app.HasChangedManagedNamespaceMetadata()` Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> * chore: make codegen Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com> --------- Signed-off-by: Blake Pettersson <blake.pettersson@gmail.com>
2023-05-19 13:55:08 +00:00
if app.Spec.SyncPolicy != nil {
state.SyncResult.ManagedNamespaceMetadata = app.Spec.SyncPolicy.ManagedNamespaceMetadata
}
fix: Add more context to the sync failed message when resource kind doesn't exist (#12980) * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * improvements, maybe Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * remove unnecessary end quote Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * avoid conflicts with other tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2023-04-03 15:48:50 +00:00
var apiVersion []kube.APIResourceInfo
for _, res := range resState {
fix: Add more context to the sync failed message when resource kind doesn't exist (#12980) * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * improvements, maybe Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * remove unnecessary end quote Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * avoid conflicts with other tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2023-04-03 15:48:50 +00:00
augmentedMsg, err := argo.AugmentSyncMsg(res, func() ([]kube.APIResourceInfo, error) {
if apiVersion == nil {
_, apiVersion, err = m.liveStateCache.GetVersionsInfo(destCluster)
fix: Add more context to the sync failed message when resource kind doesn't exist (#12980) * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * improvements, maybe Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * remove unnecessary end quote Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * avoid conflicts with other tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2023-04-03 15:48:50 +00:00
if err != nil {
return nil, fmt.Errorf("failed to get version info from the target cluster %q", destCluster.Server)
fix: Add more context to the sync failed message when resource kind doesn't exist (#12980) * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * fix: add more context to k8s message Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * Update util/argo/argo.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> * improvements, maybe Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * remove unnecessary end quote Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * avoid conflicts with other tests Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: asingh <11219262+ashutosh16@users.noreply.github.com> Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
2023-04-03 15:48:50 +00:00
}
}
return apiVersion, nil
})
if err != nil {
log.Errorf("using the original message since: %v", err)
} else {
res.Message = augmentedMsg
}
state.SyncResult.Resources = append(state.SyncResult.Resources, &v1alpha1.ResourceResult{
HookType: res.HookType,
Group: res.ResourceKey.Group,
Kind: res.ResourceKey.Kind,
Namespace: res.ResourceKey.Namespace,
Name: res.ResourceKey.Name,
Version: res.Version,
SyncPhase: res.SyncPhase,
HookPhase: res.HookPhase,
Status: res.Status,
Message: res.Message,
Images: res.Images,
})
}
logEntry.WithField("duration", time.Since(start)).Info("sync/terminate complete")
if !syncOp.DryRun && len(syncOp.Resources) == 0 && state.Phase.Successful() {
feat(application-controller): Add support for rollback multi-source applications (#14124) * feat(application-controller): Add support for rollback multi-source applications Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * regenerate codegen after rebase Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix tests Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix front linting Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update test Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * update codegen Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Update server/application/application.go Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> * apply feedback Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix errors Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add support for switching between single and multi Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix dereference issue Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * remove unnecesary code Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * Rebase master Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> * fix style Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * fix reference Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> * add a comment Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> --------- Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es> Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-06-10 21:54:07 +00:00
err := m.persistRevisionHistory(app, compareResult.syncStatus.Revision, source, compareResult.syncStatus.Revisions, compareResult.syncStatus.ComparedTo.Sources, isMultiSourceRevision, state.StartedAt, state.Operation.InitiatedBy)
if err != nil {
state.Phase = common.OperationError
state.Message = fmt.Sprintf("failed to record sync to history: %v", err)
2019-06-05 01:17:41 +00:00
}
2019-01-18 15:32:50 +00:00
}
}
// normalizeTargetResources modifies target resources to ensure ignored fields are not touched during synchronization:
// - applies normalization to the target resources based on the live resources
// - copies ignored fields from the matching live resources: apply normalizer to the live resource,
// calculates the patch performed by normalizer and applies the patch to the target resource
func normalizeTargetResources(cr *comparisonResult) ([]*unstructured.Unstructured, error) {
// normalize live and target resources
normalized, err := diff.Normalize(cr.reconciliationResult.Live, cr.reconciliationResult.Target, cr.diffConfig)
if err != nil {
return nil, err
}
patchedTargets := []*unstructured.Unstructured{}
for idx, live := range cr.reconciliationResult.Live {
normalizedTarget := normalized.Targets[idx]
if normalizedTarget == nil {
patchedTargets = append(patchedTargets, nil)
continue
}
originalTarget := cr.reconciliationResult.Target[idx]
if live == nil {
patchedTargets = append(patchedTargets, originalTarget)
continue
}
var lookupPatchMeta *strategicpatch.PatchMetaFromStruct
versionedObject, err := scheme.Scheme.New(normalizedTarget.GroupVersionKind())
if err == nil {
meta, err := strategicpatch.NewPatchMetaFromStruct(versionedObject)
if err != nil {
return nil, err
}
lookupPatchMeta = &meta
}
livePatch, err := getMergePatch(normalized.Lives[idx], live, lookupPatchMeta)
if err != nil {
return nil, err
}
normalizedTarget, err = applyMergePatch(normalizedTarget, livePatch, versionedObject)
if err != nil {
return nil, err
}
patchedTargets = append(patchedTargets, normalizedTarget)
}
return patchedTargets, nil
}
// getMergePatch calculates and returns the patch between the original and the
// modified unstructures.
func getMergePatch(original, modified *unstructured.Unstructured, lookupPatchMeta *strategicpatch.PatchMetaFromStruct) ([]byte, error) {
originalJSON, err := original.MarshalJSON()
if err != nil {
return nil, err
}
modifiedJSON, err := modified.MarshalJSON()
if err != nil {
return nil, err
}
if lookupPatchMeta != nil {
return strategicpatch.CreateThreeWayMergePatch(modifiedJSON, modifiedJSON, originalJSON, lookupPatchMeta, true)
}
return jsonpatch.CreateMergePatch(originalJSON, modifiedJSON)
}
// applyMergePatch will apply the given patch in the obj and return the patched
// unstructure.
func applyMergePatch(obj *unstructured.Unstructured, patch []byte, versionedObject any) (*unstructured.Unstructured, error) {
originalJSON, err := obj.MarshalJSON()
if err != nil {
return nil, err
}
var patchedJSON []byte
if versionedObject == nil {
patchedJSON, err = jsonpatch.MergePatch(originalJSON, patch)
} else {
patchedJSON, err = strategicpatch.StrategicMergePatch(originalJSON, patch, versionedObject)
}
if err != nil {
return nil, err
}
patchedObj := &unstructured.Unstructured{}
_, _, err = unstructured.UnstructuredJSONScheme.Decode(patchedJSON, nil, patchedObj)
if err != nil {
return nil, err
}
return patchedObj, nil
}
// hasSharedResourceCondition will check if the Application has any resource that has already
// been synced by another Application. If the resource is found in another Application it returns
// true along with a human readable message of which specific resource has this condition.
func hasSharedResourceCondition(app *v1alpha1.Application) (bool, string) {
for _, condition := range app.Status.Conditions {
if condition.Type == v1alpha1.ApplicationConditionSharedResourceWarning {
return true, condition.Message
}
}
return false, ""
}
// delayBetweenSyncWaves is a gitops-engine SyncWaveHook which introduces an artificial delay
// between each sync wave. We introduce an artificial delay in order give other controllers a
// _chance_ to react to the spec change that we just applied. This is important because without
// this, Argo CD will likely assess resource health too quickly (against the stale object), causing
// hooks to fire prematurely. See: https://github.com/argoproj/argo-cd/issues/4669.
// Note, this is not foolproof, since a proper fix would require the CRD record
// status.observedGeneration coupled with a health.lua that verifies
// status.observedGeneration == metadata.generation
func delayBetweenSyncWaves(_ common.SyncPhase, _ int, finalWave bool) error {
if !finalWave {
delaySec := 2
if delaySecStr := os.Getenv(EnvVarSyncWaveDelay); delaySecStr != "" {
if val, err := strconv.Atoi(delaySecStr); err == nil {
delaySec = val
}
}
duration := time.Duration(delaySec) * time.Second
time.Sleep(duration)
}
return nil
}
func syncWindowPreventsSync(app *v1alpha1.Application, proj *v1alpha1.AppProject) (bool, error) {
window := proj.Spec.SyncWindows.Matches(app)
isManual := false
if app.Status.OperationState != nil {
isManual = !app.Status.OperationState.Operation.InitiatedBy.Automated
}
canSync, err := window.CanSync(isManual)
if err != nil {
// prevents sync because sync window has an error
return true, err
}
return !canSync, nil
}
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
chore: Added unit tests and fix e2e tests for application sync decoupling feature (#19966) * fixed doc comments and added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added comments for the newly added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Refactored method name to deriveServiceAccountToImpersonate Signed-off-by: anandf <anjoseph@redhat.com> * Using const name in return value Signed-off-by: anandf <anjoseph@redhat.com> * Added unit tests for argocd proj add-destination-service-accounts Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing e2e tests Signed-off-by: anandf <anjoseph@redhat.com> * Fix linting errors Signed-off-by: anandf <anjoseph@redhat.com> * Using require package instead of assert and fixed code generation Signed-off-by: anandf <anjoseph@redhat.com> * Removed parallel execution of tests for sync with impersonate Signed-off-by: anandf <anjoseph@redhat.com> * Added err checks for glob validations Signed-off-by: anandf <anjoseph@redhat.com> * Fixed e2e tests for sync impersonation Signed-off-by: anandf <anjoseph@redhat.com> * Using consistently based expects in E2E tests Signed-off-by: anandf <anjoseph@redhat.com> * Added more unit tests and fixed go generate Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failed lint errors, unit and e2e test failures Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports linter issue Signed-off-by: anandf <anjoseph@redhat.com> * Added code comments and added few missing unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added missing unit test for GetDestinationServiceAccounts method Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports formatting with local for project_test.go Signed-off-by: anandf <anjoseph@redhat.com> * Corrected typo in a field name additionalObjs Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing unit tests Signed-off-by: anandf <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com>
2024-10-03 14:37:50 +00:00
// deriveServiceAccountToImpersonate determines the service account to be used for impersonation for the sync operation.
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
// The returned service account will be fully qualified including namespace and the service account name in the format system:serviceaccount:<namespace>:<service_account>
func deriveServiceAccountToImpersonate(project *v1alpha1.AppProject, application *v1alpha1.Application, destCluster *v1alpha1.Cluster) (string, error) {
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
// spec.Destination.Namespace is optional. If not specified, use the Application's
// namespace
serviceAccountNamespace := application.Spec.Destination.Namespace
if serviceAccountNamespace == "" {
serviceAccountNamespace = application.Namespace
}
// Loop through the destinationServiceAccounts and see if there is any destination that is a candidate.
// if so, return the service account specified for that destination.
for _, item := range project.Spec.DestinationServiceAccounts {
dstServerMatched, err := glob.MatchWithError(item.Server, destCluster.Server)
chore: Added unit tests and fix e2e tests for application sync decoupling feature (#19966) * fixed doc comments and added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added comments for the newly added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Refactored method name to deriveServiceAccountToImpersonate Signed-off-by: anandf <anjoseph@redhat.com> * Using const name in return value Signed-off-by: anandf <anjoseph@redhat.com> * Added unit tests for argocd proj add-destination-service-accounts Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing e2e tests Signed-off-by: anandf <anjoseph@redhat.com> * Fix linting errors Signed-off-by: anandf <anjoseph@redhat.com> * Using require package instead of assert and fixed code generation Signed-off-by: anandf <anjoseph@redhat.com> * Removed parallel execution of tests for sync with impersonate Signed-off-by: anandf <anjoseph@redhat.com> * Added err checks for glob validations Signed-off-by: anandf <anjoseph@redhat.com> * Fixed e2e tests for sync impersonation Signed-off-by: anandf <anjoseph@redhat.com> * Using consistently based expects in E2E tests Signed-off-by: anandf <anjoseph@redhat.com> * Added more unit tests and fixed go generate Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failed lint errors, unit and e2e test failures Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports linter issue Signed-off-by: anandf <anjoseph@redhat.com> * Added code comments and added few missing unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added missing unit test for GetDestinationServiceAccounts method Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports formatting with local for project_test.go Signed-off-by: anandf <anjoseph@redhat.com> * Corrected typo in a field name additionalObjs Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing unit tests Signed-off-by: anandf <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com>
2024-10-03 14:37:50 +00:00
if err != nil {
return "", fmt.Errorf("invalid glob pattern for destination server: %w", err)
}
dstNamespaceMatched, err := glob.MatchWithError(item.Namespace, application.Spec.Destination.Namespace)
if err != nil {
return "", fmt.Errorf("invalid glob pattern for destination namespace: %w", err)
}
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
if dstServerMatched && dstNamespaceMatched {
chore: Added unit tests and fix e2e tests for application sync decoupling feature (#19966) * fixed doc comments and added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added comments for the newly added unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Refactored method name to deriveServiceAccountToImpersonate Signed-off-by: anandf <anjoseph@redhat.com> * Using const name in return value Signed-off-by: anandf <anjoseph@redhat.com> * Added unit tests for argocd proj add-destination-service-accounts Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing e2e tests Signed-off-by: anandf <anjoseph@redhat.com> * Fix linting errors Signed-off-by: anandf <anjoseph@redhat.com> * Using require package instead of assert and fixed code generation Signed-off-by: anandf <anjoseph@redhat.com> * Removed parallel execution of tests for sync with impersonate Signed-off-by: anandf <anjoseph@redhat.com> * Added err checks for glob validations Signed-off-by: anandf <anjoseph@redhat.com> * Fixed e2e tests for sync impersonation Signed-off-by: anandf <anjoseph@redhat.com> * Using consistently based expects in E2E tests Signed-off-by: anandf <anjoseph@redhat.com> * Added more unit tests and fixed go generate Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failed lint errors, unit and e2e test failures Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports linter issue Signed-off-by: anandf <anjoseph@redhat.com> * Added code comments and added few missing unit tests Signed-off-by: anandf <anjoseph@redhat.com> * Added missing unit test for GetDestinationServiceAccounts method Signed-off-by: anandf <anjoseph@redhat.com> * Fixed goimports formatting with local for project_test.go Signed-off-by: anandf <anjoseph@redhat.com> * Corrected typo in a field name additionalObjs Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing unit tests Signed-off-by: anandf <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com>
2024-10-03 14:37:50 +00:00
if strings.Trim(item.DefaultServiceAccount, " ") == "" || strings.ContainsAny(item.DefaultServiceAccount, serviceAccountDisallowedCharSet) {
return "", fmt.Errorf("default service account contains invalid chars '%s'", item.DefaultServiceAccount)
} else if strings.Contains(item.DefaultServiceAccount, ":") {
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
// service account is specified along with its namespace.
return "system:serviceaccount:" + item.DefaultServiceAccount, nil
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
}
// service account needs to be prefixed with a namespace
return fmt.Sprintf("system:serviceaccount:%s:%s", serviceAccountNamespace, item.DefaultServiceAccount), nil
feat: Decoupling application sync using impersonation (#17403) * Implementation of app sync with impersonation support Signed-off-by: anandf <anjoseph@redhat.com> * negation test Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> * Update doc comments to remove server name as its not supported. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Update glob pattern check for matching destinations. Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> * Corrected the code comments for namespace field and destination matching logic Signed-off-by: anandf <anjoseph@redhat.com> * Added missing generated files Signed-off-by: anandf <anjoseph@redhat.com> * Fixed golint errors caused due to to gofumpt validations Signed-off-by: anandf <anjoseph@redhat.com> * Fix golint errors with unit test code Signed-off-by: anandf <anjoseph@redhat.com> * Updated the go import ordering with local packages at the end Signed-off-by: anandf <anjoseph@redhat.com> * Addressed review comments Signed-off-by: anandf <anjoseph@redhat.com> * Fixed ES lint error caused due to missing class Signed-off-by: anandf <anjoseph@redhat.com> * Updated the documentation to address the review comments Signed-off-by: anandf <anjoseph@redhat.com> * Simplified the sync code and improved logs and error handling Signed-off-by: anandf <anjoseph@redhat.com> * Fixed E2E tests to fail when no sa is configured Signed-off-by: anandf <anjoseph@redhat.com> * Updated help message generated for CLI commands Signed-off-by: anandf <anjoseph@redhat.com> * Fixed failing tests due to default service account not used for sync operation Signed-off-by: anandf <anjoseph@redhat.com> * Fixed the error message when sync fails due to no matching sa Signed-off-by: anandf <anjoseph@redhat.com> * Removed repeating logs and added impersonation fields to logger Signed-off-by: anandf <anjoseph@redhat.com> * Made changes in the proposal to match the behaviour when no matching sa is found Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> --------- Signed-off-by: anandf <anjoseph@redhat.com> Signed-off-by: Mangaal <angommeeteimangaal@gmail.com> Signed-off-by: Anand Francis Joseph <anandfrancis.joseph@gmail.com> Signed-off-by: Anand Francis Joseph <anjoseph@redhat.com> Co-authored-by: Mangaal <angommeeteimangaal@gmail.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com>
2024-09-04 18:18:47 +00:00
}
}
// if there is no match found in the AppProject.Spec.DestinationServiceAccounts, use the default service account of the destination namespace.
return "", fmt.Errorf("no matching service account found for destination server %s and namespace %s", application.Spec.Destination.Server, serviceAccountNamespace)
}