Skip to content

Commit

Permalink
Merge branch 'release/5.1.1-4alvistack2'
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Jun 10, 2020
2 parents 4dc9338 + 91e2729 commit 97caa41
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 81 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "roles/catatonit"]
path = roles/catatonit
url = https://github.com/alvistack/ansible-role-catatonit.git
branch = develop
[submodule "roles/gosu"]
path = roles/gosu
url = https://github.com/alvistack/ansible-role-gosu.git
Expand All @@ -18,7 +22,3 @@
path = roles/timezone
url = https://github.com/alvistack/ansible-role-timezone.git
branch = develop
[submodule "roles/tini"]
path = roles/tini
url = https://github.com/alvistack/ansible-role-tini.git
branch = develop
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Docker Image Packaging for mitmproxy

## 5.0.1-XalvistackY - TBC
## 5.1.1-XalvistackY - TBC

### Major Changes

## 5.1.1-4alvistack2 - 2020-06-10

### Major Changes

- Revamp `create`, `side_effect`, `verify` and `destroy` logic
- Install with static binary archive
- Replace `tini` with `catatonit`
- Rename `post_tasks.yml` as `side_effect.yml`
- Upgrade base image to Ubuntu 20.04

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Based on [Official Ubuntu Docker Image](https://hub.docker.com/_/ubuntu/) with s

- Minimized `Dockerfile` for meta data definition
- Provision by Ansible and Molecule Docker driver in single layer
- Handle `ENTRYPOINT` with [tini](https://github.com/krallin/tini)
- Handle `ENTRYPOINT` with [catatonit](https://github.com/openSUSE/catatonit)

### Quick Start

Expand Down
2 changes: 1 addition & 1 deletion molecule/5.1/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ ENV MITMPROXY_VERSION "{{ mitmproxy_version }}"
EXPOSE 8080
EXPOSE 8081

ENTRYPOINT [ "tini", "-g", "--", "docker-entrypoint.sh" ]
ENTRYPOINT [ "catatonit", "-g", "--", "docker-entrypoint.sh" ]
CMD [ "mitmdump", "--mode transparent", "--showhost" ]
24 changes: 24 additions & 0 deletions molecule/default/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@
become: true
gather_facts: false
tasks:
- name: docker image inspect
docker_image_info:
name: "{{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\\1') }}:{{ item.name }}"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
register: result

- name: docker commit
shell: |
set -o pipefail
docker inspect {{ item.name }} && docker commit \
--change 'CMD ["{{ result.results[i].images[0].Config.Cmd | join('", "') }}"]' \
--change 'ENTRYPOINT ["{{ result.results[i].images[0].Config.Entrypoint | join('", "') }}"]' \
{{ item.name }} {{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\1') }}:{{ item.name }}-commit
args:
executable: "/bin/bash"
loop_control:
label: "{{ item.name }}"
index_var: i
with_items: "{{ molecule_yml.platforms }}"
changed_when: false
ignore_errors: true

- name: docker rm
docker_container:
name: "{{ item.name }}"
Expand Down
68 changes: 1 addition & 67 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: all
remote_user: root
become: true
gather_facts: false
tasks:
- name: rm -rf /root/.ansible/tmp/*
raw: |
set -ex
rm -rf /root/.ansible/tmp/*
rm -rf /root/.cache/*
rm -rf /tmp/*
changed_when: false
ignore_errors: true

- name: debian | apt-get clean
raw: |
set -ex
apt-get clean
rm -rf /var/lib/apt/lists/*
changed_when: false
ignore_errors: true

- name: redhat | yum clean all
raw: |
set -ex
yum clean all
rm -rf /var/cache/yum/*
changed_when: false
ignore_errors: true

- name: suse | zypper clean --all
raw: |
set -ex
zypper clean --all
rm -rf /var/cache/zypper/*
changed_when: false
ignore_errors: true

- hosts: localhost
connection: local
remote_user: root
become: true
gather_facts: false
tasks:
- name: docker image inspect
docker_image_info:
name: "{{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\\1') }}:{{ item.name }}"
loop_control:
label: "{{ item.name }}"
loop: "{{ molecule_yml.platforms }}"
register: result

- name: docker commit
shell: |
set -o pipefail
docker inspect {{ item.name }} && docker commit \
--change 'CMD ["{{ result.results[i].images[0].Config.Cmd | join('", "') }}"]' \
--change 'ENTRYPOINT ["{{ result.results[i].images[0].Config.Entrypoint | join('", "') }}"]' \
{{ item.name }} {{ molecule_ephemeral_directory | regex_replace('^.*/([^/]*/[^/]*)$', '\1') }}:{{ item.name }}-commit
args:
executable: "/bin/bash"
loop_control:
label: "{{ item.name }}"
index_var: i
with_items: "{{ molecule_yml.platforms }}"
changed_when: false
ignore_errors: true
- import_playbook: ../../playbooks/verify.yml
2 changes: 1 addition & 1 deletion playbooks/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
name: timezone

- include_role:
name: tini
name: catatonit

- include_role:
name: gosu
Expand Down
33 changes: 33 additions & 0 deletions playbooks/side_effect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,36 @@
paths:
- "./vars"
ignore_errors: true

- name: rm -rf /root/.ansible/tmp/*
raw: |
set -ex
rm -rf /root/.ansible/tmp/*
rm -rf /root/.cache/*
rm -rf /tmp/*
changed_when: false
ignore_errors: true

- name: debian | apt-get clean
raw: |
set -ex
apt-get clean
rm -rf /var/lib/apt/lists/*
changed_when: false
ignore_errors: true

- name: redhat | yum clean all
raw: |
set -ex
yum clean all
rm -rf /var/cache/yum/*
changed_when: false
ignore_errors: true

- name: suse | zypper clean --all
raw: |
set -ex
zypper clean --all
rm -rf /var/cache/zypper/*
changed_when: false
ignore_errors: true
35 changes: 35 additions & 0 deletions playbooks/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---

# (c) Wong Hoi Sing Edison <[email protected]>
#
# 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.

- hosts: all
remote_user: root
tasks:
- name: include default variables
include_vars: "./vars/main.yml"

- name: include release specific variables
include_vars: "{{ lookup('first_found', _params) }}"
vars:
_params:
files:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
paths:
- "./vars"
ignore_errors: true
1 change: 1 addition & 0 deletions roles/catatonit
Submodule catatonit added at 483259
2 changes: 1 addition & 1 deletion roles/gosu
Submodule gosu updated 1 files
+5 −1 CHANGELOG.md
2 changes: 1 addition & 1 deletion roles/locales
Submodule locales updated 1 files
+5 −1 CHANGELOG.md
2 changes: 1 addition & 1 deletion roles/mitmproxy
Submodule mitmproxy updated 1 files
+5 −1 CHANGELOG.md
2 changes: 1 addition & 1 deletion roles/python
Submodule python updated 2 files
+5 −1 CHANGELOG.md
+2 −4 tasks/main.yml
2 changes: 1 addition & 1 deletion roles/timezone
Submodule timezone updated 1 files
+5 −1 CHANGELOG.md
1 change: 0 additions & 1 deletion roles/tini
Submodule tini deleted from 56ae2d

0 comments on commit 97caa41

Please sign in to comment.