From cc8f51a2ce284efe1da1e976cdaf897fe54aee9f Mon Sep 17 00:00:00 2001 From: Scott Clarke Date: Thu, 8 Aug 2024 11:23:30 +0100 Subject: [PATCH 1/3] Add release workflow This workflow will import the role into Ansible Galaxy when a new tag is pushed to the repository --- .github/workflows/release.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..69c667a --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,23 @@ +--- +name: Release role +on: + push: + tags: + - '*' + +jobs: + import_role: + name: Import role to Ansible Galaxy + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install Ansible. + run: pip3 install ansible-core==2.17.* + - name: Start import on Ansible Galaxy + run: > + ansible-galaxy role import + --token ${{ secrets.ANSIBLE_GALAXY_API_TOKEN }} + $(echo ${{ github.repository }} | cut -d/ -f1) + $(echo ${{ github.repository }} | cut -d/ -f2) From d85adfed2f0b191a0caf9819b4ce97795c2b08e6 Mon Sep 17 00:00:00 2001 From: Scott Clarke Date: Tue, 13 Aug 2024 10:53:46 +0100 Subject: [PATCH 2/3] Fix linting issues The issues addressed are: - lines which were too long - truthy values not being specified with `true` - adding the namespace to the metadata for the role --- defaults/main.yml | 17 +++++++++++++---- meta/main.yml | 1 + tasks/main.yml | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index ebcbf45..a5b2fe7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -27,7 +27,10 @@ casd_bind: "{{ 'unix:' ~ casd_bind_path if casd_bind_path else casd_bind_address casd_quota_high: "200G" casd_cache_mnt: "/srv" casd_certs_mnt: "/certs" -casd_cmd: "--verbose --bind {{ casd_bind }} --quota-high {{ casd_quota_high }} {{ casd_metrics_args }} {{ casd_proxy_cas_args }} {{ casd_proxy_ac_args }} {{ casd_proxy_asset_args }} {{ casd_proxy_execution_args }} {{ casd_cache_mnt }}" +casd_cmd: > + "--verbose --bind {{ casd_bind }} --quota-high {{ casd_quota_high }} + {{ casd_metrics_args }} {{ casd_proxy_cas_args }} {{ casd_proxy_ac_args }} + {{ casd_proxy_asset_args }} {{ casd_proxy_execution_args }} {{ casd_cache_mnt }}" casd_default_mounts: - "{{ casd_cache }}:{{ casd_cache_mnt }}" casd_certdir_mount: @@ -45,7 +48,9 @@ casd_proxy_cas_url_arg: "{% if casd_proxy_cas_url %}--cas-remote {{ casd_proxy_c casd_proxy_cas_server_cert_arg: "{% if casd_proxy_cas_server_cert %}--cas-server-cert {{ casd_certs_mnt }}/cas_server.crt{% endif %}" casd_proxy_cas_client_cert_arg: "{% if casd_proxy_cas_client_cert %}--cas-client-cert {{ casd_certs_mnt }}/cas_client.crt{% endif %}" casd_proxy_cas_client_key_arg: "{% if casd_proxy_cas_client_key %}--cas-client-key {{ casd_certs_mnt }}/cas_client.key{% endif %}" -casd_proxy_cas_args: "{{ casd_proxy_cas_url_arg }} {{ casd_proxy_cas_server_cert_arg }} {{ casd_proxy_cas_client_cert_arg }} {{ casd_proxy_cas_client_key_arg }}" +casd_proxy_cas_args: > + "{{ casd_proxy_cas_url_arg }} {{ casd_proxy_cas_server_cert_arg }} + {{ casd_proxy_cas_client_cert_arg }} {{ casd_proxy_cas_client_key_arg }}" # AC proxy configuration casd_proxy_ac_url: "" @@ -67,7 +72,9 @@ casd_proxy_asset_url_arg: "{% if casd_proxy_asset_url %}--ra-remote {{ casd_prox casd_proxy_asset_server_cert_arg: "{% if casd_proxy_asset_server_cert %}--ra-server-cert {{ casd_certs_mnt }}/asset_server.crt{% endif %}" casd_proxy_asset_client_cert_arg: "{% if casd_proxy_asset_client_cert %}--ra-client-cert {{ casd_certs_mnt }}/asset_client.crt{% endif %}" casd_proxy_asset_client_key_arg: "{% if casd_proxy_asset_client_key %}--ra-client-key {{ casd_certs_mnt }}/asset_client.key{% endif %}" -casd_proxy_asset_args: "{{ casd_proxy_asset_url_arg }} {{ casd_proxy_asset_server_cert_arg }} {{ casd_proxy_asset_client_cert_arg }} {{ casd_proxy_asset_client_key_arg }}" +casd_proxy_asset_args: > + "{{ casd_proxy_asset_url_arg }} {{ casd_proxy_asset_server_cert_arg }} + {{ casd_proxy_asset_client_cert_arg }} {{ casd_proxy_asset_client_key_arg }}" # Execution proxy configuration casd_proxy_execution_url: "" @@ -78,4 +85,6 @@ casd_proxy_execution_url_arg: "{% if casd_proxy_asset_url %}--exec-remote {{ cas casd_proxy_execution_server_cert_arg: "{% if casd_proxy_asset_server_cert %}--exec-server-cert {{ casd_certs_mnt }}/asset_server.crt{% endif %}" casd_proxy_execution_client_cert_arg: "{% if casd_proxy_asset_client_cert %}--exec-client-cert {{ casd_certs_mnt }}/asset_client.crt{% endif %}" casd_proxy_execution_client_key_arg: "{% if casd_proxy_asset_client_key %}--exec-client-key {{ casd_certs_mnt }}/asset_client.key{% endif %}" -casd_proxy_execution_args: "{{ casd_proxy_asset_url_arg }} {{ casd_proxy_asset_server_cert_arg }} {{ casd_proxy_asset_client_cert_arg }} {{ casd_proxy_asset_client_key_arg }}" +casd_proxy_execution_args: > + "{{ casd_proxy_asset_url_arg }} {{ casd_proxy_asset_server_cert_arg }} + {{ casd_proxy_asset_client_cert_arg }} {{ casd_proxy_asset_client_key_arg }}" diff --git a/meta/main.yml b/meta/main.yml index f7d12de..8705e40 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,5 +1,6 @@ galaxy_info: role_name: buildbox_casd + namespace: codethinklabs author: Scott Clarke description: Deploy buildbox-casd in a docker container company: Codethink Limited diff --git a/tasks/main.yml b/tasks/main.yml index 2b12dcc..bb8e0a8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -55,7 +55,7 @@ community.docker.docker_network: name: "{{ casd_network }}" connected: "{{ [] if casd_bind_path else casd_network_connected_containers }}" - appends: yes + appends: true - name: Bring up buildbox-casd community.docker.docker_container: From 60c1caa7b01b74158072d9654707f83791087c98 Mon Sep 17 00:00:00 2001 From: Scott Clarke Date: Tue, 13 Aug 2024 10:55:53 +0100 Subject: [PATCH 3/3] Add workflow to perform linting on pull requests --- .github/workflows/pull-request.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/pull-request.yaml diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml new file mode 100644 index 0000000..073234e --- /dev/null +++ b/.github/workflows/pull-request.yaml @@ -0,0 +1,20 @@ +--- +name: Check ansible +on: + pull_request: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install ansible-lint + run: pip3 install ansible-lint==24.7.* + - name: Install ansible docker collection + run: ansible-galaxy collection install 'community.docker<3.13' + - name: Run ansible-lint + run: ansible-lint .