From 0dc4ab749153a8545d4718494edb3587c529a5d2 Mon Sep 17 00:00:00 2001
From: Vladimir Kozhukalov <kozhukalov@gmail.com>
Date: Tue, 6 Oct 2020 13:18:41 +0300
Subject: [PATCH] Replace PrimaryRepositoryName with PhaseRepositoryName

Change-Id: I2276a3b3ea50b8e81dd240815cd00a0a2a2af96e
Relates-To: #356
---
 cmd/config/get_manifest_test.go               |  4 +--
 cmd/config/set_manifest.go                    | 12 ++++-----
 cmd/config/set_manifest_test.go               |  2 +-
 ...onfig-cmd-set-manifest-too-few-args.golden |  8 +++---
 ...nfig-cmd-set-manifest-too-many-args.golden |  8 +++---
 .../config-cmd-set-manifest-with-help.golden  |  8 +++---
 .../get-all-manifests.golden                  |  6 ++---
 .../get-manifest.golden                       |  2 +-
 .../cli/airshipctl_config_set-manifest.md     |  8 +++---
 docs/source/providers/cluster_api_docker.md   |  2 +-
 pkg/bootstrap/isogen/command_test.go          |  2 +-
 pkg/bootstrap/isogen/testdata/config/config   |  2 +-
 pkg/clusterctl/cmd/command_test.go            | 26 +++++++++----------
 .../cmd/testdata/airshipconfig.yaml           |  2 +-
 pkg/config/config.go                          | 12 ++++-----
 pkg/config/config_test.go                     |  2 +-
 pkg/config/constants.go                       |  4 +--
 pkg/config/errors.go                          | 10 +++----
 pkg/config/manifest.go                        |  8 +++---
 pkg/config/options.go                         |  4 +--
 pkg/config/testdata/config-string.yaml        |  2 +-
 pkg/config/testdata/manifest-string.yaml      |  2 +-
 pkg/config/utils.go                           | 18 ++++++-------
 pkg/document/pull/pull_test.go                |  4 +--
 pkg/phase/helper_test.go                      |  2 +-
 pkg/phase/testdata/airshipconfig.yaml         |  2 +-
 playbooks/airship-airshipctl-build-gate.yaml  |  2 +-
 playbooks/vars/test-config.yaml               |  2 +-
 roles/airshipctl-run-script/tasks/main.yaml   |  2 +-
 testutil/testconfig.go                        |  4 +--
 tools/deployment/22_test_configs.sh           |  6 ++---
 .../templates/airshipconfig_template          |  6 ++---
 tools/document/validate_site_docs.sh          |  2 +-
 tools/gate/20_run_gate_runner.sh              |  2 +-
 34 files changed, 94 insertions(+), 94 deletions(-)

diff --git a/cmd/config/get_manifest_test.go b/cmd/config/get_manifest_test.go
index 78cd0e74f..7f78e7aff 100644
--- a/cmd/config/get_manifest_test.go
+++ b/cmd/config/get_manifest_test.go
@@ -69,8 +69,8 @@ func TestGetManifestConfigCmd(t *testing.T) {
 
 func getTestManifest(name string) *config.Manifest {
 	manifests := &config.Manifest{
-		PrimaryRepositoryName: name + "_primary_repo",
-		TargetPath:            name + "_target_path",
+		PhaseRepositoryName: name + "_phase_repo",
+		TargetPath:          name + "_target_path",
 	}
 	return manifests
 }
diff --git a/cmd/config/set_manifest.go b/cmd/config/set_manifest.go
index 88075242d..d5c10c25e 100644
--- a/cmd/config/set_manifest.go
+++ b/cmd/config/set_manifest.go
@@ -34,14 +34,14 @@ airshipctl config set-manifest exampleManifest \
   --repo exampleRepo \
   --url https://github.com/site \
   --branch master \
-  --primary \
+  --phase \
   --sub-path exampleSubpath \
   --target-path exampleTargetpath
 
-# Change the primary repo for manifest
+# Change the phase repo for manifest
 airshipctl config set-manifest e2e \
   --repo exampleRepo \
-  --primary
+  --phase
 
 # Change the sub-path for manifest
 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")
 
 	flags.BoolVar(
-		&o.IsPrimary,
-		"primary",
+		&o.IsPhase,
+		"phase",
 		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(
 		&o.SubPath,
diff --git a/cmd/config/set_manifest_test.go b/cmd/config/set_manifest_test.go
index c3076400c..1e786a1bf 100644
--- a/cmd/config/set_manifest_test.go
+++ b/cmd/config/set_manifest_test.go
@@ -93,7 +93,7 @@ func TestSetManifest(t *testing.T) {
 				"--repo " + mRepoName,
 				"--url " + mURL,
 				"--branch " + mBranch,
-				"--primary",
+				"--phase",
 				"--sub-path " + mSubPath,
 				"--target-path " + mTargetPath,
 				"--metadata-path " + mMetadataPath,
diff --git a/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-few-args.golden b/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-few-args.golden
index 51780b6b3..5e37be58c 100644
--- a/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-few-args.golden
+++ b/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-few-args.golden
@@ -9,14 +9,14 @@ airshipctl config set-manifest exampleManifest \
   --repo exampleRepo \
   --url https://github.com/site \
   --branch master \
-  --primary \
+  --phase \
   --sub-path exampleSubpath \
   --target-path exampleTargetpath
 
-# Change the primary repo for manifest
+# Change the phase repo for manifest
 airshipctl config set-manifest e2e \
   --repo exampleRepo \
-  --primary
+  --phase
 
 # Change the sub-path for manifest
 airshipctl config set-manifest e2e \
@@ -33,7 +33,7 @@ Flags:
       --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
+      --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
       --sub-path string        the sub path to be set for this manifest
       --tag string             the tag to be associated with repository in this manifest
diff --git a/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-many-args.golden b/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-many-args.golden
index 14a6ad300..fd471cdc7 100644
--- a/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-many-args.golden
+++ b/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-too-many-args.golden
@@ -9,14 +9,14 @@ airshipctl config set-manifest exampleManifest \
   --repo exampleRepo \
   --url https://github.com/site \
   --branch master \
-  --primary \
+  --phase \
   --sub-path exampleSubpath \
   --target-path exampleTargetpath
 
-# Change the primary repo for manifest
+# Change the phase repo for manifest
 airshipctl config set-manifest e2e \
   --repo exampleRepo \
-  --primary
+  --phase
 
 # Change the sub-path for manifest
 airshipctl config set-manifest e2e \
@@ -33,7 +33,7 @@ Flags:
       --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
+      --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
       --sub-path string        the sub path to be set for this manifest
       --tag string             the tag to be associated with repository in this manifest
diff --git a/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-with-help.golden b/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-with-help.golden
index e5cdc8d8d..9d1fd5a9f 100644
--- a/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-with-help.golden
+++ b/cmd/config/testdata/TestConfigSetManifestGoldenOutput/config-cmd-set-manifest-with-help.golden
@@ -10,14 +10,14 @@ airshipctl config set-manifest exampleManifest \
   --repo exampleRepo \
   --url https://github.com/site \
   --branch master \
-  --primary \
+  --phase \
   --sub-path exampleSubpath \
   --target-path exampleTargetpath
 
-# Change the primary repo for manifest
+# Change the phase repo for manifest
 airshipctl config set-manifest e2e \
   --repo exampleRepo \
-  --primary
+  --phase
 
 # Change the sub-path for manifest
 airshipctl config set-manifest e2e \
@@ -34,7 +34,7 @@ Flags:
       --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
+      --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
       --sub-path string        the sub path to be set for this manifest
       --tag string             the tag to be associated with repository in this manifest
diff --git a/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-all-manifests.golden b/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-all-manifests.golden
index 53434041b..12be3d3ad 100644
--- a/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-all-manifests.golden
+++ b/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-all-manifests.golden
@@ -1,15 +1,15 @@
 metadataPath: ""
-primaryRepositoryName: bar_primary_repo
+phaseRepositoryName: bar_phase_repo
 subPath: ""
 targetPath: bar_target_path
 
 metadataPath: ""
-primaryRepositoryName: baz_primary_repo
+phaseRepositoryName: baz_phase_repo
 subPath: ""
 targetPath: baz_target_path
 
 metadataPath: ""
-primaryRepositoryName: foo_primary_repo
+phaseRepositoryName: foo_phase_repo
 subPath: ""
 targetPath: foo_target_path
 
diff --git a/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-manifest.golden b/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-manifest.golden
index 4306f08ed..2da83f0c9 100644
--- a/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-manifest.golden
+++ b/cmd/config/testdata/TestGetManifestConfigCmdGoldenOutput/get-manifest.golden
@@ -1,5 +1,5 @@
 metadataPath: ""
-primaryRepositoryName: foo_primary_repo
+phaseRepositoryName: foo_phase_repo
 subPath: ""
 targetPath: foo_target_path
 
diff --git a/docs/source/cli/airshipctl_config_set-manifest.md b/docs/source/cli/airshipctl_config_set-manifest.md
index 07cfb9e56..28af086de 100644
--- a/docs/source/cli/airshipctl_config_set-manifest.md
+++ b/docs/source/cli/airshipctl_config_set-manifest.md
@@ -20,14 +20,14 @@ airshipctl config set-manifest exampleManifest \
   --repo exampleRepo \
   --url https://github.com/site \
   --branch master \
-  --primary \
+  --phase \
   --sub-path exampleSubpath \
   --target-path exampleTargetpath
 
-# Change the primary repo for manifest
+# Change the phase repo for manifest
 airshipctl config set-manifest e2e \
   --repo exampleRepo \
-  --primary
+  --phase
 
 # Change the sub-path for manifest
 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
   -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
+      --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
       --sub-path string        the sub path to be set for this manifest
       --tag string             the tag to be associated with repository in this manifest
diff --git a/docs/source/providers/cluster_api_docker.md b/docs/source/providers/cluster_api_docker.md
index 9a076508f..78a6482a7 100755
--- a/docs/source/providers/cluster_api_docker.md
+++ b/docs/source/providers/cluster_api_docker.md
@@ -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 \
 --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
diff --git a/pkg/bootstrap/isogen/command_test.go b/pkg/bootstrap/isogen/command_test.go
index c8e197669..a3ff53bb5 100644
--- a/pkg/bootstrap/isogen/command_test.go
+++ b/pkg/bootstrap/isogen/command_test.go
@@ -264,7 +264,7 @@ func TestGenerateBootstrapIso(t *testing.T) {
 		settings := func() (*config.Config, error) {
 			return cfg, nil
 		}
-		expectedErr := config.ErrMissingPrimaryRepo{}
+		expectedErr := config.ErrMissingPhaseRepo{}
 		actualErr := GenerateBootstrapIso(settings, false)
 		assert.Equal(t, expectedErr, actualErr)
 	})
diff --git a/pkg/bootstrap/isogen/testdata/config/config b/pkg/bootstrap/isogen/testdata/config/config
index 51cab05e7..2046db657 100644
--- a/pkg/bootstrap/isogen/testdata/config/config
+++ b/pkg/bootstrap/isogen/testdata/config/config
@@ -19,7 +19,7 @@ managementConfiguration:
     type: redfish
 manifests:
   default:
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     repositories:
       primary:
         checkout:
diff --git a/pkg/clusterctl/cmd/command_test.go b/pkg/clusterctl/cmd/command_test.go
index 10c311d18..9ff3824e9 100644
--- a/pkg/clusterctl/cmd/command_test.go
+++ b/pkg/clusterctl/cmd/command_test.go
@@ -45,9 +45,9 @@ func TestNewCommand(t *testing.T) {
 			currentContext: validContext,
 			manifests: map[string]*config.Manifest{
 				manifestName: {
-					TargetPath:            "testdata",
-					SubPath:               "valid",
-					PrimaryRepositoryName: "primary",
+					TargetPath:          "testdata",
+					SubPath:             "valid",
+					PhaseRepositoryName: "primary",
 					Repositories: map[string]*config.Repository{
 						"primary": {},
 					},
@@ -60,9 +60,9 @@ func TestNewCommand(t *testing.T) {
 			expectErr:      true,
 			manifests: map[string]*config.Manifest{
 				manifestName: {
-					TargetPath:            "testdata",
-					SubPath:               "invalid-path",
-					PrimaryRepositoryName: "primary",
+					TargetPath:          "testdata",
+					SubPath:             "invalid-path",
+					PhaseRepositoryName: "primary",
 					Repositories: map[string]*config.Repository{
 						"primary": {},
 					},
@@ -75,9 +75,9 @@ func TestNewCommand(t *testing.T) {
 			expectErr:      true,
 			manifests: map[string]*config.Manifest{
 				manifestName: {
-					TargetPath:            "testdata",
-					SubPath:               "no-clusterctl",
-					PrimaryRepositoryName: "primary",
+					TargetPath:          "testdata",
+					SubPath:             "no-clusterctl",
+					PhaseRepositoryName: "primary",
 					Repositories: map[string]*config.Repository{
 						"primary": {},
 					},
@@ -85,7 +85,7 @@ func TestNewCommand(t *testing.T) {
 			},
 		},
 		{
-			name:      "no primary repo",
+			name:      "no phase repo",
 			expectErr: true,
 			manifests: map[string]*config.Manifest{
 				manifestName: {
@@ -99,9 +99,9 @@ func TestNewCommand(t *testing.T) {
 			expectErr:      true,
 			manifests: map[string]*config.Manifest{
 				manifestName: {
-					TargetPath:            "testdata",
-					SubPath:               "can't build bundle",
-					PrimaryRepositoryName: "primary",
+					TargetPath:          "testdata",
+					SubPath:             "can't build bundle",
+					PhaseRepositoryName: "primary",
 					Repositories: map[string]*config.Repository{
 						"primary": {},
 					},
diff --git a/pkg/clusterctl/cmd/testdata/airshipconfig.yaml b/pkg/clusterctl/cmd/testdata/airshipconfig.yaml
index fe1b4ecdf..93ff10e85 100644
--- a/pkg/clusterctl/cmd/testdata/airshipconfig.yaml
+++ b/pkg/clusterctl/cmd/testdata/airshipconfig.yaml
@@ -7,7 +7,7 @@ currentContext: dummy_cluster
 kind: Config
 manifests:
   dummy_manifest:
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     repositories:
       primary:
         auth:
diff --git a/pkg/config/config.go b/pkg/config/config.go
index 34ff376c0..b34888592 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -338,9 +338,9 @@ func (c *Config) CurrentContextEntryPoint(phase string) (string, error) {
 	if err != nil {
 		return "", err
 	}
-	_, exists := ccm.Repositories[ccm.PrimaryRepositoryName]
+	_, exists := ccm.Repositories[ccm.PhaseRepositoryName]
 	if !exists {
-		return "", ErrMissingPrimaryRepo{}
+		return "", ErrMissingPhaseRepo{}
 	}
 	epp := path.Join(ccm.TargetPath, ccm.SubPath, clusterType, phase)
 	if _, err := os.Stat(epp); err != nil {
@@ -404,8 +404,8 @@ func (c *Config) AddManifest(theManifest *ManifestOptions) *Manifest {
 
 // ModifyManifest set actual values to manifests
 func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions) error {
-	if theManifest.IsPrimary {
-		manifest.PrimaryRepositoryName = theManifest.RepoName
+	if theManifest.IsPhase {
+		manifest.PhaseRepositoryName = theManifest.RepoName
 	}
 	if theManifest.SubPath != "" {
 		manifest.SubPath = theManifest.SubPath
@@ -420,9 +420,9 @@ func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions
 	if theManifest.RepoName == "" {
 		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
-	if theManifest.IsPrimary && theManifest.URL == "" && (manifest.Repositories[theManifest.RepoName] == nil) {
+	if theManifest.IsPhase && theManifest.URL == "" && (manifest.Repositories[theManifest.RepoName] == nil) {
 		return ErrRepositoryNotFound{theManifest.RepoName}
 	}
 	repository, exists := manifest.Repositories[theManifest.RepoName]
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
index bfd1ef553..e648b1c50 100644
--- a/pkg/config/config_test.go
+++ b/pkg/config/config_test.go
@@ -507,7 +507,7 @@ func TestGetManifests(t *testing.T) {
 	manifests := conf.GetManifests()
 	require.NotNil(t, manifests)
 
-	assert.EqualValues(t, manifests[0].PrimaryRepositoryName, "primary")
+	assert.EqualValues(t, manifests[0].PhaseRepositoryName, "primary")
 }
 
 func TestModifyManifests(t *testing.T) {
diff --git a/pkg/config/constants.go b/pkg/config/constants.go
index b296b0dd8..ae9e2d293 100644
--- a/pkg/config/constants.go
+++ b/pkg/config/constants.go
@@ -70,8 +70,8 @@ const (
 
 // Default Value for manifest
 const (
-	// DefaultTestPrimaryRepo holds default repo name
-	DefaultTestPrimaryRepo = "primary"
+	// DefaultTestPhaseRepo holds default repo name
+	DefaultTestPhaseRepo = "primary"
 	// DefaultTargetPath holds default target path
 	DefaultTargetPath = "/tmp/default"
 	// DefaultSubPath holds default sub path
diff --git a/pkg/config/errors.go b/pkg/config/errors.go
index 66a8b4f9b..641510935 100644
--- a/pkg/config/errors.go
+++ b/pkg/config/errors.go
@@ -90,7 +90,7 @@ func (e ErrMissingRepositoryName) Error() string {
 }
 
 // ErrMissingRepoURL is returned if repository is empty
-// when using --primary in set-manifest
+// when using --phase in set-manifest
 type ErrMissingRepoURL struct {
 }
 
@@ -171,12 +171,12 @@ func (e ErrMissingManagementConfiguration) Error() string {
 		e.context.NameInKubeconf)
 }
 
-// ErrMissingPrimaryRepo returned when Primary Repository is not set in context manifest
-type ErrMissingPrimaryRepo struct {
+// ErrMissingPhaseRepo returned when Phase Repository is not set in context manifest
+type ErrMissingPhaseRepo struct {
 }
 
-func (e ErrMissingPrimaryRepo) Error() string {
-	return "Current context manifest must have a primary repository set."
+func (e ErrMissingPhaseRepo) Error() string {
+	return "Current context manifest must have a phase repository set."
 }
 
 // ErrMissingPhaseDocument returned when appropriate Phase document was not found in the filesystem
diff --git a/pkg/config/manifest.go b/pkg/config/manifest.go
index 8ae1b9fd7..d4576a6d1 100644
--- a/pkg/config/manifest.go
+++ b/pkg/config/manifest.go
@@ -19,16 +19,16 @@ import "sigs.k8s.io/yaml"
 // Manifest is a tuple of references to a Manifest (how do Identify, collect ,
 // find the yaml manifests that airship uses to perform its operations)
 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
-	PrimaryRepositoryName string `json:"primaryRepositoryName"`
+	PhaseRepositoryName string `json:"phaseRepositoryName"`
 	// ExtraRepositories is the map of extra repositories addressable by a name
 	Repositories map[string]*Repository `json:"repositories,omitempty"`
 	// TargetPath Local Target path for working or home directory for all Manifest Cloned/Returned/Generated
 	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:
-	// Repositories[PrimaryRepositoryName].Url = 'https://github.com/airshipit/treasuremap'
+	// Repositories[PhaseRepositoryName].Url = 'https://github.com/airshipit/treasuremap'
 	// SubPath = "manifests"
 	// you would expect that at treasuremap/manifests you would have ephemeral/initinfra and
 	// ephemera/target directories, containing kustomize.yaml.
diff --git a/pkg/config/options.go b/pkg/config/options.go
index ceb294ca0..637e29db6 100644
--- a/pkg/config/options.go
+++ b/pkg/config/options.go
@@ -41,7 +41,7 @@ type ManifestOptions struct {
 	Tag          string
 	RemoteRef    string
 	Force        bool
-	IsPrimary    bool
+	IsPhase      bool
 	SubPath      string
 	TargetPath   string
 	MetadataPath string
@@ -90,7 +90,7 @@ func (o *ManifestOptions) Validate() error {
 	if o.RemoteRef != "" {
 		return errors.ErrNotImplemented{What: "repository checkout by RemoteRef"}
 	}
-	if o.IsPrimary && o.RepoName == "" {
+	if o.IsPhase && o.RepoName == "" {
 		return ErrMissingRepositoryName{}
 	}
 	possibleValues := [3]string{o.CommitHash, o.Branch, o.Tag}
diff --git a/pkg/config/testdata/config-string.yaml b/pkg/config/testdata/config-string.yaml
index df5ab2f51..3881b1c8c 100644
--- a/pkg/config/testdata/config-string.yaml
+++ b/pkg/config/testdata/config-string.yaml
@@ -18,7 +18,7 @@ managementConfiguration:
 manifests:
   dummy_manifest:
     metadataPath: manifests/site/test-site/metadata.yaml
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     repositories:
       primary:
         auth:
diff --git a/pkg/config/testdata/manifest-string.yaml b/pkg/config/testdata/manifest-string.yaml
index 2a7eba873..9e1239a5d 100644
--- a/pkg/config/testdata/manifest-string.yaml
+++ b/pkg/config/testdata/manifest-string.yaml
@@ -1,5 +1,5 @@
 metadataPath: manifests/site/test-site/metadata.yaml
-primaryRepositoryName: primary
+phaseRepositoryName: primary
 repositories:
   primary:
     auth:
diff --git a/pkg/config/utils.go b/pkg/config/utils.go
index 94f848bac..80f71095e 100644
--- a/pkg/config/utils.go
+++ b/pkg/config/utils.go
@@ -42,16 +42,16 @@ func NewConfig() *Config {
 		Manifests: map[string]*Manifest{
 			AirshipDefaultManifest: {
 				Repositories: map[string]*Repository{
-					DefaultTestPrimaryRepo: {
+					DefaultTestPhaseRepo: {
 						URLString: AirshipDefaultManifestRepoLocation,
 						CheckoutOptions: &RepoCheckout{
 							Branch: "master",
 						},
 					},
 				},
-				TargetPath:            "/tmp/" + AirshipDefaultManifest,
-				PrimaryRepositoryName: DefaultTestPrimaryRepo,
-				SubPath:               AirshipDefaultManifestRepo + "/manifests/site",
+				TargetPath:          "/tmp/" + AirshipDefaultManifest,
+				PhaseRepositoryName: DefaultTestPhaseRepo,
+				SubPath:             AirshipDefaultManifestRepo + "/manifests/site",
 			},
 		},
 	}
@@ -88,11 +88,11 @@ func NewContext() *Context {
 // object with non-nil maps
 func NewManifest() *Manifest {
 	return &Manifest{
-		PrimaryRepositoryName: DefaultTestPrimaryRepo,
-		TargetPath:            DefaultTargetPath,
-		SubPath:               DefaultSubPath,
-		Repositories:          map[string]*Repository{DefaultTestPrimaryRepo: NewRepository()},
-		MetadataPath:          DefaultManifestMetadataFile,
+		PhaseRepositoryName: DefaultTestPhaseRepo,
+		TargetPath:          DefaultTargetPath,
+		SubPath:             DefaultSubPath,
+		Repositories:        map[string]*Repository{DefaultTestPhaseRepo: NewRepository()},
+		MetadataPath:        DefaultManifestMetadataFile,
 	}
 }
 
diff --git a/pkg/document/pull/pull_test.go b/pkg/document/pull/pull_test.go
index e2a7dd580..aeb5fbf4b 100644
--- a/pkg/document/pull/pull_test.go
+++ b/pkg/document/pull/pull_test.go
@@ -38,7 +38,7 @@ func mockConfigFactory(t *testing.T, testGitDir string, chkOutOpts *config.RepoC
 		currentManifest, err := cfg.CurrentContextManifest()
 		require.NoError(t, err)
 		currentManifest.Repositories = map[string]*config.Repository{
-			currentManifest.PrimaryRepositoryName: {
+			currentManifest.PhaseRepositoryName: {
 				URLString:       testGitDir,
 				CheckoutOptions: chkOutOpts,
 				Auth: &config.RepoAuth{
@@ -51,7 +51,7 @@ func mockConfigFactory(t *testing.T, testGitDir string, chkOutOpts *config.RepoC
 
 		_, err = repo.NewRepository(
 			".",
-			currentManifest.Repositories[currentManifest.PrimaryRepositoryName],
+			currentManifest.Repositories[currentManifest.PhaseRepositoryName],
 		)
 		require.NoError(t, err)
 
diff --git a/pkg/phase/helper_test.go b/pkg/phase/helper_test.go
index 68026310c..08c2bf8a6 100644
--- a/pkg/phase/helper_test.go
+++ b/pkg/phase/helper_test.go
@@ -446,7 +446,7 @@ currentContext: dummy_cluster
 kind: Config
 manifests:
   dummy_manifest:
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     targetPath: testdata
     metadataPath: valid_site/metadata.yaml
     subPath: valid_site`
diff --git a/pkg/phase/testdata/airshipconfig.yaml b/pkg/phase/testdata/airshipconfig.yaml
index 38a5bace2..3d7f80977 100644
--- a/pkg/phase/testdata/airshipconfig.yaml
+++ b/pkg/phase/testdata/airshipconfig.yaml
@@ -7,7 +7,7 @@ currentContext: dummy_cluster
 kind: Config
 manifests:
   dummy_manifest:
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     targetPath: testdata
     metadataPath: valid_site/metadata.yaml
     repositories:
diff --git a/playbooks/airship-airshipctl-build-gate.yaml b/playbooks/airship-airshipctl-build-gate.yaml
index 403d4bdfc..8180b0427 100644
--- a/playbooks/airship-airshipctl-build-gate.yaml
+++ b/playbooks/airship-airshipctl-build-gate.yaml
@@ -58,7 +58,7 @@
             state: absent
           when: remote_work_dir is defined
         - 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
 
     - name: get VM config(MACs and bootMode) from BareMetalHost objects
diff --git a/playbooks/vars/test-config.yaml b/playbooks/vars/test-config.yaml
index 3fd689998..48bff310c 100644
--- a/playbooks/vars/test-config.yaml
+++ b/playbooks/vars/test-config.yaml
@@ -12,7 +12,7 @@
 
 airship_config_action: generate
 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_ephemeral_ip: "{{ airship_gate_ipam.nat_network.ephemeral_ip }}"
 airship_config_iso_builder_docker_image: "quay.io/airshipit/isogen:latest-ubuntu_focal"
diff --git a/roles/airshipctl-run-script/tasks/main.yaml b/roles/airshipctl-run-script/tasks/main.yaml
index fb9a09688..d34a89ea2 100644
--- a/roles/airshipctl-run-script/tasks/main.yaml
+++ b/roles/airshipctl-run-script/tasks/main.yaml
@@ -19,5 +19,5 @@
   vars:
     default_zuul_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
   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') }}"
diff --git a/testutil/testconfig.go b/testutil/testconfig.go
index acd8efc30..bbfb98863 100644
--- a/testutil/testconfig.go
+++ b/testutil/testconfig.go
@@ -68,7 +68,7 @@ func DummyManifest() *config.Manifest {
 	m := config.NewManifest()
 	// Repositories is the map of repository addressable by a name
 	m.Repositories = map[string]*config.Repository{"primary": DummyRepository()}
-	m.PrimaryRepositoryName = "primary"
+	m.PhaseRepositoryName = "primary"
 	m.TargetPath = "/var/tmp/"
 	m.SubPath = "manifests/site/test-site"
 	return m
@@ -175,7 +175,7 @@ func DummyManifestOptions() *config.ManifestOptions {
 		Name:       "dummy_manifest",
 		SubPath:    "manifests/dummy_site",
 		TargetPath: "/tmp/dummy_site",
-		IsPrimary:  true,
+		IsPhase:    true,
 		RepoName:   "dummy_repo",
 		URL:        "https://github.com/treasuremap/dummy_site",
 		Branch:     "master",
diff --git a/tools/deployment/22_test_configs.sh b/tools/deployment/22_test_configs.sh
index d5128e1be..5fb3e16a5 100755
--- a/tools/deployment/22_test_configs.sh
+++ b/tools/deployment/22_test_configs.sh
@@ -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 SYSTEM_ACTION_RETRIES=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
-export AIRSHIP_CONFIG_PRIMARY_REPO_URL=${AIRSHIP_CONFIG_PRIMARY_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_URL=${AIRSHIP_CONFIG_PHASE_REPO_URL:-"https://review.opendev.org/airship/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 EPHEMERAL_CONFIG_CA_DATA=$(cat tools/deployment/certificates/ephemeral_config_ca_data| base64 -w0)
 export EPHEMERAL_IP=${EPHEMERAL_IP:-"10.23.25.101"}
diff --git a/tools/deployment/templates/airshipconfig_template b/tools/deployment/templates/airshipconfig_template
index 946d9671e..43cf36e46 100644
--- a/tools/deployment/templates/airshipconfig_template
+++ b/tools/deployment/templates/airshipconfig_template
@@ -19,14 +19,14 @@ currentContext: ephemeral-cluster
 kind: Config
 manifests:
   dummy_manifest:
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     repositories:
       primary:
         checkout:
-          branch: ${AIRSHIP_CONFIG_PRIMARY_REPO_BRANCH}
+          branch: ${AIRSHIP_CONFIG_PHASE_REPO_BRANCH}
           force: false
           remoteRef: ""
           tag: ""
-        url: ${AIRSHIP_CONFIG_PRIMARY_REPO_URL}
+        url: ${AIRSHIP_CONFIG_PHASE_REPO_URL}
     metadataPath: ${AIRSHIP_CONFIG_METADATA_PATH}
     targetPath: ${AIRSHIP_CONFIG_MANIFEST_DIRECTORY}
diff --git a/tools/document/validate_site_docs.sh b/tools/document/validate_site_docs.sh
index 9be328c18..30f797fcc 100755
--- a/tools/document/validate_site_docs.sh
+++ b/tools/document/validate_site_docs.sh
@@ -68,7 +68,7 @@ managementConfiguration:
     type: redfish
 manifests:
   ${CONTEXT}_${cluster}:
-    primaryRepositoryName: primary
+    phaseRepositoryName: primary
     repositories:
       primary:
         checkout:
diff --git a/tools/gate/20_run_gate_runner.sh b/tools/gate/20_run_gate_runner.sh
index b9f372ac8..03e861624 100755
--- a/tools/gate/20_run_gate_runner.sh
+++ b/tools/gate/20_run_gate_runner.sh
@@ -23,7 +23,7 @@ TMP_DIR=${TMP_DIR:-"$(dirname $(mktemp -u))"}
 ANSIBLE_HOSTS=${ANSIBLE_HOSTS:-"${TMP_DIR}/ansible_hosts"}
 PLAYBOOK_CONFIG=${PLAYBOOK_CONFIG:-"${TMP_DIR}/config.yaml"}
 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" \
 	playbooks/airshipctl-gate-runner.yaml \