Fix default checkout options in Airshipctl config

`airshipctl config init` command, generates default Airshipctl config
with mutually exclusive checkout options.
This CR fixing config generation by setting the only branch.
The `commitHash` and `tag` remain empty as an example in config file..

Change-Id: I12ec9b713e8f6769ddbd5301e000ab0242ea8ff4
Closes: #233
This commit is contained in:
Alexander Noskov 2020-05-12 00:53:11 -05:00
parent 0d7dc4de24
commit aab8325af5
6 changed files with 7 additions and 9 deletions

View File

@ -70,7 +70,7 @@ type RepoAuth struct {
// Each field is mutually exclusive
type RepoCheckout struct {
// CommitHash is full hash of the commit that will be used to checkout
CommitHash string `json:"commitHash,omitempty"`
CommitHash string `json:"commitHash"`
// Branch is the branch name to checkout
Branch string `json:"branch"`
// Tag is the tag name to checkout
@ -79,7 +79,7 @@ type RepoCheckout struct {
// RemoteRef is used for remote checkouts such as gerrit change requests/github pull request
// for example refs/changes/04/691202/5
// TODO Add support for fetching remote refs
RemoteRef string `json:"remoteRef"`
RemoteRef string `json:"remoteRef,omitempty"`
// ForceCheckout is a boolean to indicate whether to use the `--force` option when checking out
ForceCheckout bool `json:"force"`
}

View File

@ -40,8 +40,8 @@ manifests:
type: ssh-key
checkout:
branch: ""
commitHash: ""
force: false
remoteRef: ""
tag: v1.0.1
url: http://dummy.url.com/manifests.git
subPath: manifests/site/test-site

View File

@ -6,8 +6,8 @@ repositories:
type: ssh-key
checkout:
branch: ""
commitHash: ""
force: false
remoteRef: ""
tag: v1.0.1
url: http://dummy.url.com/manifests.git
subPath: manifests/site/test-site

View File

@ -1,4 +1,4 @@
branch: ""
commitHash: ""
force: false
remoteRef: ""
tag: v1.0.1

View File

@ -3,7 +3,7 @@ auth:
type: ssh-key
checkout:
branch: ""
commitHash: ""
force: false
remoteRef: ""
tag: v1.0.1
url: http://dummy.url.com/manifests.git

View File

@ -72,9 +72,7 @@ func NewConfig() *Config {
DefaultTestPrimaryRepo: {
URLString: AirshipDefaultManifestRepoLocation,
CheckoutOptions: &RepoCheckout{
CommitHash: "master",
Branch: "master",
RemoteRef: "master",
Branch: "master",
},
},
},