r10k 3.3.3 → 3.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/pull_request_template.md +1 -0
- data/.github/workflows/docker.yml +56 -0
- data/.github/workflows/release.yml +36 -0
- data/.travis.yml +23 -8
- data/CHANGELOG.mkd +57 -4
- data/CODEOWNERS +1 -0
- data/Gemfile +1 -1
- data/README.mkd +4 -3
- data/azure-pipelines.yml +2 -1
- data/bin/r10k +1 -1
- data/doc/dynamic-environments/configuration.mkd +160 -2
- data/doc/dynamic-environments/git-environments.mkd +1 -1
- data/doc/dynamic-environments/master-configuration.mkd +28 -58
- data/doc/faq.mkd +6 -1
- data/doc/puppetfile.mkd +2 -0
- data/docker/Makefile +39 -17
- data/docker/r10k/Dockerfile +36 -15
- data/docker/r10k/adduser.sh +13 -0
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +1 -1
- data/docker/r10k/release.Dockerfile +54 -0
- data/docker/spec/dockerfile_spec.rb +4 -3
- data/docker/spec/fixtures/Puppetfile +1 -1
- data/integration/Rakefile +2 -2
- data/lib/r10k/action/deploy/environment.rb +7 -3
- data/lib/r10k/action/deploy/module.rb +5 -1
- data/lib/r10k/action/runner.rb +4 -4
- data/lib/r10k/cli/deploy.rb +1 -1
- data/lib/r10k/environment.rb +30 -0
- data/lib/r10k/environment/bare.rb +16 -0
- data/lib/r10k/environment/git.rb +6 -5
- data/lib/r10k/environment/svn.rb +2 -0
- data/lib/r10k/environment/with_modules.rb +139 -0
- data/lib/r10k/forge/module_release.rb +2 -2
- data/lib/r10k/logging/terminaloutputter.rb +1 -1
- data/lib/r10k/module/base.rb +5 -0
- data/lib/r10k/module/forge.rb +5 -1
- data/lib/r10k/puppetfile.rb +6 -0
- data/lib/r10k/source.rb +4 -0
- data/lib/r10k/source/exec.rb +51 -0
- data/lib/r10k/source/hash.rb +182 -0
- data/lib/r10k/source/yaml.rb +20 -0
- data/lib/r10k/source/yamldir.rb +32 -0
- data/lib/r10k/util/attempt.rb +1 -1
- data/lib/r10k/version.rb +4 -1
- data/locales/r10k.pot +65 -22
- data/r10k.gemspec +6 -2
- data/spec/unit/action/deploy/environment_spec.rb +1 -0
- data/spec/unit/action/deploy/module_spec.rb +13 -0
- data/spec/unit/action/puppetfile/install_spec.rb +3 -1
- data/spec/unit/action/runner_spec.rb +2 -2
- data/spec/unit/forge/module_release_spec.rb +14 -10
- data/spec/unit/source/exec_spec.rb +81 -0
- data/spec/unit/source/hash_spec.rb +54 -0
- data/spec/unit/source/yaml_spec.rb +42 -0
- metadata +64 -22
- data/MAINTAINERS +0 -18
- data/docker/distelli-manifest.yml +0 -9
- data/integration/scripts/README.mkd +0 -86
- data/integration/scripts/setup_r10k_env_centos5.sh +0 -23
- data/integration/scripts/setup_r10k_env_centos6.sh +0 -23
- data/integration/scripts/setup_r10k_env_rhel7.sh +0 -23
- data/integration/scripts/setup_r10k_env_sles11.sh +0 -23
- data/integration/scripts/setup_r10k_env_sles12.sh +0 -23
- data/integration/scripts/setup_r10k_env_ubuntu1004.sh +0 -23
- data/integration/scripts/setup_r10k_env_ubuntu1204.sh +0 -23
- data/integration/scripts/setup_r10k_env_ubuntu1404.sh +0 -23
@@ -29,7 +29,7 @@ seamlessly reflected in Puppet environments. This means that creating a new Git
|
|
29
29
|
branch creates a new Puppet environment, updating a Git branch will update that
|
30
30
|
environment, and deleting a Git branch will remove that environment.
|
31
31
|
|
32
|
-
R10k supports both [directory and config file environments](https://
|
32
|
+
R10k supports both [directory and config file environments](https://puppet.com/docs/puppet/latest/env_environments.html).
|
33
33
|
Ensure that the basedir for your sources and your puppet config align.
|
34
34
|
|
35
35
|
How it works
|
@@ -1,70 +1,40 @@
|
|
1
1
|
Puppet master configuration
|
2
2
|
===========================
|
3
3
|
|
4
|
-
In order to use
|
4
|
+
In order to use environments, your Puppet masters will need to be
|
5
5
|
configured to load manifests and modules relative to the requested environment.
|
6
|
-
The following settings should be configured in puppet.conf.
|
7
6
|
|
8
|
-
|
7
|
+
This is the default behavior in Puppet 4+
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
settings. When environments is loaded the settings are dynamically set based on
|
13
|
-
the name of the environment, thus allowing environments to be created on the
|
14
|
-
fly.
|
9
|
+
This behavior is controled by the following settings
|
10
|
+
(listed with their default values):
|
15
11
|
|
16
|
-
|
17
|
-
|
12
|
+
```
|
13
|
+
codedir = /etc/puppetlabs/code
|
14
|
+
environmentpath = $codedir/environments
|
15
|
+
basemodulepath = $codedir/modules:/opt/puppetlabs/puppet/share/modules
|
16
|
+
```
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
# If you use a specific site wide manifest
|
22
|
-
manifest = /etc/puppet/environments/$environment/manifests/nodes.pp
|
18
|
+
The environment requested by the agent or assigned to it by an ENC is looked
|
19
|
+
for at `$environmentpath/$environment`.
|
23
20
|
|
24
|
-
|
21
|
+
That environment may have an environment.conf file in its base directory that
|
22
|
+
specifies its own modulepath. If not, the default computed modulepath for that
|
23
|
+
environment is `$environmentpath/$environment/modules:$basemodulepath`.
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
These configuration variables are documented at
|
26
|
+
[Puppet Configuration Reference](https://puppet.com/docs/puppet/latest/configuration.html)
|
27
|
+
and their interaction in forming the modulepath is documented at
|
28
|
+
[Directories and the Modulepath](https://puppet.com/docs/puppet/latest/dirs_modulepath.html).
|
29
|
+
More information can be found about environments in general at
|
30
|
+
[Creating Environmnets](https://puppet.com/docs/puppet/latest/environments_creating.html).
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
The evolution to using environments in this way was a gradual one from community
|
33
|
+
conventions to supported feature and there were several intermediate stages that
|
34
|
+
had different configuration requirements within the puppet.conf. Some Puppet
|
35
|
+
documentation from the 3.x and 4.x series may no longer be applicable to the
|
36
|
+
above which solidified in Puppet 4.x.
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
## Puppet >= 3.6.0
|
42
|
-
|
43
|
-
[environmentconf]: http://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html
|
44
|
-
|
45
|
-
Puppet 3.6.0 adds more fine grained control over how directory environments are
|
46
|
-
configured. Each directory based environment can have an
|
47
|
-
[`environment.conf`][environmentconf] file in the root of that environment that
|
48
|
-
can specify the manifest, modulepath, config_version, and environment_timeout
|
49
|
-
for that specific environment.
|
50
|
-
|
51
|
-
# puppet.conf
|
52
|
-
[master]
|
53
|
-
# None of modulepath, manifestdir, or manifest should be enabled
|
54
|
-
# See http://docs.puppetlabs.com/puppet/latest/reference/environments.html#enabling-directory-environments
|
55
|
-
# for more information on the changes
|
56
|
-
environmentpath = $confdir/environments
|
57
|
-
|
58
|
-
- - -
|
59
|
-
|
60
|
-
# environment.conf
|
61
|
-
manifest = site.pp
|
62
|
-
moduledir = modules:dist
|
63
|
-
|
64
|
-
A deployed environment with a Puppetfile will look something like this:
|
65
|
-
|
66
|
-
.
|
67
|
-
├── Puppetfile
|
68
|
-
├── environment.conf
|
69
|
-
├── dist
|
70
|
-
└── modules
|
38
|
+
If you need to upgrade away from any intermediate setup see
|
39
|
+
[Environments in Puppet 3.8](https://puppet.com/docs/puppet/3.8/environments.html)
|
40
|
+
for examples that may help.
|
data/doc/faq.mkd
CHANGED
@@ -141,7 +141,7 @@ modulepath = modules:external-modules
|
|
141
141
|
|
142
142
|
Lastly, you can simply move your locally versioned modules to a separate
|
143
143
|
directory to avoid conflicting over the `/modules` directory entirely. With this
|
144
|
-
example as well you can use the `environment.conf file to tell Puppet which
|
144
|
+
example as well you can use the `environment.conf` file to tell Puppet which
|
145
145
|
directories contain modules.
|
146
146
|
|
147
147
|
```
|
@@ -149,6 +149,11 @@ directories contain modules.
|
|
149
149
|
modulepath = internal-modules:modules
|
150
150
|
```
|
151
151
|
|
152
|
+
#### Does R10K support Local/Private Forge?
|
153
|
+
|
154
|
+
Yes. Set the Forge to use _globally_ in `r10k.yaml`. see [Configuration](/doc/dynamic-environments/configuration.mkd#baseurl) for details.
|
155
|
+
|
156
|
+
|
152
157
|
#### What does the name mean?
|
153
158
|
|
154
159
|
It’s called R10K because I’m terrible at names. When I started working on R10K
|
data/doc/puppetfile.mkd
CHANGED
@@ -54,6 +54,8 @@ The `forge` setting specifies which server that Forge based modules are fetched
|
|
54
54
|
from. This is currently a noop and is provided for compatibility with
|
55
55
|
librarian-puppet.
|
56
56
|
|
57
|
+
R10k supports setting the Forge to use _globally_ in `r10k.yaml`. see [Configuration](/doc/dynamic-environments/configuration.mkd#baseurl) for details.
|
58
|
+
|
57
59
|
### moduledir
|
58
60
|
|
59
61
|
The `moduledir` setting specifies where modules from the Puppetfile will be
|
data/docker/Makefile
CHANGED
@@ -1,22 +1,43 @@
|
|
1
1
|
PUPPERWARE_ANALYTICS_STREAM ?= dev
|
2
2
|
NAMESPACE ?= puppet
|
3
|
-
git_describe = $(shell git describe)
|
3
|
+
git_describe = $(shell git describe --tags)
|
4
4
|
vcs_ref := $(shell git rev-parse HEAD)
|
5
5
|
build_date := $(shell date -u +%FT%T)
|
6
6
|
hadolint_available := $(shell hadolint --help > /dev/null 2>&1; echo $$?)
|
7
|
-
hadolint_command := hadolint
|
7
|
+
hadolint_command := hadolint
|
8
8
|
hadolint_container := hadolint/hadolint:latest
|
9
|
-
|
10
|
-
export
|
11
|
-
export
|
12
|
-
export
|
9
|
+
export BUNDLE_PATH = $(PWD)/.bundle/gems
|
10
|
+
export BUNDLE_BIN = $(PWD)/.bundle/bin
|
11
|
+
export GEMFILE = $(PWD)/Gemfile
|
12
|
+
export DOCKER_BUILDKIT = 1
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
ifeq ($(IS_RELEASE),true)
|
15
|
+
VERSION ?= $(shell echo $(git_describe) | sed 's/-.*//')
|
16
|
+
PUBLISHED_VERSION ?= $(shell curl --silent 'https://rubygems.org/api/v1/gems/r10k.json' | jq '."version"' | tr -d '"')
|
17
|
+
CONTAINER_EXISTS = $(shell DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect $(NAMESPACE)/r10k:$(VERSION) > /dev/null 2>&1; echo $$?)
|
18
|
+
ifeq ($(CONTAINER_EXISTS),0)
|
19
|
+
SKIP_BUILD ?= true
|
20
|
+
else ifneq ($(VERSION),$(PUBLISHED_VERSION))
|
21
|
+
SKIP_BUILD ?= true
|
22
|
+
endif
|
23
|
+
|
24
|
+
LATEST_VERSION ?= latest
|
25
|
+
dockerfile := release.Dockerfile
|
26
|
+
dockerfile_context := r10k
|
27
|
+
else
|
28
|
+
VERSION ?= edge
|
29
|
+
IS_LATEST := false
|
30
|
+
dockerfile := Dockerfile
|
31
|
+
dockerfile_context := $(PWD)/..
|
32
|
+
endif
|
16
33
|
|
17
34
|
prep:
|
18
35
|
@git fetch --unshallow 2> /dev/null ||:
|
19
36
|
@git fetch origin 'refs/tags/*:refs/tags/*'
|
37
|
+
ifeq ($(SKIP_BUILD),true)
|
38
|
+
@echo "SKIP_BUILD is true, exiting with 1"
|
39
|
+
@exit 1
|
40
|
+
endif
|
20
41
|
|
21
42
|
lint:
|
22
43
|
ifeq ($(hadolint_available),0)
|
@@ -27,37 +48,38 @@ else
|
|
27
48
|
endif
|
28
49
|
|
29
50
|
build: prep
|
30
|
-
|
51
|
+
docker build \
|
52
|
+
${DOCKER_BUILD_FLAGS} \
|
31
53
|
--pull \
|
32
54
|
--build-arg vcs_ref=$(vcs_ref) \
|
33
55
|
--build-arg build_date=$(build_date) \
|
34
|
-
--build-arg version=$(
|
56
|
+
--build-arg version=$(VERSION) \
|
35
57
|
--build-arg pupperware_analytics_stream=$(PUPPERWARE_ANALYTICS_STREAM) \
|
36
58
|
--file r10k/$(dockerfile) \
|
37
|
-
--tag $(NAMESPACE)/r10k:$(
|
59
|
+
--tag $(NAMESPACE)/r10k:$(VERSION) $(dockerfile_context)
|
38
60
|
ifeq ($(IS_LATEST),true)
|
39
|
-
@docker tag $(NAMESPACE)/r10k:$(
|
61
|
+
@docker tag $(NAMESPACE)/r10k:$(VERSION) puppet/r10k:$(LATEST_VERSION)
|
40
62
|
endif
|
41
63
|
|
42
64
|
test: prep
|
43
65
|
@bundle install --path $$BUNDLE_PATH --gemfile $$GEMFILE --with test
|
44
66
|
@bundle update
|
45
|
-
@PUPPET_TEST_DOCKER_IMAGE=$(NAMESPACE)/r10k:$(
|
67
|
+
@PUPPET_TEST_DOCKER_IMAGE=$(NAMESPACE)/r10k:$(VERSION) \
|
46
68
|
bundle exec --gemfile $$GEMFILE \
|
47
69
|
rspec spec
|
48
70
|
|
49
71
|
push-image: prep
|
50
|
-
@docker push $(NAMESPACE)/r10k:$(
|
72
|
+
@docker push $(NAMESPACE)/r10k:$(VERSION)
|
51
73
|
ifeq ($(IS_LATEST),true)
|
52
|
-
@docker push $(NAMESPACE)/r10k
|
74
|
+
@docker push $(NAMESPACE)/r10k:$(LATEST_VERSION)
|
53
75
|
endif
|
54
76
|
|
55
77
|
push-readme:
|
56
78
|
@docker pull sheogorath/readme-to-dockerhub
|
57
79
|
@docker run --rm \
|
58
80
|
-v $(PWD)/README.md:/data/README.md \
|
59
|
-
-e DOCKERHUB_USERNAME="$(
|
60
|
-
-e DOCKERHUB_PASSWORD="$(
|
81
|
+
-e DOCKERHUB_USERNAME="$(DOCKERHUB_USERNAME)" \
|
82
|
+
-e DOCKERHUB_PASSWORD="$(DOCKERHUB_PASSWORD)" \
|
61
83
|
-e DOCKERHUB_REPO_PREFIX=puppet \
|
62
84
|
-e DOCKERHUB_REPO_NAME=r10k \
|
63
85
|
sheogorath/readme-to-dockerhub
|
data/docker/r10k/Dockerfile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
FROM alpine:3.9 as build
|
2
2
|
|
3
|
-
|
4
|
-
RUN
|
3
|
+
# hadolint ignore=DL3018
|
4
|
+
RUN apk add --no-cache ruby git && \
|
5
|
+
mkdir /workspace
|
5
6
|
WORKDIR /workspace
|
6
7
|
COPY . /workspace
|
7
8
|
RUN gem build r10k.gemspec && \
|
@@ -15,32 +16,52 @@ ARG version="3.1.0"
|
|
15
16
|
# Used by entrypoint to submit metrics to Google Analytics.
|
16
17
|
# Published images should use "production" for this build_arg.
|
17
18
|
ARG pupperware_analytics_stream="dev"
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
# required to schedule runs of "r10k" in K8s
|
20
|
+
ARG supercronic_version="0.1.9"
|
21
|
+
ARG supercronic_sha1sum="5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85"
|
22
|
+
ARG supercronic="supercronic-linux-amd64"
|
23
|
+
ARG supercronic_url="https://github.com/aptible/supercronic/releases/download/v$supercronic_version/$supercronic"
|
21
24
|
|
22
25
|
LABEL org.label-schema.maintainer="Puppet Release Team <release@puppet.com>" \
|
23
26
|
org.label-schema.vendor="Puppet" \
|
24
27
|
org.label-schema.url="https://github.com/puppetlabs/r10k" \
|
25
28
|
org.label-schema.name="r10k" \
|
26
29
|
org.label-schema.license="Apache-2.0" \
|
27
|
-
org.label-schema.version="$R10K_VERSION" \
|
28
30
|
org.label-schema.vcs-url="https://github.com/puppetlabs/r10k" \
|
29
|
-
org.label-schema.vcs-ref="$vcs_ref" \
|
30
|
-
org.label-schema.build-date="$build_date" \
|
31
31
|
org.label-schema.schema-version="1.0" \
|
32
32
|
org.label-schema.dockerfile="/Dockerfile"
|
33
33
|
|
34
|
-
|
35
|
-
COPY --from=build /workspace/r10k.gem /
|
36
|
-
RUN gem install --no-doc r10k.gem json etc && \
|
37
|
-
rm -f r10k.gem
|
38
|
-
|
39
|
-
COPY docker/r10k/docker-entrypoint.sh /
|
40
|
-
RUN chmod +x /docker-entrypoint.sh
|
34
|
+
COPY docker/r10k/adduser.sh docker/r10k/docker-entrypoint.sh /
|
41
35
|
COPY docker/r10k/docker-entrypoint.d /docker-entrypoint.d
|
42
36
|
|
43
37
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
44
38
|
CMD ["help"]
|
45
39
|
|
40
|
+
# dynamic LABELs and ENV vars placed lower for the sake of Docker layer caching
|
41
|
+
ENV PUPPERWARE_ANALYTICS_STREAM="$pupperware_analytics_stream"
|
42
|
+
|
43
|
+
LABEL org.label-schema.version="$version" \
|
44
|
+
org.label-schema.vcs-ref="$vcs_ref" \
|
45
|
+
org.label-schema.build-date="$build_date"
|
46
|
+
|
47
|
+
COPY --from=build /workspace/r10k.gem /
|
48
|
+
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
|
49
|
+
# ignore apk and gem pinning
|
50
|
+
# hadolint ignore=DL3018,DL3028
|
51
|
+
RUN chmod a+x /adduser.sh /docker-entrypoint.sh && \
|
52
|
+
# Add a puppet user to run r10k as for consistency with puppetserver
|
53
|
+
/adduser.sh && \
|
54
|
+
chown -R puppet: /docker-entrypoint.d /docker-entrypoint.sh && \
|
55
|
+
apk add --no-cache ruby openssh-client git ruby-rugged curl ruby-json ruby-etc && \
|
56
|
+
gem install --no-doc /r10k.gem && \
|
57
|
+
rm -f /r10k.gem && \
|
58
|
+
curl --fail --silent --show-error --location --remote-name "$supercronic_url" && \
|
59
|
+
echo "${supercronic_sha1sum} ${supercronic}" | sha1sum -c - && \
|
60
|
+
chmod +x "$supercronic" && \
|
61
|
+
mv "$supercronic" "/usr/local/bin/${supercronic}" && \
|
62
|
+
ln -s "/usr/local/bin/${supercronic}" /usr/local/bin/supercronic
|
63
|
+
|
64
|
+
USER puppet
|
65
|
+
WORKDIR /home/puppet
|
66
|
+
|
46
67
|
COPY docker/r10k/Dockerfile /
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
getent_string="$(getent group | grep -e ':999$')"
|
4
|
+
exit_code=$?
|
5
|
+
|
6
|
+
if [ "$exit_code" = '0' ]; then
|
7
|
+
group="$(echo $getent_string | cut -d ':' -f1)"
|
8
|
+
else
|
9
|
+
addgroup -g 999 puppet
|
10
|
+
group='puppet'
|
11
|
+
fi
|
12
|
+
|
13
|
+
adduser -G $group -D -u 999 puppet
|
@@ -11,7 +11,7 @@ tid=UA-132486246-5
|
|
11
11
|
# Application Name
|
12
12
|
an=r10k
|
13
13
|
# Application Version
|
14
|
-
av=$
|
14
|
+
av=$(r10k version | cut -d ' ' -f 2)
|
15
15
|
# Anonymous Client ID
|
16
16
|
_file=/var/tmp/pwclientid
|
17
17
|
cid=$(cat $_file 2>/dev/null || (cat /proc/sys/kernel/random/uuid | tee $_file))
|
@@ -0,0 +1,54 @@
|
|
1
|
+
FROM alpine:3.9
|
2
|
+
|
3
|
+
ARG vcs_ref
|
4
|
+
ARG build_date
|
5
|
+
ARG version="3.1.0"
|
6
|
+
# Used by entrypoint to submit metrics to Google Analytics.
|
7
|
+
# Published images should use "production" for this build_arg.
|
8
|
+
ARG pupperware_analytics_stream="dev"
|
9
|
+
# required to schedule runs of "r10k" in K8s
|
10
|
+
ARG supercronic_version="0.1.9"
|
11
|
+
ARG supercronic_sha1sum="5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85"
|
12
|
+
ARG supercronic="supercronic-linux-amd64"
|
13
|
+
ARG supercronic_url="https://github.com/aptible/supercronic/releases/download/v$supercronic_version/$supercronic"
|
14
|
+
|
15
|
+
LABEL org.label-schema.maintainer="Puppet Release Team <release@puppet.com>" \
|
16
|
+
org.label-schema.vendor="Puppet" \
|
17
|
+
org.label-schema.url="https://github.com/puppetlabs/r10k" \
|
18
|
+
org.label-schema.name="r10k" \
|
19
|
+
org.label-schema.license="Apache-2.0" \
|
20
|
+
org.label-schema.vcs-url="https://github.com/puppetlabs/r10k" \
|
21
|
+
org.label-schema.schema-version="1.0" \
|
22
|
+
org.label-schema.dockerfile="/release.Dockerfile"
|
23
|
+
|
24
|
+
COPY adduser.sh docker-entrypoint.sh /
|
25
|
+
COPY docker-entrypoint.d /docker-entrypoint.d
|
26
|
+
|
27
|
+
ENTRYPOINT ["/docker-entrypoint.sh"]
|
28
|
+
CMD ["help"]
|
29
|
+
|
30
|
+
# dyanmic LABELs and ENV vars placed lower for the sake of Docker layer caching
|
31
|
+
ENV PUPPERWARE_ANALYTICS_STREAM="$pupperware_analytics_stream"
|
32
|
+
|
33
|
+
LABEL org.label-schema.version="$version" \
|
34
|
+
org.label-schema.vcs-ref="$vcs_ref" \
|
35
|
+
org.label-schema.build-date="$build_date"
|
36
|
+
|
37
|
+
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
|
38
|
+
# ignore apk and gem pinning
|
39
|
+
# hadolint ignore=DL3018,DL3028
|
40
|
+
RUN chmod a+x /adduser.sh /docker-entrypoint.sh && \
|
41
|
+
/adduser.sh && \
|
42
|
+
chown -R puppet: /docker-entrypoint.d /docker-entrypoint.sh && \
|
43
|
+
apk add --no-cache ruby openssh-client git ruby-rugged curl ruby-dev make gcc musl-dev && \
|
44
|
+
gem install --no-doc r10k:"$version" json etc && \
|
45
|
+
curl --fail --silent --show-error --location --remote-name "$supercronic_url" && \
|
46
|
+
echo "${supercronic_sha1sum} ${supercronic}" | sha1sum -c - && \
|
47
|
+
chmod +x "$supercronic" && \
|
48
|
+
mv "$supercronic" "/usr/local/bin/${supercronic}" && \
|
49
|
+
ln -s "/usr/local/bin/${supercronic}" /usr/local/bin/supercronic
|
50
|
+
|
51
|
+
USER puppet
|
52
|
+
WORKDIR /home/puppet
|
53
|
+
|
54
|
+
COPY release.Dockerfile /
|
@@ -8,9 +8,11 @@ describe 'r10k container' do
|
|
8
8
|
include Pupperware::SpecHelpers
|
9
9
|
def run_r10k(command)
|
10
10
|
run_command("docker run --detach \
|
11
|
-
--volume #{File.join(SPEC_DIRECTORY, 'fixtures')}:/test \
|
11
|
+
--volume #{File.join(SPEC_DIRECTORY, 'fixtures')}:/home/puppet/test \
|
12
12
|
#{@image} #{command} \
|
13
|
-
--
|
13
|
+
--verbose \
|
14
|
+
--trace \
|
15
|
+
--puppetfile test/Puppetfile")
|
14
16
|
end
|
15
17
|
|
16
18
|
before(:all) do
|
@@ -35,7 +37,6 @@ describe 'r10k container' do
|
|
35
37
|
container = result[:stdout].chomp
|
36
38
|
wait_on_container_exit(container)
|
37
39
|
expect(get_container_exit_code(container)).to eq(0)
|
38
|
-
expect(Dir.exist?(File.join(SPEC_DIRECTORY, 'fixtures', 'modules', 'ntp'))).to eq(true)
|
39
40
|
emit_log(container)
|
40
41
|
teardown_container(container)
|
41
42
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
moduledir '
|
1
|
+
moduledir '/tmp/modules'
|
2
2
|
mod 'puppetlabs/ntp'
|
data/integration/Rakefile
CHANGED
@@ -44,8 +44,8 @@ EOS
|
|
44
44
|
|
45
45
|
t.add_env do |env|
|
46
46
|
env.name = 'pe_dist_dir'
|
47
|
-
env.message = 'The location to download PE from example "
|
48
|
-
ENV['pe_dist_dir'] ||= "
|
47
|
+
env.message = 'The location to download PE from, for example "https://artifactory.delivery.puppetlabs.net/artifactory/generic_enterprise__local/20XX.X/ci-ready"'
|
48
|
+
ENV['pe_dist_dir'] ||= "https://artifactory.delivery.puppetlabs.net/artifactory/generic_enterprise__local/#{ENV['PE_FAMILY']}/ci-ready"
|
49
49
|
end
|
50
50
|
|
51
51
|
t.add_env do |env|
|
@@ -140,14 +140,14 @@ module R10K
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def visit_module(mod)
|
143
|
-
logger.info _("Deploying
|
143
|
+
logger.info _("Deploying %{origin} content %{path}") % {origin: mod.origin, path: mod.path}
|
144
144
|
mod.sync(force: @force)
|
145
145
|
end
|
146
146
|
|
147
147
|
def write_environment_info!(environment, started_at, success)
|
148
148
|
module_deploys = []
|
149
149
|
begin
|
150
|
-
environment.
|
150
|
+
environment.modules.each do |mod|
|
151
151
|
name = mod.name
|
152
152
|
version = mod.version
|
153
153
|
sha = mod.repo.head rescue nil
|
@@ -157,7 +157,10 @@ module R10K
|
|
157
157
|
logger.debug("Unable to get environment module deploy data for .r10k-deploy.json at #{environment.path}")
|
158
158
|
end
|
159
159
|
|
160
|
-
|
160
|
+
# make this file write as atomic as possible in pure ruby
|
161
|
+
final = "#{environment.path}/.r10k-deploy.json"
|
162
|
+
staging = "#{environment.path}/.r10k-deploy.json~"
|
163
|
+
File.open(staging, 'w') do |f|
|
161
164
|
deploy_info = environment.info.merge({
|
162
165
|
:started_at => started_at,
|
163
166
|
:finished_at => Time.new,
|
@@ -167,6 +170,7 @@ module R10K
|
|
167
170
|
|
168
171
|
f.puts(JSON.pretty_generate(deploy_info))
|
169
172
|
end
|
173
|
+
FileUtils.mv(staging, final)
|
170
174
|
end
|
171
175
|
|
172
176
|
def undeployable_environment_names(environments, expected_names)
|