From 429c6cfbcdb086192940b301a272215a17e89124 Mon Sep 17 00:00:00 2001 From: lae Date: Fri, 13 Sep 2024 23:28:28 +0900 Subject: [PATCH 1/8] [actions] add vagrant deploy job in the interim --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e56debc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +--- +name: CI + +"on": + pull_request: {} + push: + branches: ["main"] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +permissions: + contents: read + +jobs: + vagrant-deploy: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - run: pip install jmespath netaddr + - run: ansible-galaxy install geerlingguy.ntp + - name: setup vagrant + run: | + # Copyright The containerd Authors + # + # 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. + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg + echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list + sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list + sudo apt-get update + sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant + sudo systemctl enable --now libvirtd + sudo apt-get build-dep -y vagrant ruby-libvirt + sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev + sudo vagrant plugin install vagrant-libvirt + - run: sudo vagrant up --no-tty From eb4dc41b96cff14aa188fe02746562f4e77ddbb6 Mon Sep 17 00:00:00 2001 From: lae Date: Fri, 13 Sep 2024 23:32:19 +0900 Subject: [PATCH 2/8] [actions] use apt for python dependencies --- .github/workflows/ci.yml | 2 +- .yamllint.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .yamllint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e56debc..c7266f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - run: pip install jmespath netaddr + - run: sudo apt install python3-jmespath python3-netaddr - run: ansible-galaxy install geerlingguy.ntp - name: setup vagrant run: | diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..ab8face --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,5 @@ +--- +yaml: + rules: + line-length: + max: 120 From 0b95aee5a0e10619ffaeeaf58ab1f6a16ab31ef5 Mon Sep 17 00:00:00 2001 From: lae Date: Sat, 14 Sep 2024 00:00:05 +0900 Subject: [PATCH 3/8] [actions] switch to ubuntu 22 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7266f1..75f5176 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ permissions: jobs: vagrant-deploy: - runs-on: ubuntu-24.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - run: sudo apt install python3-jmespath python3-netaddr From 4d6cd59cfac68e04a1853b59be021c35cb572629 Mon Sep 17 00:00:00 2001 From: lae Date: Sat, 14 Sep 2024 00:08:25 +0900 Subject: [PATCH 4/8] [actions] install NFS for vagrant --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75f5176..6206fc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - run: sudo apt install python3-jmespath python3-netaddr + - run: sudo apt install python3-jmespath python3-netaddr nfs-kernel-server - run: ansible-galaxy install geerlingguy.ntp - name: setup vagrant run: | From dded4e6dc9208f99691586594f6719777589e497 Mon Sep 17 00:00:00 2001 From: lae Date: Sat, 14 Sep 2024 00:28:58 +0900 Subject: [PATCH 5/8] [actions] install ansible deps into venv, pass pipx path to vagrant --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6206fc5..bb2d5ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - run: sudo apt install python3-jmespath python3-netaddr nfs-kernel-server + - run: sudo apt install nfs-kernel-server + - run: sudo pipx inject ansible-core jmespath netaddr - run: ansible-galaxy install geerlingguy.ntp - name: setup vagrant run: | @@ -48,4 +49,4 @@ jobs: sudo apt-get build-dep -y vagrant ruby-libvirt sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev sudo vagrant plugin install vagrant-libvirt - - run: sudo vagrant up --no-tty + - run: sudo PATH=$PIPX_BIN_DIR:$PATH vagrant up --no-tty From 841fcad6a7baa47fe36fa6d6d079f2b028008918 Mon Sep 17 00:00:00 2001 From: lae Date: Sat, 14 Sep 2024 01:15:44 +0900 Subject: [PATCH 6/8] [actions] run vagrant unprivileged --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb2d5ca..db0074c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,8 @@ jobs: sudo apt-get update sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant sudo systemctl enable --now libvirtd + sudo usermod -aG libvirt ${USER} sudo apt-get build-dep -y vagrant ruby-libvirt sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev - sudo vagrant plugin install vagrant-libvirt - - run: sudo PATH=$PIPX_BIN_DIR:$PATH vagrant up --no-tty + vagrant plugin install vagrant-libvirt + - run: sudo -E -u ${USER} PATH=$PIPX_BIN_DIR:$PATH vagrant up --no-tty From 8e6be966fe7deace0281397e52bb7557af707a90 Mon Sep 17 00:00:00 2001 From: lae Date: Sat, 14 Sep 2024 01:36:40 +0900 Subject: [PATCH 7/8] [actions] run ansible with debug+terse output --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db0074c..4004839 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,4 +50,10 @@ jobs: sudo apt-get build-dep -y vagrant ruby-libvirt sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev vagrant plugin install vagrant-libvirt - - run: sudo -E -u ${USER} PATH=$PIPX_BIN_DIR:$PATH vagrant up --no-tty + - run: > + sudo -E -u ${USER} + ANSIBLE_STDOUT_CALLBACK=debug + ANSIBLE_DISPLAY_SKIPPED_HOSTS=no + ANSIBLE_DISPLAY_OK_HOSTS=no + PATH=$PIPX_BIN_DIR:$PATH + vagrant up --no-tty From bfb18e380636dce327b3c4f40d3984261cec404e Mon Sep 17 00:00:00 2001 From: lae Date: Sat, 14 Sep 2024 03:03:11 +0900 Subject: [PATCH 8/8] [actions] ignore vagrant provision failures at this point this CI job is meant as a diagnostic and not a required test, so just ignore failures until the LXC-based CI workflow is ported over --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4004839..676ac10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,5 +55,6 @@ jobs: ANSIBLE_STDOUT_CALLBACK=debug ANSIBLE_DISPLAY_SKIPPED_HOSTS=no ANSIBLE_DISPLAY_OK_HOSTS=no + DEBIAN_FRONTEND=noninteractive PATH=$PIPX_BIN_DIR:$PATH - vagrant up --no-tty + vagrant up --no-tty || true