Skip to content

Commit

Permalink
Added ARM support for Debian Family (#235)
Browse files Browse the repository at this point in the history
make apt architecture dependent

Co-authored-by: SamuelLHuber <[email protected]>
  • Loading branch information
freemanjp and SamuelLHuber authored Mar 19, 2023
1 parent 3c791fb commit d84ca87
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
strategy:
max-parallel: 3
matrix:
architecture:
- amd64
ansible-version:
- '6.4.0' # max-ansible-test-version
molecule-scenario:
Expand All @@ -28,8 +30,16 @@ jobs:
- fedora
- opensuse
include:
- ansible-version: '5.10.0' # min-ansible-test-version
- architecture: amd64
ansible-version: '5.10.0' # min-ansible-test-version
molecule-scenario: ubuntu-min
- architecture: arm
ansible-version: '6.4.0' # max-ansible-test-version
molecule-scenario: ubuntu-arm32
# Disabled for taking too long
# - architecture: arm64
# ansible-version: '6.4.0' # max-ansible-test-version
# molecule-scenario: ubuntu-arm64
env:
MOLECULEW_ANSIBLE: ${{ matrix.ansible-version }}

Expand All @@ -56,6 +66,14 @@ jobs:
- name: Dependency versions
run: ./moleculew wrapper-versions

- name: Set up QEMU
if: matrix.architecture != 'amd64'
id: qemu
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: ${{ matrix.architecture }}

- name: Login to Docker Hub
if: '!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository'
uses: docker/login-action@v2
Expand Down
22 changes: 22 additions & 0 deletions molecule/ubuntu-arm32/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******

Requirements
============

* Docker Engine

Install
=======

Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.

.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site

.. code-block:: bash
$ python3 -m pip install 'molecule[docker]'
31 changes: 31 additions & 0 deletions molecule/ubuntu-arm32/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
dependency:
name: galaxy

driver:
name: docker

role_name_check: 2

lint: |
set -e
yamllint .
ansible-lint
flake8
platforms:
- name: ansible-role-visual-studio-code-ubuntu-arm32
image: arm32v7/ubuntu:22.04

provisioner:
name: ansible
playbooks:
converge: ../code-only/converge.yml
inventory:
host_vars:
instance:
ansible_user: ansible

verifier:
name: testinfra
directory: ../code-only/tests
22 changes: 22 additions & 0 deletions molecule/ubuntu-arm64/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******

Requirements
============

* Docker Engine

Install
=======

Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.

.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site

.. code-block:: bash
$ python3 -m pip install 'molecule[docker]'
31 changes: 31 additions & 0 deletions molecule/ubuntu-arm64/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
dependency:
name: galaxy

driver:
name: docker

role_name_check: 2

lint: |
set -e
yamllint .
ansible-lint
flake8
platforms:
- name: ansible-role-visual-studio-code-ubuntu-arm64
image: arm64v8/ubuntu:22.04

provisioner:
name: ansible
playbooks:
converge: ../code-only/converge.yml
inventory:
host_vars:
instance:
ansible_user: ansible

verifier:
name: testinfra
directory: ../code-only/tests
3 changes: 2 additions & 1 deletion tasks/install-apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
become: yes
ansible.builtin.apt_repository:
repo: >-
deb [arch=amd64{{ visual_studio_code_gpgcheck | ternary("", " trusted=yes") }}
deb [arch={{ visual_studio_code_deb_architecture }}
{{ visual_studio_code_gpgcheck | ternary("", " trusted=yes") }}
signed-by=/etc/apt/keyrings/microsoft.asc]
{{ visual_studio_code_mirror }}/repos/code stable main
filename: vscode
Expand Down
10 changes: 10 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ visual_studio_code_package: "{{ (visual_studio_code_build == 'insiders') | terna

# The CLI executable
visual_studio_code_exe: "{{ (visual_studio_code_build == 'insiders') | ternary('code-insiders', 'code') }}"

# Ansible architecture to deb architecture mapping
visual_studio_code_deb_architecture_mapping:
armv6l: armhf
armv7l: armhf
aarch64: arm64

# The architecture of the deb to install
visual_studio_code_deb_architecture: >-
{{ visual_studio_code_deb_architecture_mapping[ansible_architecture | lower] | default('amd64') }}

0 comments on commit d84ca87

Please sign in to comment.