Skip to content

Commit

Permalink
Merge pull request #122 from AndrewTwydell/andrewtwydell-104
Browse files Browse the repository at this point in the history
Andrewtwydell 1.0.4 public release
  • Loading branch information
AndrewTwydell authored Apr 20, 2023
2 parents dd6d0b8 + 2c312d9 commit b74a37d
Show file tree
Hide file tree
Showing 44 changed files with 766 additions and 314 deletions.
6 changes: 6 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
skip_list:
- "name[template]"
- "args[module]"
- "yaml[line-length]"
- "yaml[truthy]"
- "galaxy[no-changelog]"
- "meta-unsupported-ansible"
- "meta-runtime[unsupported-version]"
68 changes: 14 additions & 54 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,28 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: CodeQL

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '41 8 * * 1'
- cron: "0 2 * * 1"
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
queries: security-extended
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Checkout repository
uses: actions/checkout@v2

#- run: |
# make bootstrap
# make release
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: "python"
queries: security-extended

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
docs/build/
.idea
__pycache__
venv2
venv3
venv*
tests/output
ibm-ibm_zos_cics-*.tar.gz
tests/integration/targets/cics_cmci/cmci-variables.yml
Expand Down
65 changes: 65 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
language: python
python:
- "2.7"
- "3.8"
- "3.9"
- "3.10"
env:
- ANSIBLE_VERSION="stable-2.11"
- ANSIBLE_VERSION="stable-2.12"
- ANSIBLE_VERSION="stable-2.13"
- ANSIBLE_VERSION="stable-2.14"
- ANSIBLE_VERSION="devel"
matrix:
exclude:
# Python 2.7 max ansible version is 2.11
- python: "2.7"
env: ANSIBLE_VERSION="stable-2.12"
- python: "2.7"
env: ANSIBLE_VERSION="stable-2.13"
- python: "2.7"
env: ANSIBLE_VERSION="stable-2.14"
- python: "2.7"
env: ANSIBLE_VERSION="devel"
# Python 3.8 max ansible version is 2.13
- python: "3.8"
env: ANSIBLE_VERSION="stable-2.14"
- python: "3.8"
env: ANSIBLE_VERSION="devel"
# Ansible 2.11 max python version support is 3.9
- python: "3.10"
env: ANSIBLE_VERSION="stable-2.11"
services:
- docker
before_script: source .travis/get_vault_data.sh
script: |
echo ""
echo "#############################################"
echo "# PYTHON VERSION: ${TRAVIS_PYTHON_VERSION}"
echo "# ANSIBLE VERSION: ${ANSIBLE_VERSION}"
echo "#############################################"
echo ""
ANSIBLE_NO_STABLE="${ANSIBLE_VERSION//stable-/}"
ANSIBLE_NO_DOT="${ANSIBLE_NO_STABLE//./}"
PYTHON_NO_DOT="${TRAVIS_PYTHON_VERSION//./}"
IMAGE_NAME="cics-python-$PYTHON_NO_DOT-ansible-$ANSIBLE_NO_DOT"
echo "$ARTIFACTORY_TOKEN" | docker login --username $ARTIFACTORY_USER --password-stdin $DOCKER_REGISTRY
docker pull $DOCKER_REGISTRY/$IMAGE_NAME:latest
bash "$TRAVIS_BUILD_DIR"/.travis/build_env.sh
docker run --rm -it -v \
$(pwd):/root/ansible_collections/ibm/ibm_zos_cics \
-e TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION \
$DOCKER_REGISTRY/$IMAGE_NAME:latest \
bash -c "cd /root/ansible_collections/ibm/ibm_zos_cics && bash .travis/build_and_test.sh"
jobs:
include:
- stage: deploy
script: bash .travis/push_artifactory.sh
python: "3.10"
env: ANSIBLE_VERSION="stable-2.14"
on:
branch: main
59 changes: 59 additions & 0 deletions .travis/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash

set -e

git config --global --add safe.directory /root/ansible_collections/ibm/ibm_zos_cics

pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt

# ansible-lint requires python >= 3.8
if [ "$TRAVIS_PYTHON_VERSION" != "2.7" ]; then
echo ""
echo "##########################################################"
echo "###################### Ansible-lint ######################"
echo "##########################################################"
echo ""
ansible-lint --profile production
fi

echo ""
echo "##########################################################"
echo "################## Ansible Sanity Tests ##################"
echo "##########################################################"
echo ""
ansible-test sanity --python "$TRAVIS_PYTHON_VERSION"

echo ""
echo "##########################################################"
echo "################### Ansible Unit Tests ###################"
echo "##########################################################"
echo ""
ansible-test units --python "$TRAVIS_PYTHON_VERSION"

echo ""
echo "###########################################################"
echo "################ Ansible Integration Tests ################"
echo "###########################################################"
echo ""
ansible-test integration cics_cmci --python "$TRAVIS_PYTHON_VERSION"

echo ""
echo "##########################################################"
echo "############## Ansible Missing Module Tests ##############"
echo "##########################################################"
echo ""
pip uninstall xmltodict -y
ansible-test integration cics_cmci_missing_xmltodict_library --python "$TRAVIS_PYTHON_VERSION"

pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
pip uninstall requests -y
ansible-test integration cics_cmci_missing_requests_library --python "$TRAVIS_PYTHON_VERSION"

echo ""
echo "###########################################################"
echo "#################### Build Collection #####################"
echo "###########################################################"
echo ""
pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
ansible-galaxy collection build /root/ansible_collections/ibm/ibm_zos_cics --output-path /root/ansible_collections/ibm/ibm_zos_cics --force
ansible-galaxy collection install /root/ansible_collections/ibm/ibm_zos_cics/ibm-ibm_zos_cics-* --force
35 changes: 35 additions & 0 deletions .travis/build_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

A="A"
B="B"
star="*"

TRAVIS_NO_DOT="${TRAVIS_JOB_NUMBER//./D}"

program_name_1="A$TRAVIS_NO_DOT$A"
program_name_2="A$TRAVIS_NO_DOT$B"
program_filter="A$TRAVIS_NO_DOT$star"

echo ""
echo "################ Job-Specific Variables ################"
echo "## Program 1 Name: $program_name_1"
echo "## Program 2 Name: $program_name_2"
echo "## Program Filter: $program_filter"
echo ""

echo "############# Creating cmci-variables.yml #############"
touch "$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml
{
echo cmci_host: "$CMCI_HOST"
echo cmci_port: "$CMCI_PORT"
echo cmci_secure_port: "$CMCI_SECURE_PORT"
echo cmci_user: "$CMCI_USER"
echo cmci_password: "$CMCI_PASS"
echo cmci_context: "$CMCI_CONTEXT"
echo cmci_scope: "$CMCI_SCOPE"
echo cmci_scope_region_1: "$CMCI_REGION_1"
echo cmci_scope_region_2: "$CMCI_REGION_2"
echo cmci_program_name_1: "$program_name_1"
echo cmci_program_name_2: "$program_name_2"
echo cmci_program_filter: "$program_filter"
} >>"$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml
22 changes: 22 additions & 0 deletions .travis/get_vault_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Wiki page on Vault Integration:
# https://cicswiki.hursley.ibm.com:9443/wiki/CICS_Explorer/artifactory_vault

VAULT_ONETIME_TOKEN=$(curl -k -s --request POST --data '{"role_id":"'"$VAULT_ROLE_ID"'","secret_id":"'"$VAULT_SECRET_ID"'"}' "$VAULT_URL"/auth/approle/login | jq -r ".auth.client_token")
ARTI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/"artifactory" | jq -r ".data.data")
export "ARTIFACTORY_USER"="$(jq -r ".user" <<<"$ARTI")"
export "ARTIFACTORY_TOKEN"="$(jq -r ".token" <<<"$ARTI")"

PLEX=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/plex2 | jq -r ".data.data")
export "CMCI_USER"="$(jq -r ".username" <<<"$PLEX")"
export "CMCI_PASS"="$(jq -r ".password" <<<"$PLEX")"

CMCI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/cmci | jq -r ".data.data")
export "CMCI_HOST"="$(jq -r ".url" <<<"$CMCI")"
export "CMCI_PORT"="$(jq -r ".port" <<<"$CMCI")"
export "CMCI_SECURE_PORT"="$(jq -r ".secure_port" <<<"$CMCI")"
export "CMCI_SCOPE"="$(jq -r ".scope" <<<"$CMCI")"
export "CMCI_REGION_1"="$(jq -r ".region_1" <<<"$CMCI")"
export "CMCI_REGION_2"="$(jq -r ".region_2" <<<"$CMCI")"
export "CMCI_CONTEXT"="$(jq -r ".context" <<<"$CMCI")"
29 changes: 29 additions & 0 deletions .travis/push_artifactory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e

pip install https://github.com/ansible/ansible/archive/stable-2.14.tar.gz

ansible-galaxy collection build "$TRAVIS_BUILD_DIR" --force

file_with_prefix="$(find . -type f -iname "ibm-ibm_zos_cics-*")"
file="${file_with_prefix//.\//}"
no_extension="${file//.tar.gz/}"
no_starting="${no_extension//.\//}"
version_number="${no_starting//ibm-ibm_zos_cics-/}"
TRAVIS_NO_DOT="${TRAVIS_JOB_NUMBER//./D}"

echo ""
echo "##########################################################"
echo "############# Uploading build to Artifactory #############"
echo "##########################################################"
echo "#"
echo "# File: $file"
echo "# Version: $version_number"
echo "#"
echo "##########################################################"

curl -ksSf \
-H "Authorization: Bearer $ARTIFACTORY_TOKEN" -X PUT \
-T "$TRAVIS_BUILD_DIR"/"$file" \
"$ARTIFACTORY_URL"/"$version_number"/"$TRAVIS_NO_DOT"/"$file"
12 changes: 12 additions & 0 deletions .whitesource
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"settingsInheritedFrom": "whitesource-config/whitesource-config@master",
"remediateSettings": {
"enableRenovate": true,
"extends": [
"config:base"
]
},
"issueSettings": {
"issueRepoName": "cics-ts-tracking"
}
}
15 changes: 7 additions & 8 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# (c) Copyright IBM Corp. 2020,2021
# (c) Copyright IBM Corp. 2020,2023
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
-r requirements.txt
ansible-core==2.13.7; python_version >= '3'
ansible-core==2.11.12; python_version < '3'
# ansible-core==2.13.7; python_version >= '3'
# ansible-core==2.11.12; python_version < '3'
junit-xml==1.9 # To get JUnit xml report from ansible-test
pytest_mock==1.12.1
mock==3.0.5
Expand All @@ -16,8 +16,7 @@ shellcheck-py==0.9.0.2; python_version >= '3'
rstcheck==3.3.1; python_version >= '3'
yamllint==1.29.0; python_version >= '3'
voluptuous==0.13.1; python_version >= '3'
ansible-doc-extractor==0.1.6; python_version >= '3'
ansible-lint==6.10.2; python_version >= '3'
pycodestyle==2.6.0; python_version >= '3'
Sphinx==3.4.3; python_version >= '3'
sphinx-rtd-theme==0.5.1; python_version >= '3'
# needed to lint devel ansible version
ansible-lint==6.12.2; python_version >= '3' and python_version < '3.9'
ansible-lint==6.13.1; python_version >= '3.9'
pycodestyle==2.10.0; python_version >= '3'
7 changes: 7 additions & 0 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# (c) Copyright IBM Corp. 2020,2023
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
-r dev-requirements.txt

ansible-doc-extractor==0.1.6; python_version >= '3'
Sphinx==3.4.3; python_version >= '3'
sphinx-rtd-theme==0.5.1; python_version >= '3'
11 changes: 5 additions & 6 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. ...............................................................................
.. © Copyright IBM Corporation 2020,2021 .
.. © Copyright IBM Corporation 2020,2023 .
.. Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0) .
.. ...............................................................................
Expand Down Expand Up @@ -32,14 +32,13 @@ The **The IBM z/OS CICS collection** is following the **Red Hat Ansible Certifie
Features
================

The IBM z/OS CICS collection includes `modules`_, `sample playbooks`_, and ansible-doc to automate tasks against CICS resources and definitions.

The IBM z/OS CICS collection includes `modules`_ and ansible-doc to automate tasks against CICS resources and definitions. There are also samples in the `Z Ansible collection samples repository`_ for core z/OS, CICS, and other z/OS subsystems.


.. _modules:
https://github.com/ansible-collections/ibm_zos_cics/tree/master/plugins/modules/
.. _sample playbooks:
https://github.com/ansible-collections/ibm_zos_cics/tree/master/playbooks/
https://github.com/ansible-collections/ibm_zos_cics/tree/main/plugins/modules/
.. _Z Ansible collection samples repository:
https://github.com/IBM/z_ansible_collections_samples


Copyright
Expand Down
Loading

0 comments on commit b74a37d

Please sign in to comment.