From c4284c1c3b4a342e24f28a0044a3123515f523fb Mon Sep 17 00:00:00 2001 From: Wong Hoi Sing Edison Date: Sat, 11 Apr 2020 23:23:02 +0800 Subject: [PATCH] Provision with systemd support --- CHANGELOG.md | 4 +- molecule/4.7/molecule.yml | 8 +++ molecule/4.8/molecule.yml | 8 +++ molecule/default/Dockerfile.j2 | 41 ++++++++++++++ .../default/group_vars/all/00-defaults.yml | 1 + .../default/group_vars/all/99-molecule.yml | 15 +++++ molecule/default/molecule.yml | 55 +++++++++++++++++++ roles/bootstrap | 2 +- roles/cvs | 2 +- roles/fisheye | 2 +- roles/git | 2 +- roles/gosu | 2 +- roles/locales | 2 +- roles/mercurial | 2 +- roles/openjdk | 2 +- roles/perforce | 2 +- roles/python | 2 +- roles/svn | 2 +- roles/timezone | 2 +- roles/tini | 2 +- 20 files changed, 143 insertions(+), 15 deletions(-) create mode 100644 molecule/default/Dockerfile.j2 create mode 120000 molecule/default/group_vars/all/00-defaults.yml create mode 100644 molecule/default/group_vars/all/99-molecule.yml create mode 100644 molecule/default/molecule.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index a90adc4..c999342 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,11 @@ ### Major Changes -## 4.8.1-4alvistack6 - 2020-04-11 +## 4.8.1-4alvistack7 - 2020-04-11 ### Major Changes - - Debug build + - Provision with systemd support ## 4.8.1-4alvistack4 - 2020-03-05 diff --git a/molecule/4.7/molecule.yml b/molecule/4.7/molecule.yml index f044f58..52c97a4 100644 --- a/molecule/4.7/molecule.yml +++ b/molecule/4.7/molecule.yml @@ -19,6 +19,14 @@ driver: platforms: - name: ${MOLECULE_INSTANCE_NAME}-1 dockerfile: Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + entrypoint: init + command: "bash -c 'sleep infinity'" + tty: true + env: + container: docker lint: | set -ex yamllint . diff --git a/molecule/4.8/molecule.yml b/molecule/4.8/molecule.yml index f044f58..52c97a4 100644 --- a/molecule/4.8/molecule.yml +++ b/molecule/4.8/molecule.yml @@ -19,6 +19,14 @@ driver: platforms: - name: ${MOLECULE_INSTANCE_NAME}-1 dockerfile: Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + entrypoint: init + command: "bash -c 'sleep infinity'" + tty: true + env: + container: docker lint: | set -ex yamllint . diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 new file mode 100644 index 0000000..94016e5 --- /dev/null +++ b/molecule/default/Dockerfile.j2 @@ -0,0 +1,41 @@ +# (c) Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM ubuntu:18.04 + +ENV LANG "en_US.utf8" +ENV LC_ALL "en_US.utf8" +ENV SHELL "/bin/bash" +ENV TZ "UTC" + +# Hotfix for systemd +RUN set -ex \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y systemd \ + && ln -fs /lib/systemd/systemd /usr/sbin/init \ + && find /lib/systemd/system/sysinit.target.wants/ -name "systemd-tmpfiles-setup.service" -delete \ + && rm -f /lib/systemd/system/multi-user.target.wants/* \ + && rm -f /etc/systemd/system/*.wants/* \ + && rm -f /lib/systemd/system/local-fs.target.wants/* \ + && rm -f /lib/systemd/system/sockets.target.wants/*udev* \ + && rm -f /lib/systemd/system/sockets.target.wants/*initctl* \ + && rm -f /lib/systemd/system/basic.target.wants/* \ + && rm -rf /var/lib/apt/lists/* + +# Hotfix for en_US.utf8 locale +RUN set -ex \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y locales \ + && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ + && rm -rf /var/lib/apt/lists/* diff --git a/molecule/default/group_vars/all/00-defaults.yml b/molecule/default/group_vars/all/00-defaults.yml new file mode 120000 index 0000000..0b825fd --- /dev/null +++ b/molecule/default/group_vars/all/00-defaults.yml @@ -0,0 +1 @@ +../../../../inventory/default/group_vars/all/00-defaults.yml \ No newline at end of file diff --git a/molecule/default/group_vars/all/99-molecule.yml b/molecule/default/group_vars/all/99-molecule.yml new file mode 100644 index 0000000..858af07 --- /dev/null +++ b/molecule/default/group_vars/all/99-molecule.yml @@ -0,0 +1,15 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml new file mode 100644 index 0000000..52c97a4 --- /dev/null +++ b/molecule/default/molecule.yml @@ -0,0 +1,55 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +driver: + name: docker +platforms: + - name: ${MOLECULE_INSTANCE_NAME}-1 + dockerfile: Dockerfile.j2 + privileged: true + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + entrypoint: init + command: "bash -c 'sleep infinity'" + tty: true + env: + container: docker +lint: | + set -ex + yamllint . + ansible-lint + flake8 +dependency: + name: galaxy + options: + role-file: ansible-role-requirements.yml + roles-path: ${ANSIBLE_ROLES_PATH} + ignore-errors: true +provisioner: + name: ansible + env: + ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH} + config_options: + defaults: + forks: 20 + ssh_connection: + pipelining: true + ssh_args: -o ControlMaster=auto -o ControlPersist=600s + inventory: + links: + group_vars: group_vars +verifier: + name: ansible diff --git a/roles/bootstrap b/roles/bootstrap index b053276..952334f 160000 --- a/roles/bootstrap +++ b/roles/bootstrap @@ -1 +1 @@ -Subproject commit b053276797ada83945f09633485332a0206dd449 +Subproject commit 952334fa9593cd4c5edd597c3f08558e31f69e67 diff --git a/roles/cvs b/roles/cvs index 2566a35..b32e65d 160000 --- a/roles/cvs +++ b/roles/cvs @@ -1 +1 @@ -Subproject commit 2566a35a9652e1ff6a44c81a40396be8fcbf7825 +Subproject commit b32e65dab5e6aaa32cd9d89ad59f6f73556509f8 diff --git a/roles/fisheye b/roles/fisheye index 3909a0c..48f1671 160000 --- a/roles/fisheye +++ b/roles/fisheye @@ -1 +1 @@ -Subproject commit 3909a0c41edaa2bdfd0639f6a291a6da4e4b38cc +Subproject commit 48f16713e394d90bf4a752b21c3985852cf92795 diff --git a/roles/git b/roles/git index d268acd..8862e06 160000 --- a/roles/git +++ b/roles/git @@ -1 +1 @@ -Subproject commit d268acd2c5a022f4cdfad92e64db853ecb60dc4d +Subproject commit 8862e06cc14a87e6d664703f8bb23ab82f8e0920 diff --git a/roles/gosu b/roles/gosu index ce03a56..3d160bf 160000 --- a/roles/gosu +++ b/roles/gosu @@ -1 +1 @@ -Subproject commit ce03a562332ddee32796f074bc59d62331c8552e +Subproject commit 3d160bf9d9bf135552c2b5f91e8b7cb8a5c2cd62 diff --git a/roles/locales b/roles/locales index e86d17b..1db4be4 160000 --- a/roles/locales +++ b/roles/locales @@ -1 +1 @@ -Subproject commit e86d17bec10410271ca1b698667356d61742ca58 +Subproject commit 1db4be435e6d49ec6e939a618a3c7dd18895fadc diff --git a/roles/mercurial b/roles/mercurial index 17c5ac7..fbf37f0 160000 --- a/roles/mercurial +++ b/roles/mercurial @@ -1 +1 @@ -Subproject commit 17c5ac7353d46fc28fb44c43ee85d1270daecc39 +Subproject commit fbf37f0b0f8d47f1058beacd4cf96d139825d72b diff --git a/roles/openjdk b/roles/openjdk index 2638f3b..1ed4f32 160000 --- a/roles/openjdk +++ b/roles/openjdk @@ -1 +1 @@ -Subproject commit 2638f3b84337a2ed7ae82bca3d10dd0ce5c7a9ed +Subproject commit 1ed4f32332e3774920fc858a961f10cac7585e4d diff --git a/roles/perforce b/roles/perforce index 9009455..b0a3f07 160000 --- a/roles/perforce +++ b/roles/perforce @@ -1 +1 @@ -Subproject commit 90094556b5658784fd1a02c85dc2fce10b7cab34 +Subproject commit b0a3f078674e533178b63441199fd351b47487f5 diff --git a/roles/python b/roles/python index d060e8c..4a5cb23 160000 --- a/roles/python +++ b/roles/python @@ -1 +1 @@ -Subproject commit d060e8ce864cf18d4a7dd59a9429f82178842757 +Subproject commit 4a5cb233feeb90c756df2d42c10b5a8a6c0ac848 diff --git a/roles/svn b/roles/svn index 8ebe1a8..9cfa3ce 160000 --- a/roles/svn +++ b/roles/svn @@ -1 +1 @@ -Subproject commit 8ebe1a8dcd86aa1e638c379b4f62766e34cdc384 +Subproject commit 9cfa3ce0a6f50092f3df4e5df9e28e626e1d14f4 diff --git a/roles/timezone b/roles/timezone index 88eb2a7..d3c114e 160000 --- a/roles/timezone +++ b/roles/timezone @@ -1 +1 @@ -Subproject commit 88eb2a7d3803909eeb1200ab884b5e32df55374e +Subproject commit d3c114ef59433d5566abf04a337cbfe83e0d48d9 diff --git a/roles/tini b/roles/tini index 09383d1..49103e0 160000 --- a/roles/tini +++ b/roles/tini @@ -1 +1 @@ -Subproject commit 09383d1f7e8330889cc306fd302cfbadcacb27c5 +Subproject commit 49103e0740b8eeb3752113bcf94f81defe57069f