14 Commits

Author SHA1 Message Date
Ian Howell
cb080a2066 Implement fetching remote refs for document pull
This commit adds the `fetch` and `fetch.remoteRefSpec` fields to the
configuration for repositories, allowing the capability to fetch
references from a remote. This is useful for pulling specific gerrit
patchsets.

This also changes `checkout.remoteRefSpec` to `checkout.refSpec`, and
implements the logic required to checkout to an arbitrary ref.

Closes: #616

Change-Id: Ie21a6c2a7a7ac92ed3c05fef7e5683203cd62e45
2021-07-29 10:16:27 -05:00
Ruslan Aliev
d8a6139e81 Add document pull step to gate script runner
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>
2020-09-25 00:39:28 -05:00
Stanislav Egorov
61ed8d30b7 Fixed TODO in document/repo package
Implemented strongly-typed errors for document/repo

Change-Id: I572489b4c48ff4cd75a4e2f9a6b1d27ad1f840dd
2020-08-28 12:24:54 -07:00
Ruslan Aliev
71f7a8bc85 Improve document pull command
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
2020-07-28 22:01:20 +00:00
Yasin, Siraj (SY495P)
8d16fffb7c Fix Lint warnings: Missing comments for functions
* Added comments wherever missing for exported functions/constants

Change-Id: I7d0b79b5f56fc6c3edb60a3b58c0962ebd76314c
Relates-To: #148
2020-05-19 16:54:09 +00:00
Ian Howell
7c6de22354 Uplift go-git
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
2020-04-14 09:07:28 -05:00
Yasin, Siraj (SY495P)
c25d223c7b Add copyright for missing files
* 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
2020-04-09 08:35:59 -05:00
Kostiantyn Kalynovskyi
147b97048b Split document model, add entrypoints for repos
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
2020-03-12 09:55:05 -05:00
Alexander Hughes
7549fdbeb0 [#86] remove unused code
A number of items were identified by GoLand's code inspection as
being unused.  These are being removed in this change.

Change-Id: I0c8c0b5f5c33f2e715f991a02ddd63174758c533
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-03-10 19:15:04 +00:00
Alexander Hughes
dd1dba6eb3 [#58] Update var names to be golint compliant
This patch resolves complaints from golint such as:

cmd/config/set_authinfo_test.go:84:3: don't use leading k in Go names;
pkg/remote/redfish/redfish.go:39:2: var systemId should be systemID
pkg/remote/redfish/redfish.go:47:2: var managerId should be managerID
pkg/remote/redfish/redfish.go:51:2: var vMediaId should be vMediaID
pkg/remote/redfish/redfish.go:115:2: var parsedUrl should be parsedURL
pkg/remote/redfish/utils.go:29:2: var trimmedUrl should be trimmedURL
pkg/remote/redfish/utils.go:39:3: var rId should be rID

Relates-To: #58

Change-Id: I758565c84b44aac118d5f1cbf714224ab1ff82c5
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-02-28 16:38:41 -05:00
Alexander Hughes
f66f94dc80 [#58] Update error strings to be golint compliant
Error strings by convention should not end in punctuation, or contain
uppercase letters.

Relates-To: #58

Change-Id: I027fb21a20f08fdd24cf654f3ae1cbceb3e5a6c6
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
2020-02-28 16:31:53 -05:00
Ian H. Pittwood
8a3950d238 Fix typos in variable names and comments
Change-Id: I361916cc18c67e72fbfdbb4b6547f80a5d098327
2020-02-05 16:31:05 -06:00
Ian Howell
49027f4151 Tighten the restrictions of the linter
This change causes the linter to be a bit more complainy. The hope is
that this will cut down on some of the more pedantic issues being caught
in code reviews, and thus reduce the overall time a change spends in the
review process.

This change includes various changes to the codebase to bring it up to
the new standards.

Change-Id: I570d304bca5554404354f972d8a2743279a0171b
2020-01-10 14:54:34 -06:00
Kostiantyn Kalynovskyi
b43e4e4fea Add abstraction to git repositories
This can be used to pull documents from git repositories defined
by config module in manifest

Change-Id: Ib25cd7e263b6de56bc107607c081e2b02281b8b5
2020-01-08 19:43:59 +00:00