Merge "Replace PrimaryRepositoryName with PhaseRepositoryName"
This commit is contained in:
commit
f92e8bd042
@ -69,8 +69,8 @@ func TestGetManifestConfigCmd(t *testing.T) {
|
|||||||
|
|
||||||
func getTestManifest(name string) *config.Manifest {
|
func getTestManifest(name string) *config.Manifest {
|
||||||
manifests := &config.Manifest{
|
manifests := &config.Manifest{
|
||||||
PrimaryRepositoryName: name + "_primary_repo",
|
PhaseRepositoryName: name + "_phase_repo",
|
||||||
TargetPath: name + "_target_path",
|
TargetPath: name + "_target_path",
|
||||||
}
|
}
|
||||||
return manifests
|
return manifests
|
||||||
}
|
}
|
||||||
|
@ -34,14 +34,14 @@ airshipctl config set-manifest exampleManifest \
|
|||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--url https://github.com/site \
|
--url https://github.com/site \
|
||||||
--branch master \
|
--branch master \
|
||||||
--primary \
|
--phase \
|
||||||
--sub-path exampleSubpath \
|
--sub-path exampleSubpath \
|
||||||
--target-path exampleTargetpath
|
--target-path exampleTargetpath
|
||||||
|
|
||||||
# Change the primary repo for manifest
|
# Change the phase repo for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--primary
|
--phase
|
||||||
|
|
||||||
# Change the sub-path for manifest
|
# Change the sub-path for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
@ -130,10 +130,10 @@ func addSetManifestFlags(o *config.ManifestOptions, cmd *cobra.Command) {
|
|||||||
"if set, enable force checkout in repository with this manifest")
|
"if set, enable force checkout in repository with this manifest")
|
||||||
|
|
||||||
flags.BoolVar(
|
flags.BoolVar(
|
||||||
&o.IsPrimary,
|
&o.IsPhase,
|
||||||
"primary",
|
"phase",
|
||||||
false,
|
false,
|
||||||
"if set, enable this repository as primary repository to be used with this manifest")
|
"if set, enable this repository as phase repository to be used with this manifest")
|
||||||
|
|
||||||
flags.StringVar(
|
flags.StringVar(
|
||||||
&o.SubPath,
|
&o.SubPath,
|
||||||
|
@ -93,7 +93,7 @@ func TestSetManifest(t *testing.T) {
|
|||||||
"--repo " + mRepoName,
|
"--repo " + mRepoName,
|
||||||
"--url " + mURL,
|
"--url " + mURL,
|
||||||
"--branch " + mBranch,
|
"--branch " + mBranch,
|
||||||
"--primary",
|
"--phase",
|
||||||
"--sub-path " + mSubPath,
|
"--sub-path " + mSubPath,
|
||||||
"--target-path " + mTargetPath,
|
"--target-path " + mTargetPath,
|
||||||
"--metadata-path " + mMetadataPath,
|
"--metadata-path " + mMetadataPath,
|
||||||
|
@ -9,14 +9,14 @@ airshipctl config set-manifest exampleManifest \
|
|||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--url https://github.com/site \
|
--url https://github.com/site \
|
||||||
--branch master \
|
--branch master \
|
||||||
--primary \
|
--phase \
|
||||||
--sub-path exampleSubpath \
|
--sub-path exampleSubpath \
|
||||||
--target-path exampleTargetpath
|
--target-path exampleTargetpath
|
||||||
|
|
||||||
# Change the primary repo for manifest
|
# Change the phase repo for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--primary
|
--phase
|
||||||
|
|
||||||
# Change the sub-path for manifest
|
# Change the sub-path for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
@ -33,7 +33,7 @@ Flags:
|
|||||||
--force if set, enable force checkout in repository with this manifest
|
--force if set, enable force checkout in repository with this manifest
|
||||||
-h, --help help for set-manifest
|
-h, --help help for set-manifest
|
||||||
--metadata-path string the metadata path to be set for this 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
|
--phase if set, enable this repository as phase repository to be used with this manifest
|
||||||
--repo string the name of the repository to be associated 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
|
--sub-path string the sub path to be set for this manifest
|
||||||
--tag string the tag to be associated with repository in this manifest
|
--tag string the tag to be associated with repository in this manifest
|
||||||
|
@ -9,14 +9,14 @@ airshipctl config set-manifest exampleManifest \
|
|||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--url https://github.com/site \
|
--url https://github.com/site \
|
||||||
--branch master \
|
--branch master \
|
||||||
--primary \
|
--phase \
|
||||||
--sub-path exampleSubpath \
|
--sub-path exampleSubpath \
|
||||||
--target-path exampleTargetpath
|
--target-path exampleTargetpath
|
||||||
|
|
||||||
# Change the primary repo for manifest
|
# Change the phase repo for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--primary
|
--phase
|
||||||
|
|
||||||
# Change the sub-path for manifest
|
# Change the sub-path for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
@ -33,7 +33,7 @@ Flags:
|
|||||||
--force if set, enable force checkout in repository with this manifest
|
--force if set, enable force checkout in repository with this manifest
|
||||||
-h, --help help for set-manifest
|
-h, --help help for set-manifest
|
||||||
--metadata-path string the metadata path to be set for this 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
|
--phase if set, enable this repository as phase repository to be used with this manifest
|
||||||
--repo string the name of the repository to be associated 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
|
--sub-path string the sub path to be set for this manifest
|
||||||
--tag string the tag to be associated with repository in this manifest
|
--tag string the tag to be associated with repository in this manifest
|
||||||
|
@ -10,14 +10,14 @@ airshipctl config set-manifest exampleManifest \
|
|||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--url https://github.com/site \
|
--url https://github.com/site \
|
||||||
--branch master \
|
--branch master \
|
||||||
--primary \
|
--phase \
|
||||||
--sub-path exampleSubpath \
|
--sub-path exampleSubpath \
|
||||||
--target-path exampleTargetpath
|
--target-path exampleTargetpath
|
||||||
|
|
||||||
# Change the primary repo for manifest
|
# Change the phase repo for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--primary
|
--phase
|
||||||
|
|
||||||
# Change the sub-path for manifest
|
# Change the sub-path for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
@ -34,7 +34,7 @@ Flags:
|
|||||||
--force if set, enable force checkout in repository with this manifest
|
--force if set, enable force checkout in repository with this manifest
|
||||||
-h, --help help for set-manifest
|
-h, --help help for set-manifest
|
||||||
--metadata-path string the metadata path to be set for this 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
|
--phase if set, enable this repository as phase repository to be used with this manifest
|
||||||
--repo string the name of the repository to be associated 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
|
--sub-path string the sub path to be set for this manifest
|
||||||
--tag string the tag to be associated with repository in this manifest
|
--tag string the tag to be associated with repository in this manifest
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
metadataPath: ""
|
metadataPath: ""
|
||||||
primaryRepositoryName: bar_primary_repo
|
phaseRepositoryName: bar_phase_repo
|
||||||
subPath: ""
|
subPath: ""
|
||||||
targetPath: bar_target_path
|
targetPath: bar_target_path
|
||||||
|
|
||||||
metadataPath: ""
|
metadataPath: ""
|
||||||
primaryRepositoryName: baz_primary_repo
|
phaseRepositoryName: baz_phase_repo
|
||||||
subPath: ""
|
subPath: ""
|
||||||
targetPath: baz_target_path
|
targetPath: baz_target_path
|
||||||
|
|
||||||
metadataPath: ""
|
metadataPath: ""
|
||||||
primaryRepositoryName: foo_primary_repo
|
phaseRepositoryName: foo_phase_repo
|
||||||
subPath: ""
|
subPath: ""
|
||||||
targetPath: foo_target_path
|
targetPath: foo_target_path
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
metadataPath: ""
|
metadataPath: ""
|
||||||
primaryRepositoryName: foo_primary_repo
|
phaseRepositoryName: foo_phase_repo
|
||||||
subPath: ""
|
subPath: ""
|
||||||
targetPath: foo_target_path
|
targetPath: foo_target_path
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ airshipctl config set-manifest exampleManifest \
|
|||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--url https://github.com/site \
|
--url https://github.com/site \
|
||||||
--branch master \
|
--branch master \
|
||||||
--primary \
|
--phase \
|
||||||
--sub-path exampleSubpath \
|
--sub-path exampleSubpath \
|
||||||
--target-path exampleTargetpath
|
--target-path exampleTargetpath
|
||||||
|
|
||||||
# Change the primary repo for manifest
|
# Change the phase repo for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
--repo exampleRepo \
|
--repo exampleRepo \
|
||||||
--primary
|
--phase
|
||||||
|
|
||||||
# Change the sub-path for manifest
|
# Change the sub-path for manifest
|
||||||
airshipctl config set-manifest e2e \
|
airshipctl config set-manifest e2e \
|
||||||
@ -47,7 +47,7 @@ airshipctl config set-manifest e2e \
|
|||||||
--force if set, enable force checkout in repository with this manifest
|
--force if set, enable force checkout in repository with this manifest
|
||||||
-h, --help help for set-manifest
|
-h, --help help for set-manifest
|
||||||
--metadata-path string the metadata path to be set for this 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
|
--phase if set, enable this repository as phase repository to be used with this manifest
|
||||||
--repo string the name of the repository to be associated 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
|
--sub-path string the sub path to be set for this manifest
|
||||||
--tag string the tag to be associated with repository in this manifest
|
--tag string the tag to be associated with repository in this manifest
|
||||||
|
@ -111,7 +111,7 @@ Run the below command to configure docker manifest, and add it to airship config
|
|||||||
```
|
```
|
||||||
$ airshipctl config set-manifest docker_manifest --repo primary \
|
$ airshipctl config set-manifest docker_manifest --repo primary \
|
||||||
--url https://opendev.org/airship/airshipctl --branch master \
|
--url https://opendev.org/airship/airshipctl --branch master \
|
||||||
--primary --sub-path manifests/site/docker-test-site --target-path /tmp/airship
|
--phase --sub-path manifests/site/docker-test-site --target-path /tmp/airship
|
||||||
```
|
```
|
||||||
|
|
||||||
$ airshipctl config set-context kind-capi-docker --manifest docker_manifest
|
$ airshipctl config set-context kind-capi-docker --manifest docker_manifest
|
||||||
|
@ -264,7 +264,7 @@ func TestGenerateBootstrapIso(t *testing.T) {
|
|||||||
settings := func() (*config.Config, error) {
|
settings := func() (*config.Config, error) {
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
expectedErr := config.ErrMissingPrimaryRepo{}
|
expectedErr := config.ErrMissingPhaseRepo{}
|
||||||
actualErr := GenerateBootstrapIso(settings, false)
|
actualErr := GenerateBootstrapIso(settings, false)
|
||||||
assert.Equal(t, expectedErr, actualErr)
|
assert.Equal(t, expectedErr, actualErr)
|
||||||
})
|
})
|
||||||
|
2
pkg/bootstrap/isogen/testdata/config/config
vendored
2
pkg/bootstrap/isogen/testdata/config/config
vendored
@ -19,7 +19,7 @@ managementConfiguration:
|
|||||||
type: redfish
|
type: redfish
|
||||||
manifests:
|
manifests:
|
||||||
default:
|
default:
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
repositories:
|
repositories:
|
||||||
primary:
|
primary:
|
||||||
checkout:
|
checkout:
|
||||||
|
@ -45,9 +45,9 @@ func TestNewCommand(t *testing.T) {
|
|||||||
currentContext: validContext,
|
currentContext: validContext,
|
||||||
manifests: map[string]*config.Manifest{
|
manifests: map[string]*config.Manifest{
|
||||||
manifestName: {
|
manifestName: {
|
||||||
TargetPath: "testdata",
|
TargetPath: "testdata",
|
||||||
SubPath: "valid",
|
SubPath: "valid",
|
||||||
PrimaryRepositoryName: "primary",
|
PhaseRepositoryName: "primary",
|
||||||
Repositories: map[string]*config.Repository{
|
Repositories: map[string]*config.Repository{
|
||||||
"primary": {},
|
"primary": {},
|
||||||
},
|
},
|
||||||
@ -60,9 +60,9 @@ func TestNewCommand(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
manifests: map[string]*config.Manifest{
|
manifests: map[string]*config.Manifest{
|
||||||
manifestName: {
|
manifestName: {
|
||||||
TargetPath: "testdata",
|
TargetPath: "testdata",
|
||||||
SubPath: "invalid-path",
|
SubPath: "invalid-path",
|
||||||
PrimaryRepositoryName: "primary",
|
PhaseRepositoryName: "primary",
|
||||||
Repositories: map[string]*config.Repository{
|
Repositories: map[string]*config.Repository{
|
||||||
"primary": {},
|
"primary": {},
|
||||||
},
|
},
|
||||||
@ -75,9 +75,9 @@ func TestNewCommand(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
manifests: map[string]*config.Manifest{
|
manifests: map[string]*config.Manifest{
|
||||||
manifestName: {
|
manifestName: {
|
||||||
TargetPath: "testdata",
|
TargetPath: "testdata",
|
||||||
SubPath: "no-clusterctl",
|
SubPath: "no-clusterctl",
|
||||||
PrimaryRepositoryName: "primary",
|
PhaseRepositoryName: "primary",
|
||||||
Repositories: map[string]*config.Repository{
|
Repositories: map[string]*config.Repository{
|
||||||
"primary": {},
|
"primary": {},
|
||||||
},
|
},
|
||||||
@ -85,7 +85,7 @@ func TestNewCommand(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "no primary repo",
|
name: "no phase repo",
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
manifests: map[string]*config.Manifest{
|
manifests: map[string]*config.Manifest{
|
||||||
manifestName: {
|
manifestName: {
|
||||||
@ -99,9 +99,9 @@ func TestNewCommand(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
manifests: map[string]*config.Manifest{
|
manifests: map[string]*config.Manifest{
|
||||||
manifestName: {
|
manifestName: {
|
||||||
TargetPath: "testdata",
|
TargetPath: "testdata",
|
||||||
SubPath: "can't build bundle",
|
SubPath: "can't build bundle",
|
||||||
PrimaryRepositoryName: "primary",
|
PhaseRepositoryName: "primary",
|
||||||
Repositories: map[string]*config.Repository{
|
Repositories: map[string]*config.Repository{
|
||||||
"primary": {},
|
"primary": {},
|
||||||
},
|
},
|
||||||
|
@ -7,7 +7,7 @@ currentContext: dummy_cluster
|
|||||||
kind: Config
|
kind: Config
|
||||||
manifests:
|
manifests:
|
||||||
dummy_manifest:
|
dummy_manifest:
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
repositories:
|
repositories:
|
||||||
primary:
|
primary:
|
||||||
auth:
|
auth:
|
||||||
|
@ -338,9 +338,9 @@ func (c *Config) CurrentContextEntryPoint(phase string) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
_, exists := ccm.Repositories[ccm.PrimaryRepositoryName]
|
_, exists := ccm.Repositories[ccm.PhaseRepositoryName]
|
||||||
if !exists {
|
if !exists {
|
||||||
return "", ErrMissingPrimaryRepo{}
|
return "", ErrMissingPhaseRepo{}
|
||||||
}
|
}
|
||||||
epp := path.Join(ccm.TargetPath, ccm.SubPath, clusterType, phase)
|
epp := path.Join(ccm.TargetPath, ccm.SubPath, clusterType, phase)
|
||||||
if _, err := os.Stat(epp); err != nil {
|
if _, err := os.Stat(epp); err != nil {
|
||||||
@ -404,8 +404,8 @@ func (c *Config) AddManifest(theManifest *ManifestOptions) *Manifest {
|
|||||||
|
|
||||||
// ModifyManifest set actual values to manifests
|
// ModifyManifest set actual values to manifests
|
||||||
func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions) error {
|
func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions) error {
|
||||||
if theManifest.IsPrimary {
|
if theManifest.IsPhase {
|
||||||
manifest.PrimaryRepositoryName = theManifest.RepoName
|
manifest.PhaseRepositoryName = theManifest.RepoName
|
||||||
}
|
}
|
||||||
if theManifest.SubPath != "" {
|
if theManifest.SubPath != "" {
|
||||||
manifest.SubPath = theManifest.SubPath
|
manifest.SubPath = theManifest.SubPath
|
||||||
@ -420,9 +420,9 @@ func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions
|
|||||||
if theManifest.RepoName == "" {
|
if theManifest.RepoName == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
//when setting an existing repository as primary, verify whether the repository exists
|
//when setting an existing repository as phase, verify whether the repository exists
|
||||||
//and user is also not passing any repository URL
|
//and user is also not passing any repository URL
|
||||||
if theManifest.IsPrimary && theManifest.URL == "" && (manifest.Repositories[theManifest.RepoName] == nil) {
|
if theManifest.IsPhase && theManifest.URL == "" && (manifest.Repositories[theManifest.RepoName] == nil) {
|
||||||
return ErrRepositoryNotFound{theManifest.RepoName}
|
return ErrRepositoryNotFound{theManifest.RepoName}
|
||||||
}
|
}
|
||||||
repository, exists := manifest.Repositories[theManifest.RepoName]
|
repository, exists := manifest.Repositories[theManifest.RepoName]
|
||||||
|
@ -507,7 +507,7 @@ func TestGetManifests(t *testing.T) {
|
|||||||
manifests := conf.GetManifests()
|
manifests := conf.GetManifests()
|
||||||
require.NotNil(t, manifests)
|
require.NotNil(t, manifests)
|
||||||
|
|
||||||
assert.EqualValues(t, manifests[0].PrimaryRepositoryName, "primary")
|
assert.EqualValues(t, manifests[0].PhaseRepositoryName, "primary")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestModifyManifests(t *testing.T) {
|
func TestModifyManifests(t *testing.T) {
|
||||||
|
@ -70,8 +70,8 @@ const (
|
|||||||
|
|
||||||
// Default Value for manifest
|
// Default Value for manifest
|
||||||
const (
|
const (
|
||||||
// DefaultTestPrimaryRepo holds default repo name
|
// DefaultTestPhaseRepo holds default repo name
|
||||||
DefaultTestPrimaryRepo = "primary"
|
DefaultTestPhaseRepo = "primary"
|
||||||
// DefaultTargetPath holds default target path
|
// DefaultTargetPath holds default target path
|
||||||
DefaultTargetPath = "/tmp/default"
|
DefaultTargetPath = "/tmp/default"
|
||||||
// DefaultSubPath holds default sub path
|
// DefaultSubPath holds default sub path
|
||||||
|
@ -90,7 +90,7 @@ func (e ErrMissingRepositoryName) Error() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ErrMissingRepoURL is returned if repository is empty
|
// ErrMissingRepoURL is returned if repository is empty
|
||||||
// when using --primary in set-manifest
|
// when using --phase in set-manifest
|
||||||
type ErrMissingRepoURL struct {
|
type ErrMissingRepoURL struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,12 +171,12 @@ func (e ErrMissingManagementConfiguration) Error() string {
|
|||||||
e.context.NameInKubeconf)
|
e.context.NameInKubeconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrMissingPrimaryRepo returned when Primary Repository is not set in context manifest
|
// ErrMissingPhaseRepo returned when Phase Repository is not set in context manifest
|
||||||
type ErrMissingPrimaryRepo struct {
|
type ErrMissingPhaseRepo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e ErrMissingPrimaryRepo) Error() string {
|
func (e ErrMissingPhaseRepo) Error() string {
|
||||||
return "Current context manifest must have a primary repository set."
|
return "Current context manifest must have a phase repository set."
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrMissingPhaseDocument returned when appropriate Phase document was not found in the filesystem
|
// ErrMissingPhaseDocument returned when appropriate Phase document was not found in the filesystem
|
||||||
|
@ -19,16 +19,16 @@ import "sigs.k8s.io/yaml"
|
|||||||
// Manifest is a tuple of references to a Manifest (how do Identify, collect ,
|
// Manifest is a tuple of references to a Manifest (how do Identify, collect ,
|
||||||
// find the yaml manifests that airship uses to perform its operations)
|
// find the yaml manifests that airship uses to perform its operations)
|
||||||
type Manifest struct {
|
type Manifest struct {
|
||||||
// PrimaryRepositoryName is a name of the repo, that contains site/<site-name> directory
|
// PhaseRepositoryName is a name of the repo, that contains site/<site-name> directory
|
||||||
// and is a starting point for building document bundle
|
// and is a starting point for building document bundle
|
||||||
PrimaryRepositoryName string `json:"primaryRepositoryName"`
|
PhaseRepositoryName string `json:"phaseRepositoryName"`
|
||||||
// ExtraRepositories is the map of extra repositories addressable by a name
|
// ExtraRepositories is the map of extra repositories addressable by a name
|
||||||
Repositories map[string]*Repository `json:"repositories,omitempty"`
|
Repositories map[string]*Repository `json:"repositories,omitempty"`
|
||||||
// TargetPath Local Target path for working or home directory for all Manifest Cloned/Returned/Generated
|
// TargetPath Local Target path for working or home directory for all Manifest Cloned/Returned/Generated
|
||||||
TargetPath string `json:"targetPath"`
|
TargetPath string `json:"targetPath"`
|
||||||
// SubPath is a path relative to TargetPath + Path where PrimaryRepository is cloned and contains
|
// SubPath is a path relative to TargetPath + Path where PhaseRepository is cloned and contains
|
||||||
// directories with ClusterType and Phase bundles, example:
|
// directories with ClusterType and Phase bundles, example:
|
||||||
// Repositories[PrimaryRepositoryName].Url = 'https://github.com/airshipit/treasuremap'
|
// Repositories[PhaseRepositoryName].Url = 'https://github.com/airshipit/treasuremap'
|
||||||
// SubPath = "manifests"
|
// SubPath = "manifests"
|
||||||
// you would expect that at treasuremap/manifests you would have ephemeral/initinfra and
|
// you would expect that at treasuremap/manifests you would have ephemeral/initinfra and
|
||||||
// ephemera/target directories, containing kustomize.yaml.
|
// ephemera/target directories, containing kustomize.yaml.
|
||||||
|
@ -41,7 +41,7 @@ type ManifestOptions struct {
|
|||||||
Tag string
|
Tag string
|
||||||
RemoteRef string
|
RemoteRef string
|
||||||
Force bool
|
Force bool
|
||||||
IsPrimary bool
|
IsPhase bool
|
||||||
SubPath string
|
SubPath string
|
||||||
TargetPath string
|
TargetPath string
|
||||||
MetadataPath string
|
MetadataPath string
|
||||||
@ -90,7 +90,7 @@ func (o *ManifestOptions) Validate() error {
|
|||||||
if o.RemoteRef != "" {
|
if o.RemoteRef != "" {
|
||||||
return errors.ErrNotImplemented{What: "repository checkout by RemoteRef"}
|
return errors.ErrNotImplemented{What: "repository checkout by RemoteRef"}
|
||||||
}
|
}
|
||||||
if o.IsPrimary && o.RepoName == "" {
|
if o.IsPhase && o.RepoName == "" {
|
||||||
return ErrMissingRepositoryName{}
|
return ErrMissingRepositoryName{}
|
||||||
}
|
}
|
||||||
possibleValues := [3]string{o.CommitHash, o.Branch, o.Tag}
|
possibleValues := [3]string{o.CommitHash, o.Branch, o.Tag}
|
||||||
|
2
pkg/config/testdata/config-string.yaml
vendored
2
pkg/config/testdata/config-string.yaml
vendored
@ -18,7 +18,7 @@ managementConfiguration:
|
|||||||
manifests:
|
manifests:
|
||||||
dummy_manifest:
|
dummy_manifest:
|
||||||
metadataPath: manifests/site/test-site/metadata.yaml
|
metadataPath: manifests/site/test-site/metadata.yaml
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
repositories:
|
repositories:
|
||||||
primary:
|
primary:
|
||||||
auth:
|
auth:
|
||||||
|
2
pkg/config/testdata/manifest-string.yaml
vendored
2
pkg/config/testdata/manifest-string.yaml
vendored
@ -1,5 +1,5 @@
|
|||||||
metadataPath: manifests/site/test-site/metadata.yaml
|
metadataPath: manifests/site/test-site/metadata.yaml
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
repositories:
|
repositories:
|
||||||
primary:
|
primary:
|
||||||
auth:
|
auth:
|
||||||
|
@ -42,16 +42,16 @@ func NewConfig() *Config {
|
|||||||
Manifests: map[string]*Manifest{
|
Manifests: map[string]*Manifest{
|
||||||
AirshipDefaultManifest: {
|
AirshipDefaultManifest: {
|
||||||
Repositories: map[string]*Repository{
|
Repositories: map[string]*Repository{
|
||||||
DefaultTestPrimaryRepo: {
|
DefaultTestPhaseRepo: {
|
||||||
URLString: AirshipDefaultManifestRepoLocation,
|
URLString: AirshipDefaultManifestRepoLocation,
|
||||||
CheckoutOptions: &RepoCheckout{
|
CheckoutOptions: &RepoCheckout{
|
||||||
Branch: "master",
|
Branch: "master",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
TargetPath: "/tmp/" + AirshipDefaultManifest,
|
TargetPath: "/tmp/" + AirshipDefaultManifest,
|
||||||
PrimaryRepositoryName: DefaultTestPrimaryRepo,
|
PhaseRepositoryName: DefaultTestPhaseRepo,
|
||||||
SubPath: AirshipDefaultManifestRepo + "/manifests/site",
|
SubPath: AirshipDefaultManifestRepo + "/manifests/site",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -88,11 +88,11 @@ func NewContext() *Context {
|
|||||||
// object with non-nil maps
|
// object with non-nil maps
|
||||||
func NewManifest() *Manifest {
|
func NewManifest() *Manifest {
|
||||||
return &Manifest{
|
return &Manifest{
|
||||||
PrimaryRepositoryName: DefaultTestPrimaryRepo,
|
PhaseRepositoryName: DefaultTestPhaseRepo,
|
||||||
TargetPath: DefaultTargetPath,
|
TargetPath: DefaultTargetPath,
|
||||||
SubPath: DefaultSubPath,
|
SubPath: DefaultSubPath,
|
||||||
Repositories: map[string]*Repository{DefaultTestPrimaryRepo: NewRepository()},
|
Repositories: map[string]*Repository{DefaultTestPhaseRepo: NewRepository()},
|
||||||
MetadataPath: DefaultManifestMetadataFile,
|
MetadataPath: DefaultManifestMetadataFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ func mockConfigFactory(t *testing.T, testGitDir string, chkOutOpts *config.RepoC
|
|||||||
currentManifest, err := cfg.CurrentContextManifest()
|
currentManifest, err := cfg.CurrentContextManifest()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
currentManifest.Repositories = map[string]*config.Repository{
|
currentManifest.Repositories = map[string]*config.Repository{
|
||||||
currentManifest.PrimaryRepositoryName: {
|
currentManifest.PhaseRepositoryName: {
|
||||||
URLString: testGitDir,
|
URLString: testGitDir,
|
||||||
CheckoutOptions: chkOutOpts,
|
CheckoutOptions: chkOutOpts,
|
||||||
Auth: &config.RepoAuth{
|
Auth: &config.RepoAuth{
|
||||||
@ -51,7 +51,7 @@ func mockConfigFactory(t *testing.T, testGitDir string, chkOutOpts *config.RepoC
|
|||||||
|
|
||||||
_, err = repo.NewRepository(
|
_, err = repo.NewRepository(
|
||||||
".",
|
".",
|
||||||
currentManifest.Repositories[currentManifest.PrimaryRepositoryName],
|
currentManifest.Repositories[currentManifest.PhaseRepositoryName],
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ currentContext: dummy_cluster
|
|||||||
kind: Config
|
kind: Config
|
||||||
manifests:
|
manifests:
|
||||||
dummy_manifest:
|
dummy_manifest:
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
targetPath: testdata
|
targetPath: testdata
|
||||||
metadataPath: valid_site/metadata.yaml
|
metadataPath: valid_site/metadata.yaml
|
||||||
subPath: valid_site`
|
subPath: valid_site`
|
||||||
|
2
pkg/phase/testdata/airshipconfig.yaml
vendored
2
pkg/phase/testdata/airshipconfig.yaml
vendored
@ -7,7 +7,7 @@ currentContext: dummy_cluster
|
|||||||
kind: Config
|
kind: Config
|
||||||
manifests:
|
manifests:
|
||||||
dummy_manifest:
|
dummy_manifest:
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
targetPath: testdata
|
targetPath: testdata
|
||||||
metadataPath: valid_site/metadata.yaml
|
metadataPath: valid_site/metadata.yaml
|
||||||
repositories:
|
repositories:
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
when: remote_work_dir is defined
|
when: remote_work_dir is defined
|
||||||
- name: clone document model
|
- name: clone document model
|
||||||
command: git clone -q {{ airship_config_primary_repo_url }} {{ remote_work_dir }}
|
command: git clone -q {{ airship_config_phase_repo_url }} {{ remote_work_dir }}
|
||||||
when: remote_work_dir is defined
|
when: remote_work_dir is defined
|
||||||
|
|
||||||
- name: get VM config(MACs and bootMode) from BareMetalHost objects
|
- name: get VM config(MACs and bootMode) from BareMetalHost objects
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
airship_config_action: generate
|
airship_config_action: generate
|
||||||
airship_config_iso_gen_target_path: "{{ serve_dir }}"
|
airship_config_iso_gen_target_path: "{{ serve_dir }}"
|
||||||
airship_config_primary_repo_url: "https://review.opendev.org/airship/airshipctl"
|
airship_config_phase_repo_url: "https://review.opendev.org/airship/airshipctl"
|
||||||
airship_config_manifest_directory: "{{ remote_work_dir | default(zuul.project.src_dir) | default(local_src_dir) }}"
|
airship_config_manifest_directory: "{{ remote_work_dir | default(zuul.project.src_dir) | default(local_src_dir) }}"
|
||||||
airship_config_ephemeral_ip: "{{ airship_gate_ipam.nat_network.ephemeral_ip }}"
|
airship_config_ephemeral_ip: "{{ airship_gate_ipam.nat_network.ephemeral_ip }}"
|
||||||
airship_config_iso_builder_docker_image: "quay.io/airshipit/isogen:latest-ubuntu_focal"
|
airship_config_iso_builder_docker_image: "quay.io/airshipit/isogen:latest-ubuntu_focal"
|
||||||
|
@ -19,5 +19,5 @@
|
|||||||
vars:
|
vars:
|
||||||
default_zuul_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
default_zuul_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||||
environment:
|
environment:
|
||||||
AIRSHIP_CONFIG_PRIMARY_REPO_URL: "{{ remote_work_dir | default(local_src_dir) | default(default_zuul_dir) }}"
|
AIRSHIP_CONFIG_PHASE_REPO_URL: "{{ remote_work_dir | default(local_src_dir) | default(default_zuul_dir) }}"
|
||||||
SITE_NAME: "{{ site | default('test-site') }}"
|
SITE_NAME: "{{ site | default('test-site') }}"
|
||||||
|
@ -68,7 +68,7 @@ func DummyManifest() *config.Manifest {
|
|||||||
m := config.NewManifest()
|
m := config.NewManifest()
|
||||||
// Repositories is the map of repository addressable by a name
|
// Repositories is the map of repository addressable by a name
|
||||||
m.Repositories = map[string]*config.Repository{"primary": DummyRepository()}
|
m.Repositories = map[string]*config.Repository{"primary": DummyRepository()}
|
||||||
m.PrimaryRepositoryName = "primary"
|
m.PhaseRepositoryName = "primary"
|
||||||
m.TargetPath = "/var/tmp/"
|
m.TargetPath = "/var/tmp/"
|
||||||
m.SubPath = "manifests/site/test-site"
|
m.SubPath = "manifests/site/test-site"
|
||||||
return m
|
return m
|
||||||
@ -175,7 +175,7 @@ func DummyManifestOptions() *config.ManifestOptions {
|
|||||||
Name: "dummy_manifest",
|
Name: "dummy_manifest",
|
||||||
SubPath: "manifests/dummy_site",
|
SubPath: "manifests/dummy_site",
|
||||||
TargetPath: "/tmp/dummy_site",
|
TargetPath: "/tmp/dummy_site",
|
||||||
IsPrimary: true,
|
IsPhase: true,
|
||||||
RepoName: "dummy_repo",
|
RepoName: "dummy_repo",
|
||||||
URL: "https://github.com/treasuremap/dummy_site",
|
URL: "https://github.com/treasuremap/dummy_site",
|
||||||
Branch: "master",
|
Branch: "master",
|
||||||
|
@ -33,10 +33,10 @@ export AIRSHIP_CONFIG_ISO_NAME=${ISO_NAME:-"ubuntu-focal.iso"}
|
|||||||
export AIRSHIP_CONFIG_METADATA_PATH=${AIRSHIP_CONFIG_METADATA_PATH:-"airshipctl/manifests/metadata.yaml"}
|
export AIRSHIP_CONFIG_METADATA_PATH=${AIRSHIP_CONFIG_METADATA_PATH:-"airshipctl/manifests/metadata.yaml"}
|
||||||
export SYSTEM_ACTION_RETRIES=30
|
export SYSTEM_ACTION_RETRIES=30
|
||||||
export SYSTEM_REBOOT_DELAY=30
|
export SYSTEM_REBOOT_DELAY=30
|
||||||
export AIRSHIP_CONFIG_PRIMARY_REPO_BRANCH=${BRANCH:-"master"}
|
export AIRSHIP_CONFIG_PHASE_REPO_BRANCH=${BRANCH:-"master"}
|
||||||
# the git repo url or local file system path to a cloned repo, e.g., /home/stack/airshipctl
|
# the git repo url or local file system path to a cloned repo, e.g., /home/stack/airshipctl
|
||||||
export AIRSHIP_CONFIG_PRIMARY_REPO_URL=${AIRSHIP_CONFIG_PRIMARY_REPO_URL:-"https://review.opendev.org/airship/airshipctl"}
|
export AIRSHIP_CONFIG_PHASE_REPO_URL=${AIRSHIP_CONFIG_PHASE_REPO_URL:-"https://review.opendev.org/airship/airshipctl"}
|
||||||
export AIRSHIP_CONFIG_PRIMARY_REPO_NAME=${AIRSHIP_CONFIG_PRIMARY_REPO_NAME:-"airshipctl"}
|
export AIRSHIP_CONFIG_PHASE_REPO_NAME=${AIRSHIP_CONFIG_PHASE_REPO_NAME:-"airshipctl"}
|
||||||
export AIRSHIP_CONFIG_MANIFEST_DIRECTORY=${AIRSHIP_CONFIG_MANIFEST_DIRECTORY:-"/tmp/airship"}
|
export AIRSHIP_CONFIG_MANIFEST_DIRECTORY=${AIRSHIP_CONFIG_MANIFEST_DIRECTORY:-"/tmp/airship"}
|
||||||
export EPHEMERAL_CONFIG_CA_DATA=$(cat tools/deployment/certificates/ephemeral_config_ca_data| base64 -w0)
|
export EPHEMERAL_CONFIG_CA_DATA=$(cat tools/deployment/certificates/ephemeral_config_ca_data| base64 -w0)
|
||||||
export EPHEMERAL_IP=${EPHEMERAL_IP:-"10.23.25.101"}
|
export EPHEMERAL_IP=${EPHEMERAL_IP:-"10.23.25.101"}
|
||||||
|
@ -19,14 +19,14 @@ currentContext: ephemeral-cluster
|
|||||||
kind: Config
|
kind: Config
|
||||||
manifests:
|
manifests:
|
||||||
dummy_manifest:
|
dummy_manifest:
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
repositories:
|
repositories:
|
||||||
primary:
|
primary:
|
||||||
checkout:
|
checkout:
|
||||||
branch: ${AIRSHIP_CONFIG_PRIMARY_REPO_BRANCH}
|
branch: ${AIRSHIP_CONFIG_PHASE_REPO_BRANCH}
|
||||||
force: false
|
force: false
|
||||||
remoteRef: ""
|
remoteRef: ""
|
||||||
tag: ""
|
tag: ""
|
||||||
url: ${AIRSHIP_CONFIG_PRIMARY_REPO_URL}
|
url: ${AIRSHIP_CONFIG_PHASE_REPO_URL}
|
||||||
metadataPath: ${AIRSHIP_CONFIG_METADATA_PATH}
|
metadataPath: ${AIRSHIP_CONFIG_METADATA_PATH}
|
||||||
targetPath: ${AIRSHIP_CONFIG_MANIFEST_DIRECTORY}
|
targetPath: ${AIRSHIP_CONFIG_MANIFEST_DIRECTORY}
|
||||||
|
@ -68,7 +68,7 @@ managementConfiguration:
|
|||||||
type: redfish
|
type: redfish
|
||||||
manifests:
|
manifests:
|
||||||
${CONTEXT}_${cluster}:
|
${CONTEXT}_${cluster}:
|
||||||
primaryRepositoryName: primary
|
phaseRepositoryName: primary
|
||||||
repositories:
|
repositories:
|
||||||
primary:
|
primary:
|
||||||
checkout:
|
checkout:
|
||||||
|
@ -23,7 +23,7 @@ TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"}
|
|||||||
ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"}
|
ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"}
|
||||||
PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"}
|
PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"}
|
||||||
export AIRSHIPCTL_WS=${AIRSHIPCTL_WS:-$PWD}
|
export AIRSHIPCTL_WS=${AIRSHIPCTL_WS:-$PWD}
|
||||||
export AIRSHIP_CONFIG_PRIMARY_REPO_URL=${AIRSHIP_CONFIG_PRIMARY_REPO_URL:-$PWD}
|
export AIRSHIP_CONFIG_PHASE_REPO_URL=${AIRSHIP_CONFIG_PHASE_REPO_URL:-$PWD}
|
||||||
|
|
||||||
sudo --preserve-env=AIRSHIPCTL_WS ansible-playbook -i "$ANSIBLE_HOSTS" \
|
sudo --preserve-env=AIRSHIPCTL_WS ansible-playbook -i "$ANSIBLE_HOSTS" \
|
||||||
playbooks/airshipctl-gate-runner.yaml \
|
playbooks/airshipctl-gate-runner.yaml \
|
||||||
|
Loading…
Reference in New Issue
Block a user