Browse Source

Fix all the ci

1) Bump pyflakes

We need a python 3.9 compatible version.

Related PyCQA/pyflakes #367

2) Fix missing permissions on files

3) Ignore ansible-lint 106 for role name

4) Fix setup-tools install LP#1902986

5) ensure virtualenv is installed

6) fix missing htpasswd

Change-Id: I8302bc6c9250eba78437ccfec35e4de91348333e
changes/43/761943/7
Alex Schultz 1 year ago
parent
commit
e354ac5fa5
  1. 3
      ci-scripts/ansible-lint.sh
  2. 7
      molecule/login/prepare.yml
  3. 1
      tasks/docker-distribution.yml
  4. 9
      tasks/docker.yml
  5. 1
      tasks/install-engine.yml
  6. 1
      test-requirements.txt
  7. 23
      zuul.d/playbooks/pre.yml

3
ci-scripts/ansible-lint.sh

@ -12,7 +12,8 @@
# this requires refactoring roles, skipping for now
# 405: Package tasks should have retries. Skipping because yum does
# this natively.
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016,405"
# 106: Role name with a -. We're not using galaxy.
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016,405,106"
# Lin the role.
ansible-lint -vvv -x $SKIPLIST ./ || lint_error=1

7
molecule/login/prepare.yml

@ -44,13 +44,18 @@
virtualenv: "{{ ansible_user_dir }}/test-python"
virtualenv_site_packages: true
- name: Ensure htpasswd exists
package:
name: httpd-tools
state: present
- name: Create a docker registry
become: true
shell: |-
docker pull ubuntu:16.04
docker tag ubuntu:16.04 localhost:5000/my-ubuntu
mkdir auth
docker run --entrypoint htpasswd registry:2 -Bbn testuser testpassword > auth/htpasswd
htpasswd -Bbn testuser testpassword > auth/htpasswd
docker container stop registry
docker run -d -p 5000:5000 --restart=always --name registry -v "$(pwd)"/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2
args:

1
tasks/docker-distribution.yml

@ -12,6 +12,7 @@
template:
src: docker-distribution-config.yml.j2
dest: /etc/docker-distribution/registry/config.yml
mode: '0644'
become: true
notify: restart docker-distribution service

9
tasks/docker.yml

@ -58,6 +58,7 @@
file:
path: /etc/systemd/system/docker.service.d
state: directory
mode: '0755'
when: ansible_service_mgr == 'systemd'
- name: unset mountflags
@ -67,6 +68,7 @@
option: MountFlags
value: ""
create: yes
mode: '0644'
notify: restart docker service
when: ansible_service_mgr == 'systemd'
@ -76,6 +78,7 @@
regexp: '^OPTIONS='
line: "OPTIONS='{{ _full_docker_options }}'"
create: yes
mode: '0644'
notify: restart docker service
- name: configure INSECURE_REGISTRY in /etc/sysconfig/docker
@ -83,6 +86,7 @@
path: /etc/sysconfig/docker
regexp: '^INSECURE_REGISTRY='
line: "INSECURE_REGISTRY='{{ registry_flags }}'"
mode: '0644'
when: container_registry_insecure_registries | length > 0
notify: restart docker service
vars:
@ -92,6 +96,7 @@
file:
path: "{{ item | dirname }}"
state: directory
mode: '0755'
notify: restart docker service
with_items: "{{ container_registry_additional_sockets }}"
when: container_registry_additional_sockets | length > 0
@ -100,6 +105,7 @@
template:
src: docker-daemon.json.j2
dest: /etc/docker/daemon.json
mode: '0644'
notify: restart docker service
- name: configure DOCKER_STORAGE_OPTIONS in /etc/sysconfig/docker-storage
@ -108,6 +114,7 @@
regexp: '^DOCKER_STORAGE_OPTIONS='
line: "DOCKER_STORAGE_OPTIONS=' {{ container_registry_storage_options }}'"
create: yes
mode: '0644'
when: container_registry_storage_options | length > 0
notify: restart docker service
@ -117,6 +124,7 @@
regexp: '^DOCKER_NETWORK_OPTIONS='
line: "DOCKER_NETWORK_OPTIONS=' {{ container_registry_network_options }}'"
create: yes
mode: '0644'
when: container_registry_network_options | length > 0
notify: restart docker service
@ -152,3 +160,4 @@
line: "# Configured by Ansible container registry role"
insertafter: "^# /etc/sysconfig/docker$"
create: yes
mode: '0644'

1
tasks/install-engine.yml

@ -21,6 +21,7 @@
option: DOCKER_NETWORK_OPTIONS
value: --iptables=false
no_extra_spaces: true
mode: '0644'
- name: Start Docker daemon
service:

1
test-requirements.txt

@ -1 +1,2 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
pyflakes>=2.2.0

23
zuul.d/playbooks/pre.yml

@ -67,6 +67,29 @@
version: master
force: true
- name: Ensure virtualenv is installed
include_role:
name: ensure-virtualenv
- name: Set python_v fact to py2 or py3
set_fact:
python_v: "{{ ansible_facts['distribution_major_version'] is version('8', '>=') | ternary('py3', 'py2') }}"
cacheable: true
- name: Install python3-setuptools
package:
name: "python3-setuptools"
state: present
become: true
when: python_v == "py3"
- name: Install python-setuptools
package:
name: "python-setuptools"
state: present
become: true
when: python_v == "py2"
- name: Setup test-python
pip:
name: "{{ molecule_requirements }}"

Loading…
Cancel
Save