Currently airshipctl is not able to checkout remote branch
due to using simple branch reference name instead of remote one.
This patch fixes appropriate problem and allows user to specify
what kind of branch to use - local or remote one (since reference
name will be different in these scenarios).
Change-Id: I1fea29f84097b9e7160597003d0e8961f4d3aca6
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Currently we don't test document pull step by rewriting
manifest_directory variable as current source path, which
makes a mess in target_path, manifest_path and related paths
(concatenation of target_path+manifest_path won't return
an existing and proper location). This patch organizes
mentioned variables and enables document pull step which
starts working properly. The latest repo state used as
git source for this command.
Change-Id: I5abce73877441c7529f2f77add79cf410e2226d8
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
This command was refactored for usage with new config factory.
Config object now is being initialized in pkg module on demand,
which provides more flexibility and cleaner code.
Change-Id: Iff75eb66db2fee922e6db1bf2930892c02c3b601
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #327
This patch refactors some code and adds useful debug/info log output.
Change-Id: I590f6e5c300e5c91443af0a8fdb1073229602a67
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #278
This causes the document pull unit tests to use a git repo stored
locally on the machine, rather than reaching out to github
Change-Id: I0add3cdf60d7fe584c0194148e539a7a290f2bc4
* invoke EnsureComplete before document pull to make sure
all expected sections (cluster, context, authinfo, currentcontext)
of config are present
Change-Id: If2ef4611cddc6ae96797dc26675551ef81ca8768
Closes: #215
By specifying any other branch rather than master in airshipctl config,
`airshipctl document pull` command failing with `reference not found`
error.
The resulted target dir, after execution, still pointing to master.
The idea of this change is to use checkout options during the clone
stage, so we will be clonning the specific branch.
Added debug log about cloning default(master) branch in case of
missing checkout options.
Enabled validation for incompatible parameters in checkout options.
Aligned unit tests with code changes.
Closes: #197
Change-Id: I50ac18289a8f02997d5b90c82f1688083cff8bf3
The go-git module (and helper modules) recently moved from
`gopkg.in/src-d/go-git` to `github.com/go-git/go-git` [0]. This commit
switches to the new module, as well as uplifts from v4 to v5.
[0] https://github.com/src-d/go-git/issues/1295#issuecomment-592965250
Change-Id: I2e73ba7bb1220a3c75c0d81aa5ab0f1f13479161
* added license templates for go, bash & yaml in tools dir
* added a script that will add license information for all
missing files. Type: go, yaml, yml, sh
* skip adding license for all files within testdata
* Syntax:
> ./tools/add_license.sh
* Skip license for manifests folder
* Added one extra line after licene for yaml files
* Added License after Hashbang for bash.
* Add an extra line after hashbang and before license
* Updated the go template to use multiline comments
New Files:
1. tools/add_license.sh
2. tools/license_go.txt
3. tools/license_yaml.txt
4. tools/license_bash.txt
Change-Id: Ia4da5b261e7cd518d446896b72c810421877472a
Realtes-To:#147
This change removes the getters and setters for the following attributes
of pkg/environment.AirshipCTLSettings:
* airshipConfigPath
* kubeConfigPath
* config
The above attributes have been exported to account for the removal of
these methods.
Change-Id: I4e7d38bf6771f7521179a2fe2990475b936b5d95
Add NewBundleByPath function, that would return bundle built from
the specified path argument
Add CurrentContextEntryPoint method of the config
object, that would allow easily get kustomize root path based on
clusterType and phase. You can also leave phase arg empty string,
which would try to return bundle for all phases
Introduce changes to config pakage objects:
- Manifest:
SubPath: this is relative path to the root of the repository that
contains directories with sites (SiteNames)
PrimaryRepositoryName: this is a string that must correspond to a key
of the Repositories map of manifest object, which is used to derive
primary repository
Repositories object is a map, map keys correspond to names of the
directories where `document pull` command will download repositories
defined in manifest prepended by manifest.TargetPath.
Introduce new config method CurrentContextEntryPoint(), method takes
TargetPath, PrimaryRepo.URL, SubPath, and clusterType and phase
constructs a path to the entry point out of which the DocumentBundle
should be build, and returns it to the caller. After that caller can
build a bundle out of it, the bundle will contain documents relevant to
particular cluster-type and phase.
All objects that depend on bundle interface are updated to use the
CurrentContextEntryPoint() method of the config object
Relates-To: #99
Closes: #99
Change-Id: I99320c4cb626841d46f4c298b583e9af90b1dce4
This relocates tests that were improperly placed within the config pkg for both
the pkg/config and cmd/config packages. These were causing testutil to be imported
outside of tests causing a cyclic import issue when trying to import the config
pkg within the document pkg.
This patchset moves the tests as well as refactoring several of them where they
were leveraging private attributes which cannot be accessed as an external test
pkg.
Closes: #109
Relates-To: #107
Change-Id: Ib1bf2aff020599ba0b3f5a7fd7fadf737b8c86b8
This commit adds the utility testing function TempDir, which provides a
tester with a temporary directory as well as a means of cleaning up that
directory. The new function is implemented everywhere that makes sense
throughout the code base.
This also cleans up the directories left behind by go-git's testing
fixtures.
Some light refactoring was also performed in this change.
Change-Id: I754484934660487140f57671bacb5463cf669e3e
Adds `airshipctl document pull` command that will check the current
manifest specified by the config and download it to the config specified
target path.
Change-Id: I493564c056225ff1e19f5d1aecb8c187683529ec