Add Ansible Galaxy imports #108
Workflow file for this run
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
--- | |
# Copyright 2023 Cloudera, Inc. All Rights Reserved. | |
# | |
# 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. | |
name: Validate Pull Request | |
on: | |
pull_request: | |
branches: | |
- 'release/**' | |
- 'devel' | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python and caching | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
cache: 'pip' | |
- name: Set up Ansible collections | |
run: | | |
sudo update-alternatives --install /usr/bin/python python $(which python3) 1 | |
pip install --upgrade pip | |
pip install ansible-core~=2.12.0 ansible-builder bindep pycodestyle voluptuous pylint pyyaml ansible-lint | |
mkdir -p /usr/share/ansible/collections /usr/share/ansible/roles | |
ansible-galaxy collection install -r builder/requirements.yml -p /usr/share/ansible/collections | |
ansible-galaxy role install -r builder/requirements.yml -p /usr/share/ansible/roles | |
- name: Report Ansible version, collections, and roles | |
run: | | |
ansible --version | |
ansible-galaxy collection list | |
ansible-galaxy role list | |
- name: Set up Ansible collection dependencies | |
run: | | |
ansible-builder introspect --write-pip final_python.txt --write-bindep final_bindep.txt /usr/share/ansible/collections | |
[[ -f final_python.txt ]] && pip install -r final_python.txt || echo "No Python dependencies found." | |
[[ -f final_bindep.txt ]] && bindep --file final_bindep.txt || echo "No system dependencies found." | |
- name: Report installed Python dependencies | |
run: pip freeze | |
- name: Validate collection | |
run: | | |
pushd /usr/share/ansible/collections/ansible_collections/cloudera/cloud | |
#ansible-lint | |
#ansible-test sanity --test pep8 | |
#ansible-test sanity --test validate-modules | |
#ansible-test units --requirements --color yes --redact | |
popd | |
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
- name: Save PR number | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
run: | | |
mkdir -p ./pr | |
echo $PR_NUMBER > ./pr/pr_number | |
- name: Upload the PR number | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pr_number | |
path: pr/ | |
import-galaxy: | |
needs: validate | |
permissions: | |
contents: read | |
name: Import collection with Galaxy importer | |
uses: ansible-community/github-action-test-galaxy-import/.github/workflows/test-galaxy-import.yml@main |