diff --git a/Makefile b/Makefile index a3e8a8f03..33f6f2e78 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=v0.1.18 +VERSION=v0.1.19 OUT_DIR=dist YEAR?=$(shell date +"%Y") diff --git a/cmd/commands/runtime_install.go b/cmd/commands/runtime_install.go index 9d5daa561..d2646a3b2 100644 --- a/cmd/commands/runtime_install.go +++ b/cmd/commands/runtime_install.go @@ -47,6 +47,7 @@ import ( apcmd "github.com/argoproj-labs/argocd-autopilot/cmd/commands" "github.com/argoproj-labs/argocd-autopilot/pkg/application" "github.com/argoproj-labs/argocd-autopilot/pkg/fs" + "github.com/argoproj-labs/argocd-autopilot/pkg/git" apgit "github.com/argoproj-labs/argocd-autopilot/pkg/git" "github.com/argoproj-labs/argocd-autopilot/pkg/kube" apstore "github.com/argoproj-labs/argocd-autopilot/pkg/store" @@ -693,6 +694,11 @@ func runRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error { return util.DecorateErrorWithDocsLink(fmt.Errorf("failed to bootstrap repository: %w", err)) } + err = patchClusterResourcesAppSet(ctx, opts.InsCloneOpts) + if err != nil { + return util.DecorateErrorWithDocsLink(fmt.Errorf("failed to patch cluster-resources ApplicationSet: %w", err)) + } + err = oc.PrepareOpenshiftCluster(ctx, &oc.OpenshiftOptions{ KubeFactory: opts.KubeFactory, RuntimeName: opts.RuntimeName, @@ -2146,3 +2152,27 @@ func getRuntimeDef(runtimeDef, version string) string { } return strings.Replace(runtimeDef, "stable", version, 1) } + +func patchClusterResourcesAppSet(ctx context.Context, cloneOpts *git.CloneOptions) error { + r, fs, err := cloneOpts.GetRepo(ctx) + if err != nil { + return err + } + + appSet := &argocdv1alpha1.ApplicationSet{} + name := store.Get().ClusterResourcesPath + if err := fs.ReadYamls(name, appSet); err != nil { + return err + } + + if appSet.ObjectMeta.Labels == nil { + appSet.ObjectMeta.Labels = make(map[string]string) + } + + appSet.ObjectMeta.Labels[store.Get().LabelKeyCFInternal] = "true" + if err = fs.WriteYamls(name, appSet); err != nil { + return err + } + + return apu.PushWithMessage(ctx, r, "patch cluster-resources ApplicationSet") +} diff --git a/docs/releases/release_notes.md b/docs/releases/release_notes.md index 1a984b2e8..f26d161a9 100644 --- a/docs/releases/release_notes.md +++ b/docs/releases/release_notes.md @@ -23,7 +23,7 @@ cf version ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.18/cf-linux-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.19/cf-linux-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-linux-amd64 /usr/local/bin/cf @@ -36,7 +36,7 @@ cf version ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.18/cf-darwin-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.19/cf-darwin-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-darwin-amd64 /usr/local/bin/cf diff --git a/pkg/store/store.go b/pkg/store/store.go index fae5e4239..6ba2e1c48 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -147,6 +147,7 @@ type Store struct { MinKubeVersion string MaxKubeVersion string MasterIngressName string + ClusterResourcesPath string InClusterPath string SccName string CFInternalGitSources []string @@ -265,6 +266,7 @@ func init() { s.MinKubeVersion = "v1.21.0" s.MaxKubeVersion = "v1.25.0" s.MasterIngressName = "-master" + s.ClusterResourcesPath = "/bootstrap/cluster-resources.yaml" s.InClusterPath = "/bootstrap/cluster-resources/in-cluster" s.SccName = "cf-scc" s.CFInternalGitSources = []string{s.MarketplaceGitSourceName} diff --git a/pkg/util/aputil/aputil.go b/pkg/util/aputil/aputil.go index 6d821132e..c71b68b89 100644 --- a/pkg/util/aputil/aputil.go +++ b/pkg/util/aputil/aputil.go @@ -60,16 +60,12 @@ func AddCloneFlags(cmd *cobra.Command, o *CloneFlagsOptions) *git.CloneOptions { return opts } -func PushWithMessage(ctx context.Context, r git.Repository, msg string, progress ...io.Writer) error { +func PushWithMessage(ctx context.Context, r git.Repository, msg string) error { var ( err error prog io.Writer ) - if len(progress) > 0 { - prog = progress[0] - } - for try := 0; try < pushRetries; try++ { _, err = r.Persist(ctx, &git.PushOptions{ AddGlobPattern: ".",