Unit test should follow black-box approach.
Change-Id: I98c46c613a73b539f79d8dfe99cd73592792536d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Closes: #561
Without this commit airship can hang endlessly waiting for stdin
to be open. Apparently it depends on the containerd and docker
server version. This commit adds asnyc writing to stdin, this way
we don't have to wait for write to complete before starting docker
container. The code uses similar approach to upstream docker cli
implementation.
Related-To: #513
Change-Id: I2e6d4cbe37df1f8cba356af79c1c2cf18438e86c
This fixes a bug when in host value is specified in api object,
but it is ignored by docker
Closes: #512
Related-To: #512
Change-Id: I57e66a19124d1d0a295396491dbd22e2e2193d31
Since document.NewBundleByPath() is pretty resource and time
consuming call (because it invokes kustomize under the hood),
we should avoid unnecessary calls of this function. There are
lots of the same constructor calls of new bundle from phase
bundle root path, mostly in helper, which slows airshipctl
and makes no sense. This patch fixes this problem by storing
phase root bundle variable in helper, which creates only once
during airshipctl execution.
Change-Id: I6b59d440f7ab7a68dc613091dafcc9e82df10eb7
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Closes: #488
This patch allow to specify relative and home (~/) path for container
mounts.src field. In case if specified path is not absolute, it will be
created by following pattern: 'targetPath+mounts.src'; in case if path
contains ~/ - it will be properly expanded (it will allow us to mount
~/.airship working directory).
Change-Id: I878094371a2bc4e48216b1d076e466e3d29a86f6
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #484
Closes: #484
This will make sure that stderr of the generic container in gathered
in a go routine, this way we won't have to wait to see debug messages
from the container until it finishes.
Change-Id: I929719c3369f4f5796d452b5f990bf5f28a4c0d5
This will enable airship to run containers in privileged mode
as well and to specify commands to be executed.
Change-Id: I663eb55547bb821f26a9071c24d08166a3b3d56b
This also moves KRM related logic from executors package to
container package, and creates ClientV1Alpha1 interface that
would allow us to have versioned clients for generic container
executor.
Change-Id: I4b32fd8dd089b9ccea2ed64a805702e6a8705706
This commit allows to specify options to get container logs, such
as stderr, stdout and if logs should be followed.
Also extends RunCommandOptions with ability to add mounts in addtion
to binds
Relates-To: #458
Change-Id: I83507f2f7ca6ea596f52f5d3e9f868467458b6a3
This will make sure that when we add new features to how the
docker container is run, we don't need to change interface
method signature everywhere we use it.
Relates-To: #458
Change-Id: I12273264c1a8061300017246a1a4a17125ca8ae2
Having an executor within container package creates
potential import cycling. This patch moves it to a separate
package which can be used to conveniently store all the executors
at one place.
Change-Id: Ibd07c2ba46d1971604bdbd9e5e360759bb68a659
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #432
Adding the following method to the interface and implementation for
docker container:
- InspectContainer() - used to determine container status
Change-Id: I4a8096f4f5addad31daa5038a30b1ffcf1d424e9
Container interface is being extended right now, because we
build new things on top of it, such as bootstrap containers.
Current version of it, was delivered as MVP and is used only
in ISOGEN. During MVP stage we didn't bother too much about
the pointers and readability. However now when we built something
new on top of it, we want to make sure that it we dont make
matters worse, and building on solid foundation.
The pointers are not needed in any way, and they are dereferenced
on top of that, context.Context is an interface, and there is
very limited theoretical use of pointers to interfaces.
Change-Id: Iee1eeb89f058aa8e994cba685b49085707362ee1
This patch provides the ability to show progress bar using
container logs (ubuntu/debian based only).
Change-Id: I86eebe4d368d81c4685fb27ca31b86cbb3dea08d
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Relates-To: #278
Currently, we observe non-readable artefacts in the beginning of each
log line from docker container because log stream prints logs in
multiplexed way and first 8 bytes is actually a header by default. This
patch fixes this issue by using TTY mode (in this case output data
is copied directly from the container output stream, no extra
multiplexing or headers)[1].
[1] https://godoc.org/github.com/docker/docker/client#Client.ContainerLogs
Change-Id: I26f1588936be736a124b9c77ed712ac4376f03a2
Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
If there is no container runtime defined in the airshipctl
config then the error message is not clear. New handler shows
specific error description
Change-Id: Ib5b735ddaa1556a8a88fdb15c4b3942cd010db9b
Goland is complaining of a number of bad practices, and unused code.
This patchset addresses some of those complaints, such as:
- struct initialization without field names
- error string should not be capitalized or end with punctuation
- name starts with package name
- duplicate yaml keys
- snake case
- redundant parentheses
For the http.Transport redundant parentheses, the lint target fails
without the use of //nolint:errcheck so it has been added as
(currently) there is no potential for there to be an error returned
see [0] for example.
[0] https://golang.org/src/net/http/transport.go#L42
Change-Id: Ib1b20639c9b6e9be097ef1f158ecd7472f578488
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
* 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
* Before performing Image Pull check if image already exists in local
* Added ImageInpspect to check if Image exists locally
* Updated Test cases
Change-Id: I9f2927325f3b86124f9d2637ba3391af33b95c71
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>
This patch addresses golint failures such as:
pkg/bootstrap/isogen/command_test.go:43:26: method GetId should be GetID
pkg/container/container_docker.go:171:27: method getImageId should be
getImageID
pkg/container/container_docker.go:193:27: method GetId should be GetID
Relates-To: #58
Change-Id: I7eb461387524f23a89bc2ae7ce59dac066c12281
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
This patch addresses golint failures such as:
pkg/bootstrap/isogen/command_test.go:24:2: struct field getId should be
getID
pkg/config/types.go:83:2: don't use leading k in Go names; struct field
kCluster should be cluster
pkg/config/types.go:108:2: don't use leading k in Go names; struct field
kContext should be context
pkg/config/types.go:113:2: don't use leading k in Go names; struct field
kAuthInfo should be authInfo
pkg/container/container_docker.go:79:2: struct field imageUrl should be
imageURL
pkg/container/container_docker_test.go:427:3: struct field imageUrl
should be imageURL
pkg/remote/redfish/redfish.go:23:2: struct field EphemeralNodeId should
be EphemeralNodeID
pkg/remote/redfish/redfish.go:29:2: struct field Api should be API
Relates-To: #58
Change-Id: Ie8d1c49c9d392f10be0f38224c98b588a9e2a544
Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
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>
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>
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