Skip to content

Commit

Permalink
Merge branch 'master' into badgewithname
Browse files Browse the repository at this point in the history
  • Loading branch information
todaywasawesome authored Feb 9, 2024
2 parents 11c41a0 + bb1c1ed commit f36149b
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2
id: filter
with:
# Any file which is not under docs/, ui/ or is not a markdown file is counted as a backend file
filters: |
backend:
- '!(ui/**)'
- '!(**/*.md)'
- '!(ui/**|docs/**|**.md|**/*.md)'
frontend:
- 'ui/**'
check-go:
Expand Down Expand Up @@ -466,7 +466,7 @@ jobs:
git config --global user.email "[email protected]"
- name: Pull Docker image required for tests
run: |
docker pull ghcr.io/dexidp/dex:v2.37.0
docker pull ghcr.io/dexidp/dex:v2.38.0
docker pull argoproj/argo-cd-ci-builder:v1.0.0
docker pull redis:7.0.14-alpine
- name: Create target directory for binaries in the build-process
Expand Down
1 change: 1 addition & 0 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
defer argoio.Close(conn)
cluster, err := clusterIf.Get(ctx, &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
errors.CheckError(err)

diffOption.local = local
diffOption.localRepoRoot = localRepoRoot
diffOption.cluster = cluster
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/toolchain-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ For installing the tools required to build and test Argo CD on your local system
You can change the target location by setting the `BIN` environment before running the installer scripts. For example, you can install the binaries into `~/go/bin` (which should then be the first component in your `PATH` environment, i.e. `export PATH=~/go/bin:$PATH`):
```shell
make BIN=~/go/bin install-tools-local
BIN=~/go/bin make install-tools-local
```

Additionally, you have to install at least the following tools via your OS's package manager (this list might not be always up-to-date):
Expand Down
2 changes: 1 addition & 1 deletion manifests/base/dex/argocd-dex-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
type: RuntimeDefault
containers:
- name: dex
image: ghcr.io/dexidp/dex:v2.37.0
image: ghcr.io/dexidp/dex:v2.38.0
imagePullPolicy: Always
command: [/shared/argocd-dex, rundex]
env:
Expand Down
2 changes: 1 addition & 1 deletion manifests/ha/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22496,7 +22496,7 @@ spec:
key: dexserver.disable.tls
name: argocd-cmd-params-cm
optional: true
image: ghcr.io/dexidp/dex:v2.37.0
image: ghcr.io/dexidp/dex:v2.38.0
imagePullPolicy: Always
name: dex
ports:
Expand Down
2 changes: 1 addition & 1 deletion manifests/ha/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ spec:
key: dexserver.disable.tls
name: argocd-cmd-params-cm
optional: true
image: ghcr.io/dexidp/dex:v2.37.0
image: ghcr.io/dexidp/dex:v2.38.0
imagePullPolicy: Always
name: dex
ports:
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21591,7 +21591,7 @@ spec:
key: dexserver.disable.tls
name: argocd-cmd-params-cm
optional: true
image: ghcr.io/dexidp/dex:v2.37.0
image: ghcr.io/dexidp/dex:v2.38.0
imagePullPolicy: Always
name: dex
ports:
Expand Down
2 changes: 1 addition & 1 deletion manifests/namespace-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ spec:
key: dexserver.disable.tls
name: argocd-cmd-params-cm
optional: true
image: ghcr.io/dexidp/dex:v2.37.0
image: ghcr.io/dexidp/dex:v2.38.0
imagePullPolicy: Always
name: dex
ports:
Expand Down
8 changes: 4 additions & 4 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ func GenerateManifests(ctx context.Context, appPath, repoRoot, revision string,
if q.KustomizeOptions != nil {
kustomizeBinary = q.KustomizeOptions.BinaryPath
}
k := kustomize.NewKustomizeApp(appPath, q.Repo.GetGitCreds(gitCredsStore), repoURL, kustomizeBinary)
k := kustomize.NewKustomizeApp(repoRoot, appPath, q.Repo.GetGitCreds(gitCredsStore), repoURL, kustomizeBinary)
targetObjs, _, err = k.Build(q.ApplicationSource.Kustomize, q.KustomizeOptions, env)
case v1alpha1.ApplicationSourceTypePlugin:
pluginName := ""
Expand Down Expand Up @@ -1976,7 +1976,7 @@ func (s *Service) GetAppDetails(ctx context.Context, q *apiclient.RepoServerAppD
return err
}
case v1alpha1.ApplicationSourceTypeKustomize:
if err := populateKustomizeAppDetails(res, q, opContext.appPath, commitSHA, s.gitCredsStore); err != nil {
if err := populateKustomizeAppDetails(res, q, repoRoot, opContext.appPath, commitSHA, s.gitCredsStore); err != nil {
return err
}
case v1alpha1.ApplicationSourceTypePlugin:
Expand Down Expand Up @@ -2117,13 +2117,13 @@ func walkHelmValueFilesInPath(root string, valueFiles *[]string) filepath.WalkFu
}
}

func populateKustomizeAppDetails(res *apiclient.RepoAppDetailsResponse, q *apiclient.RepoServerAppDetailsQuery, appPath string, reversion string, credsStore git.CredsStore) error {
func populateKustomizeAppDetails(res *apiclient.RepoAppDetailsResponse, q *apiclient.RepoServerAppDetailsQuery, repoRoot string, appPath string, reversion string, credsStore git.CredsStore) error {
res.Kustomize = &apiclient.KustomizeAppSpec{}
kustomizeBinary := ""
if q.KustomizeOptions != nil {
kustomizeBinary = q.KustomizeOptions.BinaryPath
}
k := kustomize.NewKustomizeApp(appPath, q.Repo.GetGitCreds(credsStore), q.Repo.Repo, kustomizeBinary)
k := kustomize.NewKustomizeApp(repoRoot, appPath, q.Repo.GetGitCreds(credsStore), q.Repo.Repo, kustomizeBinary)
fakeManifestRequest := apiclient.ManifestRequest{
AppName: q.AppName,
Namespace: "", // FIXME: omit it for now
Expand Down
2 changes: 1 addition & 1 deletion test/container/Procfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
controller: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-application-controller $COMMAND --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''}"
api-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_BINARY_NAME=argocd-server $COMMAND --loglevel debug --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379} --disable-auth=${ARGOCD_E2E_DISABLE_AUTH:-'true'} --insecure --dex-server http://localhost:${ARGOCD_E2E_DEX_PORT:-5556} --repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081} --port ${ARGOCD_E2E_APISERVER_PORT:-8080} --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''} "
dex: sh -c "test $ARGOCD_IN_CI = true && exit 0; ARGOCD_BINARY_NAME=argocd-dex go run github.com/argoproj/argo-cd/cmd gendexcfg -o `pwd`/dist/dex.yaml && docker run --rm -p ${ARGOCD_E2E_DEX_PORT:-5556}:${ARGOCD_E2E_DEX_PORT:-5556} -v `pwd`/dist/dex.yaml:/dex.yaml ghcr.io/dexidp/dex:v2.37.0 serve /dex.yaml"
dex: sh -c "test $ARGOCD_IN_CI = true && exit 0; ARGOCD_BINARY_NAME=argocd-dex go run github.com/argoproj/argo-cd/cmd gendexcfg -o `pwd`/dist/dex.yaml && docker run --rm -p ${ARGOCD_E2E_DEX_PORT:-5556}:${ARGOCD_E2E_DEX_PORT:-5556} -v `pwd`/dist/dex.yaml:/dex.yaml ghcr.io/dexidp/dex:v2.38.0 serve /dex.yaml"
redis: sh -c "/usr/local/bin/redis-server --save "" --appendonly no --port ${ARGOCD_E2E_REDIS_PORT:-6379}"
repo-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_GNUPGHOME=${ARGOCD_GNUPGHOME:-/tmp/argocd-local/gpg/keys} ARGOCD_PLUGINSOCKFILEPATH=${ARGOCD_PLUGINSOCKFILEPATH:-./test/cmp} ARGOCD_GPG_DATA_PATH=${ARGOCD_GPG_DATA_PATH:-/tmp/argocd-local/gpg/source} ARGOCD_BINARY_NAME=argocd-repo-server $COMMAND --loglevel debug --port ${ARGOCD_E2E_REPOSERVER_PORT:-8081} --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379}"
ui: sh -c "test $ARGOCD_IN_CI = true && exit 0; cd ui && ARGOCD_E2E_YARN_HOST=0.0.0.0 ${ARGOCD_E2E_YARN_CMD:-yarn} start"
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/app_management_ns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ func TestNamespacedResourceDiffing(t *testing.T) {
Then().
Expect(SyncStatusIs(SyncStatusCodeOutOfSync)).
And(func(app *Application) {
diffOutput, err := RunCli("app", "diff", ctx.AppQualifiedName(), "--local", "testdata/guestbook")
diffOutput, err := RunCli("app", "diff", ctx.AppQualifiedName(), "--local-repo-root", ".", "--local", "testdata/guestbook")
assert.Error(t, err)
assert.Contains(t, diffOutput, fmt.Sprintf("===== apps/Deployment %s/guestbook-ui ======", DeploymentNamespace()))
}).
Expand All @@ -761,7 +761,7 @@ func TestNamespacedResourceDiffing(t *testing.T) {
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
diffOutput, err := RunCli("app", "diff", ctx.AppQualifiedName(), "--local", "testdata/guestbook")
diffOutput, err := RunCli("app", "diff", ctx.AppQualifiedName(), "--local-repo-root", ".", "--local", "testdata/guestbook")
assert.NoError(t, err)
assert.Empty(t, diffOutput)
}).
Expand Down Expand Up @@ -897,7 +897,7 @@ func testNSEdgeCasesApplicationResources(t *testing.T, appPath string, statusCod
expect.
Expect(HealthIs(statusCode)).
And(func(app *Application) {
diffOutput, err := RunCli("app", "diff", ctx.AppQualifiedName(), "--local", path.Join("testdata", appPath))
diffOutput, err := RunCli("app", "diff", ctx.AppQualifiedName(), "--local-repo-root", ".", "--local", path.Join("testdata", appPath))
assert.Empty(t, diffOutput)
assert.NoError(t, err)
})
Expand Down Expand Up @@ -998,7 +998,7 @@ func TestNamespacedLocalManifestSync(t *testing.T) {
Given().
LocalPath(guestbookPathLocal).
When().
Sync().
Sync("--local-repo-root", ".").
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
Expand Down Expand Up @@ -1066,7 +1066,7 @@ func TestNamespacedLocalSyncDryRunWithASEnabled(t *testing.T) {
assert.NoError(t, err)

appBefore := app.DeepCopy()
_, err = RunCli("app", "sync", app.QualifiedName(), "--dry-run", "--local", guestbookPathLocal)
_, err = RunCli("app", "sync", app.QualifiedName(), "--dry-run", "--local-repo-root", ".", "--local", guestbookPathLocal)
assert.NoError(t, err)

appAfter := app.DeepCopy()
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/app_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ func TestLocalManifestSync(t *testing.T) {
Given().
LocalPath(guestbookPathLocal).
When().
Sync().
Sync("--local-repo-root", ".").
Then().
Expect(SyncStatusIs(SyncStatusCodeSynced)).
And(func(app *Application) {
Expand Down Expand Up @@ -1385,7 +1385,7 @@ func TestLocalSyncDryRunWithAutosyncEnabled(t *testing.T) {
assert.NoError(t, err)

appBefore := app.DeepCopy()
_, err = RunCli("app", "sync", app.Name, "--dry-run", "--local", guestbookPathLocal)
_, err = RunCli("app", "sync", app.Name, "--dry-run", "--local-repo-root", ".", "--local", guestbookPathLocal)
assert.NoError(t, err)

appAfter := app.DeepCopy()
Expand Down
6 changes: 5 additions & 1 deletion util/kustomize/kustomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ type Kustomize interface {
}

// NewKustomizeApp create a new wrapper to run commands on the `kustomize` command-line tool.
func NewKustomizeApp(path string, creds git.Creds, fromRepo string, binaryPath string) Kustomize {
func NewKustomizeApp(repoRoot string, path string, creds git.Creds, fromRepo string, binaryPath string) Kustomize {
return &kustomize{
repoRoot: repoRoot,
path: path,
creds: creds,
repo: fromRepo,
Expand All @@ -45,6 +46,8 @@ func NewKustomizeApp(path string, creds git.Creds, fromRepo string, binaryPath s
}

type kustomize struct {
// path to the Git repository root
repoRoot string
// path inside the checked out tree
path string
// creds structure
Expand Down Expand Up @@ -301,6 +304,7 @@ func (k *kustomize) Build(opts *v1alpha1.ApplicationSourceKustomize, kustomizeOp
cmd = exec.Command(k.getBinaryPath(), "build", k.path)
}
cmd.Env = env
cmd.Dir = k.repoRoot
out, err := executil.Run(cmd)
if err != nil {
return nil, nil, err
Expand Down
14 changes: 7 additions & 7 deletions util/kustomize/kustomize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestKustomizeBuild(t *testing.T) {
namePrefix := "namePrefix-"
nameSuffix := "-nameSuffix"
namespace := "custom-namespace"
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", "")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", "")
env := &v1alpha1.Env{
&v1alpha1.EnvEntry{Name: "ARGOCD_APP_NAME", Value: "argo-cd-tests"},
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestKustomizeBuild(t *testing.T) {
func TestFailKustomizeBuild(t *testing.T) {
appPath, err := testDataDir(t, kustomization1)
assert.Nil(t, err)
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", "")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", "")
kustomizeSource := v1alpha1.ApplicationSourceKustomize{
Replicas: []v1alpha1.KustomizeReplica{
{
Expand Down Expand Up @@ -222,7 +222,7 @@ func TestKustomizeBuildForceCommonLabels(t *testing.T) {
for _, tc := range testCases {
appPath, err := testDataDir(t, tc.TestData)
assert.Nil(t, err)
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", "")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", "")
objs, _, err := kustomize.Build(&tc.KustomizeSource, nil, tc.Env)
switch tc.ExpectErr {
case true:
Expand Down Expand Up @@ -314,7 +314,7 @@ func TestKustomizeBuildForceCommonAnnotations(t *testing.T) {
for _, tc := range testCases {
appPath, err := testDataDir(t, tc.TestData)
assert.Nil(t, err)
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", "")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", "")
objs, _, err := kustomize.Build(&tc.KustomizeSource, nil, tc.Env)
switch tc.ExpectErr {
case true:
Expand All @@ -334,7 +334,7 @@ func TestKustomizeCustomVersion(t *testing.T) {
kustomizePath, err := testDataDir(t, kustomization4)
assert.Nil(t, err)
envOutputFile := kustomizePath + "/env_output"
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", kustomizePath+"/kustomize.special")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", kustomizePath+"/kustomize.special")
kustomizeSource := v1alpha1.ApplicationSourceKustomize{
Version: "special",
}
Expand All @@ -356,7 +356,7 @@ func TestKustomizeCustomVersion(t *testing.T) {
func TestKustomizeBuildComponents(t *testing.T) {
appPath, err := testDataDir(t, kustomization6)
assert.Nil(t, err)
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", "")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", "")

kustomizeSource := v1alpha1.ApplicationSourceKustomize{
Components: []string{"./components"},
Expand All @@ -377,7 +377,7 @@ func TestKustomizeBuildComponents(t *testing.T) {
func TestKustomizeBuildPatches(t *testing.T) {
appPath, err := testDataDir(t, kustomization5)
assert.Nil(t, err)
kustomize := NewKustomizeApp(appPath, git.NopCreds{}, "", "")
kustomize := NewKustomizeApp(appPath, appPath, git.NopCreds{}, "", "")

kustomizeSource := v1alpha1.ApplicationSourceKustomize{
Patches: []v1alpha1.KustomizePatch{
Expand Down

0 comments on commit f36149b

Please sign in to comment.