Skip to content

Commit

Permalink
fix: exclude files listed under exclusions (#4686)
Browse files Browse the repository at this point in the history
* fix: exclude files listed under exclustions

* fix: add it to cli

* fix: update doc

* fix: added e2e test

* fix: fix merge conflicts

* fix: fix merge conflicts

* fix: fix merge conflicts

* use glob

* fix merge conflict

* fix rename the flag

* This is my commit message

Signed-off-by: May Zhang <may_zhang@intuit.com>

* -s
  • Loading branch information
mayzhang2000 committed Nov 2, 2020
1 parent b9954e5 commit 6ef89e3
Show file tree
Hide file tree
Showing 20 changed files with 631 additions and 412 deletions.
57 changes: 30 additions & 27 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"AccountService"
],
"summary": "CreateToken creates a token",
"operationId": "CreateToken",
"operationId": "CreateTokenMixin10",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -157,7 +157,7 @@
"AccountService"
],
"summary": "DeleteToken deletes a token",
"operationId": "DeleteToken",
"operationId": "DeleteTokenMixin10",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -188,7 +188,7 @@
"ApplicationService"
],
"summary": "List returns list of applications",
"operationId": "List",
"operationId": "ListMixin9",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -239,7 +239,7 @@
"ApplicationService"
],
"summary": "Create creates an application",
"operationId": "Create",
"operationId": "CreateMixin9",
"parameters": [
{
"name": "body",
Expand All @@ -266,7 +266,7 @@
"ApplicationService"
],
"summary": "Update updates an application",
"operationId": "Update",
"operationId": "UpdateMixin9",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -400,7 +400,7 @@
"ApplicationService"
],
"summary": "Get returns an application by name",
"operationId": "Get",
"operationId": "GetMixin9",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -452,7 +452,7 @@
"ApplicationService"
],
"summary": "Delete deletes an application",
"operationId": "Delete",
"operationId": "DeleteMixin9",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"ClusterService"
],
"summary": "List returns list of clusters",
"operationId": "ListMixin3",
"operationId": "List",
"parameters": [
{
"type": "string",
Expand All @@ -1189,7 +1189,7 @@
"ClusterService"
],
"summary": "Create creates a cluster",
"operationId": "CreateMixin3",
"operationId": "Create",
"parameters": [
{
"name": "body",
Expand All @@ -1216,7 +1216,7 @@
"ClusterService"
],
"summary": "Update updates a cluster",
"operationId": "UpdateMixin3",
"operationId": "Update",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1250,7 +1250,7 @@
"ClusterService"
],
"summary": "Get returns a cluster by server address",
"operationId": "GetMixin3",
"operationId": "GetMixin2",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1278,7 +1278,7 @@
"ClusterService"
],
"summary": "Delete deletes a cluster",
"operationId": "DeleteMixin3",
"operationId": "Delete",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1358,7 +1358,7 @@
"GPGKeyService"
],
"summary": "List all available repository certificates",
"operationId": "ListMixin4",
"operationId": "ListMixin7",
"parameters": [
{
"type": "string",
Expand All @@ -1381,7 +1381,7 @@
"GPGKeyService"
],
"summary": "Create one or more GPG public keys in the server's configuration",
"operationId": "CreateMixin4",
"operationId": "CreateMixin7",
"parameters": [
{
"description": "Raw key data of the GPG key(s) to create",
Expand All @@ -1407,7 +1407,7 @@
"GPGKeyService"
],
"summary": "Delete specified GPG public key from the server's configuration",
"operationId": "DeleteMixin4",
"operationId": "DeleteMixin7",
"parameters": [
{
"type": "string",
Expand All @@ -1432,7 +1432,7 @@
"GPGKeyService"
],
"summary": "Get information about specified GPG public key from the server",
"operationId": "GetMixin4",
"operationId": "GetMixin7",
"parameters": [
{
"type": "string",
Expand All @@ -1458,7 +1458,7 @@
"ProjectService"
],
"summary": "List returns list of projects",
"operationId": "ListMixin5",
"operationId": "ListMixin6",
"parameters": [
{
"type": "string",
Expand All @@ -1480,7 +1480,7 @@
"ProjectService"
],
"summary": "Create a new project",
"operationId": "CreateMixin5",
"operationId": "CreateMixin6",
"parameters": [
{
"name": "body",
Expand All @@ -1507,7 +1507,7 @@
"ProjectService"
],
"summary": "Get returns a project by name",
"operationId": "GetMixin5",
"operationId": "GetMixin6",
"parameters": [
{
"type": "string",
Expand All @@ -1530,7 +1530,7 @@
"ProjectService"
],
"summary": "Delete deletes a project",
"operationId": "DeleteMixin5",
"operationId": "DeleteMixin6",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1630,7 +1630,7 @@
"ProjectService"
],
"summary": "Update updates a project",
"operationId": "UpdateMixin5",
"operationId": "UpdateMixin6",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1664,7 +1664,7 @@
"ProjectService"
],
"summary": "Create a new project token",
"operationId": "CreateTokenMixin5",
"operationId": "CreateToken",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1703,7 +1703,7 @@
"ProjectService"
],
"summary": "Delete a new project token",
"operationId": "DeleteTokenMixin5",
"operationId": "DeleteToken",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1948,7 +1948,7 @@
"RepositoryService"
],
"summary": "Get returns a repository or its credentials",
"operationId": "GetMixin7",
"operationId": "GetMixin3",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -2176,7 +2176,7 @@
"SessionService"
],
"summary": "Create a new JWT for authentication and set a cookie if using HTTP",
"operationId": "CreateMixin8",
"operationId": "CreateMixin11",
"parameters": [
{
"name": "body",
Expand All @@ -2201,7 +2201,7 @@
"SessionService"
],
"summary": "Delete an existing JWT cookie if using HTTP",
"operationId": "DeleteMixin8",
"operationId": "DeleteMixin11",
"responses": {
"200": {
"description": "A successful response.",
Expand Down Expand Up @@ -2235,7 +2235,7 @@
"SettingsService"
],
"summary": "Get returns Argo CD settings",
"operationId": "GetMixin10",
"operationId": "Get",
"responses": {
"200": {
"description": "A successful response.",
Expand Down Expand Up @@ -3868,6 +3868,9 @@
"v1alpha1ApplicationSourceDirectory": {
"type": "object",
"properties": {
"exclude": {
"type": "string"
},
"jsonnet": {
"$ref": "#/definitions/v1alpha1ApplicationSourceJsonnet"
},
Expand Down
14 changes: 13 additions & 1 deletion cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,17 @@ func setAppSpecOptions(flags *pflag.FlagSet, spec *argoappv1.ApplicationSpec, ap
case "helm-set-file":
setHelmOpt(&spec.Source, helmOpts{helmSetFiles: appOpts.helmSetFiles})
case "directory-recurse":
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Recurse: appOpts.directoryRecurse}
if spec.Source.Directory != nil {
spec.Source.Directory.Recurse = appOpts.directoryRecurse
} else {
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Recurse: appOpts.directoryRecurse}
}
case "directory-exclude":
if spec.Source.Directory != nil {
spec.Source.Directory.Exclude = appOpts.directoryExclude
} else {
spec.Source.Directory = &argoappv1.ApplicationSourceDirectory{Exclude: appOpts.directoryExclude}
}
case "config-management-plugin":
spec.Source.Plugin = &argoappv1.ApplicationSourcePlugin{Name: appOpts.configManagementPlugin}
case "dest-name":
Expand Down Expand Up @@ -797,6 +807,7 @@ type appOptions struct {
kustomizeCommonLabels []string
kustomizeCommonAnnotations []string
validate bool
directoryExclude string
}

func addAppFlags(command *cobra.Command, opts *appOptions) {
Expand Down Expand Up @@ -837,6 +848,7 @@ func addAppFlags(command *cobra.Command, opts *appOptions) {
command.Flags().BoolVar(&opts.validate, "validate", true, "Validation of repo and cluster")
command.Flags().StringArrayVar(&opts.kustomizeCommonLabels, "kustomize-common-label", []string{}, "Set common labels in Kustomize")
command.Flags().StringArrayVar(&opts.kustomizeCommonAnnotations, "kustomize-common-annotation", []string{}, "Set common labels in Kustomize")
command.Flags().StringVar(&opts.directoryExclude, "directory-exclude", "", "Set glob expression used to exclude files from application source path")
}

// NewApplicationUnsetCommand returns a new instance of an `argocd app unset` command
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_app_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ argocd app create APPNAME [flags]
--dest-name string K8s cluster Name (e.g. minikube)
--dest-namespace string K8s target namespace (overrides the namespace specified in the ksonnet app.yaml)
--dest-server string K8s cluster URL (e.g. https://kubernetes.default.svc)
--directory-exclude string Set glob expression used to exclude files from application source path
--directory-recurse Recurse directory
--env string Application environment to monitor
-f, --file string Filename or URL to Kubernetes manifests for the app
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/commands/argocd_app_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ argocd app set APPNAME [flags]
--dest-name string K8s cluster Name (e.g. minikube)
--dest-namespace string K8s target namespace (overrides the namespace specified in the ksonnet app.yaml)
--dest-server string K8s cluster URL (e.g. https://kubernetes.default.svc)
--directory-exclude string Set glob expression used to exclude files from application source path
--directory-recurse Recurse directory
--env string Application environment to monitor
--helm-chart string Helm Chart name
Expand Down
12 changes: 12 additions & 0 deletions manifests/crds/application-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ spec:
directory:
description: Directory holds path/directory specific options
properties:
exclude:
type: string
jsonnet:
description: ApplicationSourceJsonnet holds jsonnet specific options
properties:
Expand Down Expand Up @@ -397,6 +399,8 @@ spec:
directory:
description: Directory holds path/directory specific options
properties:
exclude:
type: string
jsonnet:
description: ApplicationSourceJsonnet holds jsonnet specific options
properties:
Expand Down Expand Up @@ -679,6 +683,8 @@ spec:
directory:
description: Directory holds path/directory specific options
properties:
exclude:
type: string
jsonnet:
description: ApplicationSourceJsonnet holds jsonnet specific options
properties:
Expand Down Expand Up @@ -964,6 +970,8 @@ spec:
directory:
description: Directory holds path/directory specific options
properties:
exclude:
type: string
jsonnet:
description: ApplicationSourceJsonnet holds jsonnet specific options
properties:
Expand Down Expand Up @@ -1227,6 +1235,8 @@ spec:
directory:
description: Directory holds path/directory specific options
properties:
exclude:
type: string
jsonnet:
description: ApplicationSourceJsonnet holds jsonnet specific options
properties:
Expand Down Expand Up @@ -1487,6 +1497,8 @@ spec:
directory:
description: Directory holds path/directory specific options
properties:
exclude:
type: string
jsonnet:
description: ApplicationSourceJsonnet holds jsonnet specific options
properties:
Expand Down
Loading

0 comments on commit 6ef89e3

Please sign in to comment.