-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kogeler <[email protected]>
- Loading branch information
Showing
19 changed files
with
247 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: main branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-molecule-tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
role-names: [node, ws_health_exporter] | ||
molecule-drivers: [docker, lxd] | ||
# We test the latest version and minimum supported version | ||
ansible-versions: [5.0.1, 8.4.0] | ||
uses: ./.github/workflows/reusable-molecule.yml | ||
with: | ||
role-name: ${{ matrix.role-names }} | ||
molecule-driver: ${{ matrix.molecule-drivers }} | ||
ansible-version: ${{ matrix.ansible-versions }} | ||
check-version: | ||
uses: ./.github/workflows/reusable-check-version.yml | ||
with: | ||
compare-versions: false | ||
deploy-galaxy: | ||
needs: [run-molecule-tests, check-version] | ||
uses: ./.github/workflows/reusable-galaxy-deploy.yml | ||
secrets: | ||
api-token: ${{ secrets.GALAXY_API_KEY }} | ||
create-git-tag: | ||
runs-on: ubuntu-22.04 | ||
needs: [deploy-galaxy, check-version] | ||
env: | ||
CURRENT_GALAXY_VERSION: ${{ needs.check-version.outputs.current-galaxy-version }} | ||
steps: | ||
- name: Print tag version | ||
run: | | ||
echo "Tag version: ${CURRENT_GALAXY_VERSION}" | ||
- name: Create Tag | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const {CURRENT_GALAXY_VERSION} = process.env | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: `refs/tags/${CURRENT_GALAXY_VERSION}`, | ||
sha: context.sha | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: check Galaxy version | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check-version: | ||
uses: ./.github/workflows/reusable-check-version.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: check PR (node) | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- roles/node/** | ||
- .github/** | ||
|
||
jobs: | ||
run-molecule-tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
molecule-driver: [lxd, docker] | ||
uses: ./.github/workflows/reusable-molecule.yml | ||
with: | ||
role-name: node | ||
molecule-driver: ${{ matrix.molecule-driver }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: check PR (ws_health_exporter) | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- roles/ws_health_exporter/** | ||
- .github/** | ||
|
||
jobs: | ||
run-molecule-tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
molecule-driver: [lxd, docker] | ||
uses: ./.github/workflows/reusable-molecule.yml | ||
with: | ||
role-name: ws_health_exporter | ||
molecule-driver: ${{ matrix.molecule-driver }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
compare-versions: | ||
required: false | ||
type: boolean | ||
default: true | ||
outputs: | ||
current-galaxy-version: | ||
description: "Current Galaxy version" | ||
value: ${{ jobs.check-version.outputs.current-galaxy-version }} | ||
jobs: | ||
check-version: | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
current-galaxy-version: ${{ steps.check-current-version.outputs.current-galaxy-version }} | ||
steps: | ||
- name: Setup Python modules | ||
run: pip3 install --no-cache-dir yq | ||
- name: Checkout current ref | ||
uses: actions/checkout@v4 | ||
with: | ||
path: "${{ github.repository }}" | ||
- name: Checkout main ref | ||
if: ${{ inputs.compare-versions }} | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: 'main' | ||
path: "main/${{ github.repository }}" | ||
- name: Check the current version | ||
id: check-current-version | ||
run: | | ||
CURRENT_GALAXY_VERSION=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.version' | tr -d '\n') | ||
echo "Current Galaxy version: ${CURRENT_GALAXY_VERSION}" | ||
if [ "$CURRENT_GALAXY_VERSION" != 'null' ] | ||
then | ||
echo "CURRENT_GALAXY_VERSION=${CURRENT_GALAXY_VERSION}" >> "${GITHUB_ENV}" | ||
echo "current-galaxy-version=${CURRENT_GALAXY_VERSION}" >> "${GITHUB_OUTPUT}" | ||
fi | ||
- name: Check the version in the main branch | ||
if: ${{ inputs.compare-versions }} | ||
run: | | ||
MAIN_GALAXY_VERSION=$(cat main/${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.version' | tr -d '\n') | ||
echo "Galaxy version in the main branch: ${MAIN_GALAXY_VERSION}" | ||
echo "MAIN_GALAXY_VERSION=${MAIN_GALAXY_VERSION}" >> "${GITHUB_ENV}" | ||
- name: Validate the current version | ||
if: ${{ ! env.CURRENT_GALAXY_VERSION }} | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
core.setFailed('Your Galaxy version is absent or empty!') | ||
- name: Compare versions | ||
if: ${{ inputs.compare-versions && env.MAIN_GALAXY_VERSION >= env.CURRENT_GALAXY_VERSION }} | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
core.setFailed('Your Galaxy version is lower than the version in the main branch or equal. Please bump your version!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
ansible-version: | ||
required: false | ||
type: string | ||
default: 8.4.0 | ||
secrets: | ||
api-token: | ||
required: true | ||
jobs: | ||
deploy-galaxy: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: "${{ github.repository }}" | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- name: Setup Python modules | ||
# PyYAML==5.3.1 fixes the 'The license_file parameter is deprecated, use license_files instead.' error | ||
# the 5.4.1 version still has the issue | ||
run: pip3 install --no-cache-dir PyYAML==5.3.1 ansible==${{ inputs.ansible-version }} yq | ||
- name: Print Ansible version | ||
run: ansible --version | ||
- name: Build collection | ||
run: ansible-galaxy collection build "${{ github.repository }}" | ||
- name: Save API token | ||
run: echo '${{ secrets.api-token }}' > api-token | ||
- name: Publish collection | ||
run: | | ||
GALAXY_NAMESPACE=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.namespace' | tr -d '\n') | ||
GALAXY_NAME=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.name' | tr -d '\n') | ||
VERSION=$(cat ${GITHUB_REPOSITORY}/galaxy.yml | yq -r '.version' | tr -d '\n') | ||
ansible-galaxy collection publish ${GALAXY_NAMESPACE}-${GALAXY_NAME}-${VERSION}.tar.gz --api-key="$(cat api-token | tr -d '\n')" | ||
- name: Remove API token | ||
run: rm -v api-token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
role-name: | ||
required: true | ||
type: string | ||
molecule-driver: | ||
required: true | ||
type: string | ||
ansible-version: | ||
required: false | ||
type: string | ||
default: 8.4.0 | ||
jobs: | ||
molecule: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
DRIVER: ${{ inputs.molecule-driver }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: "${{ github.repository }}" | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- name: Setup Python modules | ||
# PyYAML==5.3.1 fixes the 'The license_file parameter is deprecated, use license_files instead.' error | ||
# 5.4.1 version still has the issue | ||
run: pip3 install --no-cache-dir PyYAML==5.3.1 yamllint ansible==${{ inputs.ansible-version }} ansible-lint molecule molecule-plugins[docker] molecule-lxd docker | ||
- name: Print Ansible version | ||
run: ansible --version | ||
- name: Setup LXD | ||
if: ${{ inputs.molecule-driver == 'lxd' }} | ||
# https://github.com/canonical/setup-lxd | ||
uses: canonical/[email protected] | ||
with: | ||
channel: latest/stable | ||
- name: Run molecule tests | ||
run: molecule test --all | ||
working-directory: "${{ github.repository }}/roles/${{ inputs.role-name }}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ plan.out | |
*service-account-key.json | ||
*.private_key_encrypted | ||
.idea | ||
/ansible/collections | ||
/ansible/collections | ||
venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requires_ansible: ">=2.12.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# key_inject ansible role |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# ws_health_exporter ansible role |
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
roles/ws_health_exporter/molecule/default/collections.yml.bak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#collections: | ||
# - name: https://github.com/paritytech/ansible-galaxy.git | ||
# type: git | ||
# version: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.