Skip to content

Commit 1778eaa

Browse files
committed
Many improvements and bug fixes
1 parent 5181d11 commit 1778eaa

19 files changed

+66
-36
lines changed

apptrust/commands/application/delete_app_cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func GetDeleteAppCommand(appContext app.Context) components.Command {
6969
Optional: false,
7070
},
7171
},
72+
Flags: commands.GetCommandFlags(commands.AppDelete),
7273
Action: cmd.prepareAndRunCommand,
7374
}
7475
}

apptrust/commands/flags.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const (
2929
accessToken = "access-token"
3030
ProjectFlag = "project"
3131

32-
ApplicationKeyFlag = "application-key"
3332
SpecFlag = "spec"
3433
SpecVarsFlag = "spec-vars"
3534
StageVarsFlag = "stage"
@@ -63,17 +62,16 @@ var flagsMap = map[string]components.Flag{
6362
accessToken: components.NewStringFlag(accessToken, "JFrog access token.", func(f *components.StringFlag) { f.Mandatory = false }),
6463
ProjectFlag: components.NewStringFlag(ProjectFlag, "Project key associated with the application. This flag is mandatory when the --spec flag is not provided.", func(f *components.StringFlag) { f.Mandatory = false }),
6564

66-
ApplicationKeyFlag: components.NewStringFlag(ApplicationKeyFlag, "Application key.", func(f *components.StringFlag) { f.Mandatory = false }),
6765
SpecFlag: components.NewStringFlag(SpecFlag, "A path to the specification file.", func(f *components.StringFlag) { f.Mandatory = false }),
6866
SpecVarsFlag: components.NewStringFlag(SpecVarsFlag, "List of semicolon-separated (;) variables in the form of \"key1=value1;key2=value2;...\" (wrapped by quotes) to be replaced in the File Spec. In the File Spec, the variables should be used as follows: ${key1}.", func(f *components.StringFlag) { f.Mandatory = false }),
6967
StageVarsFlag: components.NewStringFlag(StageVarsFlag, "Promotion stage.", func(f *components.StringFlag) { f.Mandatory = true }),
7068
ApplicationNameFlag: components.NewStringFlag(ApplicationNameFlag, "The display name of the application.", func(f *components.StringFlag) { f.Mandatory = false }),
7169
DescriptionFlag: components.NewStringFlag(DescriptionFlag, "The description of the application.", func(f *components.StringFlag) { f.Mandatory = false }),
7270
BusinessCriticalityFlag: components.NewStringFlag(BusinessCriticalityFlag, "The business criticality level. The following values are supported: "+coreutils.ListToText(model.BusinessCriticalityValues), func(f *components.StringFlag) { f.Mandatory = false }),
73-
MaturityLevelFlag: components.NewStringFlag(MaturityLevelFlag, "The maturity level.", func(f *components.StringFlag) { f.Mandatory = false }),
71+
MaturityLevelFlag: components.NewStringFlag(MaturityLevelFlag, "The maturity level. The following values are supported: "+coreutils.ListToText(model.MaturityLevelValues), func(f *components.StringFlag) { f.Mandatory = false }),
7472
LabelsFlag: components.NewStringFlag(LabelsFlag, "List of semicolon-separated (;) labels in the form of \"key1=value1;key2=value2;...\" (wrapped by quotes).", func(f *components.StringFlag) { f.Mandatory = false }),
75-
UserOwnersFlag: components.NewStringFlag(UserOwnersFlag, "Comma-separated list of user owners.", func(f *components.StringFlag) { f.Mandatory = false }),
76-
GroupOwnersFlag: components.NewStringFlag(GroupOwnersFlag, "Comma-separated list of group owners.", func(f *components.StringFlag) { f.Mandatory = false }),
73+
UserOwnersFlag: components.NewStringFlag(UserOwnersFlag, "semicolon-separated (;) list of user owners.", func(f *components.StringFlag) { f.Mandatory = false }),
74+
GroupOwnersFlag: components.NewStringFlag(GroupOwnersFlag, "semicolon-separated (;) list of group owners.", func(f *components.StringFlag) { f.Mandatory = false }),
7775
SyncFlag: components.NewBoolFlag(SyncFlag, "Whether to synchronize the operation.", components.WithBoolDefaultValueTrue()),
7876
PromotionTypeFlag: components.NewStringFlag(PromotionTypeFlag, "The promotion type. The following values are supported: "+coreutils.ListToText(model.PromotionTypeValues), func(f *components.StringFlag) { f.Mandatory = false; f.DefaultValue = model.PromotionTypeCopy }),
7977
DryRunFlag: components.NewBoolFlag(DryRunFlag, "Perform a simulation of the operation.", components.WithBoolDefaultValueFalse()),
@@ -151,14 +149,12 @@ var commandFlags = map[string][]string{
151149
user,
152150
accessToken,
153151
serverId,
154-
ApplicationKeyFlag,
155152
},
156153
PackageUnbind: {
157154
url,
158155
user,
159156
accessToken,
160157
serverId,
161-
ApplicationKeyFlag,
162158
},
163159

164160
Ping: {

apptrust/commands/version/create_app_version_cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func validateCreateAppVersionContext(ctx *components.Context) error {
250250

251251
if !hasSource {
252252
return errorutils.CheckErrorf(
253-
"At least one source flag is required to create an application version. Please provide one of the following: --%s, --%s, --%s, or --%s.",
253+
"At least one source flag is required to create an application version. Please provide --%s or at least one of the following: --%s, --%s, --%s.",
254254
commands.SpecFlag, commands.SourceTypeBuildsFlag, commands.SourceTypeReleaseBundlesFlag, commands.SourceTypeApplicationVersionsFlag)
255255
}
256256

apptrust/commands/version/create_app_version_cmd_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func TestCreateAppVersionCommand_FlagsSuite(t *testing.T) {
157157
},
158158
expectsPayload: nil,
159159
expectsError: true,
160-
errorContains: "At least one source flag is required to create an application version. Please provide one of the following: --spec, --source-type-builds, --source-type-release-bundles, or --source-type-application-versions.",
160+
errorContains: "At least one source flag is required to create an application version. Please provide --spec or at least one of the following: --source-type-builds, --source-type-release-bundles, --source-type-application-versions.",
161161
},
162162
{
163163
name: "empty flags",
@@ -166,7 +166,7 @@ func TestCreateAppVersionCommand_FlagsSuite(t *testing.T) {
166166
},
167167
expectsPayload: nil,
168168
expectsError: true,
169-
errorContains: "At least one source flag is required to create an application version. Please provide one of the following: --spec, --source-type-builds, --source-type-release-bundles, or --source-type-application-versions.",
169+
errorContains: "At least one source flag is required to create an application version. Please provide --spec or at least one of the following: --source-type-builds, --source-type-release-bundles, --source-type-application-versions.",
170170
},
171171
}
172172

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"application_key": "should-be-ignored",
33
"packages": [
4-
{"type": "npm", "name": "pkg-conflict", "version": "0.3.0", "repository": "repo-conflict"}
4+
{
5+
"type": "npm",
6+
"name": "pkg-conflict",
7+
"version": "0.3.0",
8+
"repository_key": "repo-conflict"
9+
}
510
]
611
}
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"packages": [
3-
{"type": "npm", "name": "pkg-invalid", "version": "0.1.0", "repository": "repo-invalid"}
3+
{
4+
"type": "npm",
5+
"name": "pkg-invalid",
6+
"version": "0.1.0",
7+
"repository_key": "repo-invalid"
8+
}
49
]
510
// missing closing brace and invalid JSON
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"packages": [
3-
{"type": "npm", "name": "pkg-min", "version": "0.1.0", "repository": "repo-min"}
3+
{
4+
"type": "npm",
5+
"name": "pkg-min",
6+
"version": "0.1.0",
7+
"repository_key": "repo-min"
8+
}
49
]
510
}

apptrust/commands/version/testfiles/test-spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"name": "pkg1",
55
"version": "1.0.0",
6-
"repository": "repo1",
6+
"repository_key": "repo1",
77
"type": "npm"
88
}
99
],
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"packages": [
3-
{"type": "npm", "name": "pkg-unknown", "version": "0.2.0", "repository": "repo-unknown"}
3+
{
4+
"type": "npm",
5+
"name": "pkg-unknown",
6+
"version": "0.2.0",
7+
"repository_key": "repo-unknown"
8+
}
49
],
510
"unknown_field": "should be ignored"
611
}
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"packages": [
3-
{"type": "npm", "name": "${PKG_NAME}", "version": "${PKG_VERSION}", "repository": "${PKG_REPO}"}
3+
{
4+
"type": "npm",
5+
"name": "${PKG_NAME}",
6+
"version": "${PKG_VERSION}",
7+
"repository_key": "${PKG_REPO}"
8+
}
49
]
510
}

0 commit comments

Comments
 (0)