Skip to content

Commit

Permalink
Create collection for CI framework
Browse files Browse the repository at this point in the history
Modify run_ansible_test and setup_molecule scripts to consume the new
collection.
  • Loading branch information
cescgina authored and openshift-merge-bot[bot] committed Dec 13, 2023
1 parent 08d23b4 commit e440257
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 9 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ skip_list:
- schema[meta] # Apparently "CentOS 9" isn't known... ?!
- schema[vars] # weird issue with some "vars" in playbooks
- yaml[line-length] # We have long lines, yes.
- galaxy[no-changelog]
107 changes: 107 additions & 0 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
### REQUIRED
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: cifmw

# The name of the collection. Has the same character restrictions as 'namespace'
name: general

# The version of the collection. Must be compatible with semantic versioning
version: 1.0.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- Sandeepyadav93 (https://github.com/Sandeepyadav93)
- adrianfusco (https://github.com/adrianfusco)
- afazekas (https://github.com/afazekas)
- arxcruz (https://github.com/arxcruz)
- bshephar (https://github.com/bshephar)
- bshewale (https://github.com/bshewale)
- cescgina (https://github.com/cescgina)
- cjeanner (https://github.com/cjeanner)
- dasm (https://github.com/dasm)
- dsariel (https://github.com/dsariel)
- fmount (https://github.com/fmount)
- frenzyfriday (https://github.com/frenzyfriday)
- fultonj (https://github.com/fultonj)
- jpodivin (https://github.com/jpodivin)
- lewisdenny (https://github.com/lewisdenny)
- pablintino (https://github.com/pablintino)
- psathyan (https://github.com/psathyan)
- rabi (https://github.com/rabi)
- raukadah (https://github.com/raukadah)
- rebtoor (https://github.com/rebtoor)
- rlandy (https://github.com/rlandy)
- slagle (https://github.com/slagle)
- son-vyas (https://github.com/son-vyas)
- steveb (https://github.com/steveb)
- stuggi (https://github.com/stuggi)
- tosky (https://github.com/tosky)
- viroel (https://github.com/viroel)

### OPTIONAL but strongly recommended
# A short summary description of the collection
description: "CI-Framework is a way to bootstrap development and CI environments for RHOSO."

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license: []

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: 'LICENSE'

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags:
- cloud
- linux
- tools
- networking
- security
- RHOSO

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies:
'git+https://github.com/containers/ansible-podman-collections': 'master'
'git+https://github.com/ansible-collections/community.general': 'main'
'git+https://github.com/ansible-collections/ansible.posix': 'main'
'git+https://github.com/ansible-collections/community.libvirt': 'main'
'git+https://github.com/ansible-collections/community.crypto': 'main'
'git+https://github.com/ansible-collections/kubernetes.core': 'main'
'git+https://github.com/openstack/ansible-collections-openstack': 'master'
'git+https://github.com/ansible-collections/ansible.netcommon': 'main'
'git+https://github.com/openstack/ansible-config_template': 'master'

# The URL of the originating SCM repository
repository: https://github.com/openstack-k8s-operators/ci-framework

# The URL to any online docs
documentation: https://ci-framework.readthedocs.io/en/latest/

# The URL to the homepage of the collection/project
homepage: https://ci-framework.readthedocs.io/en/latest/

# The URL to the collection issue tracker
issues: https://ci-framework.readthedocs.io/en/latest/index.html#found-a-bug-or-need-a-new-feature

# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered. Mutually exclusive with 'manifest'
build_ignore: []

# A dict controlling use of manifest directives used in building the collection artifact. The key 'directives' is a
# list of MANIFEST.in style
# L(directives,https://packaging.python.org/en/latest/guides/using-manifest-in/#manifest-in-commands). The key
# 'omit_default_directives' is a boolean that controls whether the default directives are used. Mutually exclusive
# with 'build_ignore'
# manifest: null
2 changes: 2 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
requires_ansible: '>=2.13.0'
13 changes: 7 additions & 6 deletions scripts/run_ansible_test
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@ collection_path='/usr/share/ansible/collections/ansible_collections'
case ${USE_VENV} in
y|yes|true):
ansible_test="${HOME}/test-python/bin/ansible-test"
collection_path="${HOME}.ansible/collections/ansible_collections"
collection_path="${HOME}/.ansible/collections/ansible_collections"
;;
esac

mkdir -p ${HOME}/code/ansible_collections/cifmw/general
rsync -a --delete ${PROJECT_DIR}ci_framework/* ${HOME}/code/ansible_collections/cifmw/general/
ln -fs ${collection_path}/* ${HOME}/code/ansible_collections/
mkdir -p ${HOME}/code
ansible-galaxy collection install git+file://${PROJECT_DIR} -p ${HOME}/code

# Create/append the sanity exceptions for the current ansible version
ansible_version=$(python3 -c "import ansible; print(ansible.__version__)" | sed 's/\.[^.]*$//')
cat "${HOME}/code/ansible_collections/cifmw/general/tests/sanity/ignore.txt" >> \
"${HOME}/code/ansible_collections/cifmw/general/tests/sanity/ignore-${ansible_version}.txt"
cat "${HOME}/code/ansible_collections/cifmw/general/ci_framework/tests/sanity/ignore.txt" >> \
"${HOME}/code/ansible_collections/cifmw/general/ci_framework/tests/sanity/ignore-${ansible_version}.txt"

pushd ${HOME}/code/ansible_collections/cifmw/general
cp -r ci_framework/tests .

${ansible_test} sanity --test validate-modules
if [ -d tests/integration ]; then
${ansible_test} integration --color=yes
Expand Down
4 changes: 1 addition & 3 deletions scripts/setup_molecule
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,4 @@ ${PIP} install \
-r "${PROJECT_DIR}molecule-requirements.txt" ${@:-}
${GALAXY} collection install --timeout=120 \
-p "${COLLECTION_PATH}" \
-r "${PROJECT_DIR}requirements.yml"
mkdir -p ${HOME}/.ansible/plugins
cp -a ${PROJECT_DIR}plugins/* ${HOME}/.ansible/plugins/
git+file://${PROJECT_DIR}

0 comments on commit e440257

Please sign in to comment.