Update metadataPath using set-manifest in cli
* Added metatada-path as a flag to set-manifest Change-Id: Id26f20c4a6350b4aae34da850bbfcab42cbe9f21
This commit is contained in:
parent
29088b7b42
commit
2769c62c8a
@ -145,5 +145,11 @@ func addSetManifestFlags(o *config.ManifestOptions, cmd *cobra.Command) {
|
||||
&o.TargetPath,
|
||||
"target-path",
|
||||
"",
|
||||
"the target path for to be set for this manifest")
|
||||
"the target path to be set for this manifest")
|
||||
|
||||
flags.StringVar(
|
||||
&o.MetadataPath,
|
||||
"metadata-path",
|
||||
"",
|
||||
"the metadata path to be set for this manifest")
|
||||
}
|
||||
|
@ -34,8 +34,10 @@ const (
|
||||
mBranch = "master"
|
||||
mSubPath = "manifests/test-site"
|
||||
mTargetPath = "/tmp/airship"
|
||||
mMetadataPath = "manifests/metadata.yaml"
|
||||
|
||||
testTargetPath = "/tmp/e2e"
|
||||
testMetadataPath = "manifests/docker_metadata.yaml"
|
||||
)
|
||||
|
||||
type setManifestTest struct {
|
||||
@ -43,6 +45,7 @@ type setManifestTest struct {
|
||||
cmdTest *testutil.CmdTest
|
||||
manifestName string
|
||||
manifestTargetPath string
|
||||
manifestMetadataPath string
|
||||
}
|
||||
|
||||
func TestConfigSetManifest(t *testing.T) {
|
||||
@ -81,6 +84,7 @@ func TestSetManifest(t *testing.T) {
|
||||
flags []string
|
||||
givenConfig *config.Config
|
||||
targetPath string
|
||||
metadataPath string
|
||||
}{
|
||||
{
|
||||
testName: "set-manifest",
|
||||
@ -92,18 +96,22 @@ func TestSetManifest(t *testing.T) {
|
||||
"--primary",
|
||||
"--sub-path " + mSubPath,
|
||||
"--target-path " + mTargetPath,
|
||||
"--metadata-path " + mMetadataPath,
|
||||
},
|
||||
givenConfig: given,
|
||||
targetPath: mTargetPath,
|
||||
metadataPath: mMetadataPath,
|
||||
},
|
||||
{
|
||||
testName: "modify-manifest",
|
||||
manifestName: mName,
|
||||
flags: []string{
|
||||
"--target-path " + testTargetPath,
|
||||
"--metadata-path " + testMetadataPath,
|
||||
},
|
||||
givenConfig: given,
|
||||
targetPath: testTargetPath,
|
||||
metadataPath: mMetadataPath,
|
||||
},
|
||||
}
|
||||
|
||||
@ -118,6 +126,7 @@ func TestSetManifest(t *testing.T) {
|
||||
cmdTest: cmd,
|
||||
manifestName: tt.manifestName,
|
||||
manifestTargetPath: tt.targetPath,
|
||||
manifestMetadataPath: tt.metadataPath,
|
||||
}
|
||||
test.run(t)
|
||||
}
|
||||
|
@ -32,10 +32,11 @@ Flags:
|
||||
--commithash string the commit hash to be associated with repository in this manifest
|
||||
--force if set, enable force checkout in repository with this manifest
|
||||
-h, --help help for set-manifest
|
||||
--metadata-path string the metadata path to be set for this manifest
|
||||
--primary if set, enable this repository as primary repository to be used with this manifest
|
||||
--repo string the name of the repository to be associated with this manifest
|
||||
--sub-path string the sub path to be set for this manifest
|
||||
--tag string the tag to be associated with repository in this manifest
|
||||
--target-path string the target path for to be set for this manifest
|
||||
--target-path string the target path to be set for this manifest
|
||||
--url string the repository url to be associated with this manifest
|
||||
|
||||
|
@ -32,10 +32,11 @@ Flags:
|
||||
--commithash string the commit hash to be associated with repository in this manifest
|
||||
--force if set, enable force checkout in repository with this manifest
|
||||
-h, --help help for set-manifest
|
||||
--metadata-path string the metadata path to be set for this manifest
|
||||
--primary if set, enable this repository as primary repository to be used with this manifest
|
||||
--repo string the name of the repository to be associated with this manifest
|
||||
--sub-path string the sub path to be set for this manifest
|
||||
--tag string the tag to be associated with repository in this manifest
|
||||
--target-path string the target path for to be set for this manifest
|
||||
--target-path string the target path to be set for this manifest
|
||||
--url string the repository url to be associated with this manifest
|
||||
|
||||
|
@ -33,9 +33,10 @@ Flags:
|
||||
--commithash string the commit hash to be associated with repository in this manifest
|
||||
--force if set, enable force checkout in repository with this manifest
|
||||
-h, --help help for set-manifest
|
||||
--metadata-path string the metadata path to be set for this manifest
|
||||
--primary if set, enable this repository as primary repository to be used with this manifest
|
||||
--repo string the name of the repository to be associated with this manifest
|
||||
--sub-path string the sub path to be set for this manifest
|
||||
--tag string the tag to be associated with repository in this manifest
|
||||
--target-path string the target path for to be set for this manifest
|
||||
--target-path string the target path to be set for this manifest
|
||||
--url string the repository url to be associated with this manifest
|
||||
|
@ -515,6 +515,9 @@ func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions
|
||||
if theManifest.TargetPath != "" {
|
||||
manifest.TargetPath = theManifest.TargetPath
|
||||
}
|
||||
if theManifest.MetadataPath != "" {
|
||||
manifest.MetadataPath = theManifest.MetadataPath
|
||||
}
|
||||
// There is no repository details to be updated
|
||||
if theManifest.RepoName == "" {
|
||||
return nil
|
||||
|
@ -44,6 +44,7 @@ type ManifestOptions struct {
|
||||
IsPrimary bool
|
||||
SubPath string
|
||||
TargetPath string
|
||||
MetadataPath string
|
||||
}
|
||||
|
||||
// EncryptionConfigOptions holds all configurable options for encryption configuration
|
||||
|
Loading…
Reference in New Issue
Block a user