From a8bb7b03bfad00876ceea728a86cd6f54c50ca3e Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sun, 13 Dec 2020 14:59:34 -0500 Subject: [PATCH] Move docker image pulling for wheel buidler to pre-run (#5645) --- .zuul.d/jobs.yaml | 1 + .zuul.playbooks/playbooks/wheel/pre.yaml | 42 +++++++++++++++++++ .../build-wheel-manylinux/tasks/main.yaml | 36 ---------------- 3 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 .zuul.playbooks/playbooks/wheel/pre.yaml diff --git a/.zuul.d/jobs.yaml b/.zuul.d/jobs.yaml index 213bc5d85..62f302ae8 100644 --- a/.zuul.d/jobs.yaml +++ b/.zuul.d/jobs.yaml @@ -29,6 +29,7 @@ - job: name: pyca-cryptography-build-wheel abstract: true + pre-run: .zuul.playbooks/playbooks/wheel/pre.yaml run: .zuul.playbooks/playbooks/wheel/main.yaml - job: diff --git a/.zuul.playbooks/playbooks/wheel/pre.yaml b/.zuul.playbooks/playbooks/wheel/pre.yaml new file mode 100644 index 000000000..fd4283346 --- /dev/null +++ b/.zuul.playbooks/playbooks/wheel/pre.yaml @@ -0,0 +1,42 @@ +- hosts: all + tasks: + - name: Sanity check build list + assert: + that: wheel_builds is defined + + - name: Run ensure-docker + include_role: + name: ensure-docker + + - name: Workaround Linaro aarch64 cloud MTU issues + # NOTE(ianw) : Docker default networking, the Linaro NAT setup and + # *insert random things here* cause PMTU issues, resulting in hung + # connections, particularly to fastly CDN (particularly annoying + # because pypi and pythonhosted live behind that). Can remove after + # upstream changes merge, or we otherwise find a solution in the + # upstream cloud. + # https://review.opendev.org/747062 + # https://review.opendev.org/746833 + # https://review.opendev.org/747064 + when: ansible_architecture == 'aarch64' + block: + - name: Install jq + package: + name: jq + state: present + become: yes + + - name: Reset docker MTU + shell: | + jq --arg mtu 1400 '. + {mtu: $mtu|tonumber}' /etc/docker/daemon.json > /etc/docker/daemon.json.new + cat /etc/docker/daemon.json.new + mv /etc/docker/daemon.json.new /etc/docker/daemon.json + service docker restart + become: yes + + - name: Pre-pull containers + command: >- + docker pull {{ item.image }} + become: yes + loop: '{{ wheel_builds }}' + diff --git a/.zuul.playbooks/playbooks/wheel/roles/build-wheel-manylinux/tasks/main.yaml b/.zuul.playbooks/playbooks/wheel/roles/build-wheel-manylinux/tasks/main.yaml index aebf7d6b7..553edd899 100644 --- a/.zuul.playbooks/playbooks/wheel/roles/build-wheel-manylinux/tasks/main.yaml +++ b/.zuul.playbooks/playbooks/wheel/roles/build-wheel-manylinux/tasks/main.yaml @@ -11,36 +11,6 @@ include_role: name: ensure-pip -- name: Run ensure-docker - include_role: - name: ensure-docker - -- name: Workaround Linaro aarch64 cloud MTU issues - # NOTE(ianw) : Docker default networking, the Linaro NAT setup and - # *insert random things here* cause PMTU issues, resulting in hung - # connections, particularly to fastly CDN (particularly annoying - # because pypi and pythonhosted live behind that). Can remove after - # upstream changes merge, or we otherwise find a solution in the - # upstream cloud. - # https://review.opendev.org/747062 - # https://review.opendev.org/746833 - # https://review.opendev.org/747064 - when: ansible_architecture == 'aarch64' - block: - - name: Install jq - package: - name: jq - state: present - become: yes - - - name: Reset docker MTU - shell: | - jq --arg mtu 1400 '. + {mtu: $mtu|tonumber}' /etc/docker/daemon.json > /etc/docker/daemon.json.new - cat /etc/docker/daemon.json.new - mv /etc/docker/daemon.json.new /etc/docker/daemon.json - service docker restart - become: yes - # We build an sdist of the checkout, and then build wheels from the # sdist. This ensures that nothing is left out of the sdist. - name: Install sdist required packages @@ -95,12 +65,6 @@ dest: '{{ _build_dir }}' mode: 0755 -- name: Pre-pull containers - command: >- - docker pull {{ item.image }} - become: yes - loop: '{{ wheel_builds }}' - - name: Run builds command: | docker run --rm \