Skip to content

Commit b74a37d

Browse files
Merge pull request #122 from AndrewTwydell/andrewtwydell-104
Andrewtwydell 1.0.4 public release
2 parents dd6d0b8 + 2c312d9 commit b74a37d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+766
-314
lines changed

.ansible-lint

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
skip_list:
33
- "name[template]"
4+
- "args[module]"
5+
- "yaml[line-length]"
6+
- "yaml[truthy]"
7+
- "galaxy[no-changelog]"
8+
- "meta-unsupported-ansible"
9+
- "meta-runtime[unsupported-version]"
Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,28 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
1+
name: CodeQL
132

143
on:
154
push:
16-
branches: [ main ]
5+
branches: [main]
176
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ main ]
7+
branches: [main]
208
schedule:
21-
- cron: '41 8 * * 1'
9+
- cron: "0 2 * * 1"
10+
workflow_dispatch:
2211

2312
jobs:
2413
analyze:
2514
name: Analyze
2615
runs-on: ubuntu-latest
2716

28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
language: [ 'python' ]
32-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33-
# Learn more:
34-
# 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
35-
3617
steps:
37-
- name: Checkout repository
38-
uses: actions/checkout@v2
39-
40-
# Initializes the CodeQL tools for scanning.
41-
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
43-
with:
44-
languages: ${{ matrix.language }}
45-
queries: security-extended
46-
# If you wish to specify custom queries, you can do so here or in a config file.
47-
# By default, queries listed here will override any specified in a config file.
48-
# Prefix the list here with "+" to use these queries and those in the config file.
49-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
50-
51-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52-
# If this step fails, then you should remove it and run the build manually (see below)
53-
- name: Autobuild
54-
uses: github/codeql-action/autobuild@v1
55-
56-
# ℹ️ Command-line programs to run using the OS shell.
57-
# 📚 https://git.io/JvXDl
58-
59-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60-
# and modify them (or add more) to build your code if your project
61-
# uses a compiled language
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
6220

63-
#- run: |
64-
# make bootstrap
65-
# make release
21+
- name: Initialize CodeQL
22+
uses: github/codeql-action/init@v2
23+
with:
24+
languages: "python"
25+
queries: security-extended
6626

67-
- name: Perform CodeQL Analysis
68-
uses: github/codeql-action/analyze@v1
27+
- name: Perform CodeQL Analysis
28+
uses: github/codeql-action/analyze@v2

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
docs/build/
33
.idea
44
__pycache__
5-
venv2
6-
venv3
5+
venv*
76
tests/output
87
ibm-ibm_zos_cics-*.tar.gz
98
tests/integration/targets/cics_cmci/cmci-variables.yml

.travis.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.8"
5+
- "3.9"
6+
- "3.10"
7+
env:
8+
- ANSIBLE_VERSION="stable-2.11"
9+
- ANSIBLE_VERSION="stable-2.12"
10+
- ANSIBLE_VERSION="stable-2.13"
11+
- ANSIBLE_VERSION="stable-2.14"
12+
- ANSIBLE_VERSION="devel"
13+
matrix:
14+
exclude:
15+
# Python 2.7 max ansible version is 2.11
16+
- python: "2.7"
17+
env: ANSIBLE_VERSION="stable-2.12"
18+
- python: "2.7"
19+
env: ANSIBLE_VERSION="stable-2.13"
20+
- python: "2.7"
21+
env: ANSIBLE_VERSION="stable-2.14"
22+
- python: "2.7"
23+
env: ANSIBLE_VERSION="devel"
24+
# Python 3.8 max ansible version is 2.13
25+
- python: "3.8"
26+
env: ANSIBLE_VERSION="stable-2.14"
27+
- python: "3.8"
28+
env: ANSIBLE_VERSION="devel"
29+
# Ansible 2.11 max python version support is 3.9
30+
- python: "3.10"
31+
env: ANSIBLE_VERSION="stable-2.11"
32+
services:
33+
- docker
34+
before_script: source .travis/get_vault_data.sh
35+
script: |
36+
echo ""
37+
echo "#############################################"
38+
echo "# PYTHON VERSION: ${TRAVIS_PYTHON_VERSION}"
39+
echo "# ANSIBLE VERSION: ${ANSIBLE_VERSION}"
40+
echo "#############################################"
41+
echo ""
42+
ANSIBLE_NO_STABLE="${ANSIBLE_VERSION//stable-/}"
43+
ANSIBLE_NO_DOT="${ANSIBLE_NO_STABLE//./}"
44+
PYTHON_NO_DOT="${TRAVIS_PYTHON_VERSION//./}"
45+
IMAGE_NAME="cics-python-$PYTHON_NO_DOT-ansible-$ANSIBLE_NO_DOT"
46+
47+
echo "$ARTIFACTORY_TOKEN" | docker login --username $ARTIFACTORY_USER --password-stdin $DOCKER_REGISTRY
48+
docker pull $DOCKER_REGISTRY/$IMAGE_NAME:latest
49+
50+
bash "$TRAVIS_BUILD_DIR"/.travis/build_env.sh
51+
52+
docker run --rm -it -v \
53+
$(pwd):/root/ansible_collections/ibm/ibm_zos_cics \
54+
-e TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION \
55+
$DOCKER_REGISTRY/$IMAGE_NAME:latest \
56+
bash -c "cd /root/ansible_collections/ibm/ibm_zos_cics && bash .travis/build_and_test.sh"
57+
58+
jobs:
59+
include:
60+
- stage: deploy
61+
script: bash .travis/push_artifactory.sh
62+
python: "3.10"
63+
env: ANSIBLE_VERSION="stable-2.14"
64+
on:
65+
branch: main

.travis/build_and_test.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
git config --global --add safe.directory /root/ansible_collections/ibm/ibm_zos_cics
6+
7+
pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
8+
9+
# ansible-lint requires python >= 3.8
10+
if [ "$TRAVIS_PYTHON_VERSION" != "2.7" ]; then
11+
echo ""
12+
echo "##########################################################"
13+
echo "###################### Ansible-lint ######################"
14+
echo "##########################################################"
15+
echo ""
16+
ansible-lint --profile production
17+
fi
18+
19+
echo ""
20+
echo "##########################################################"
21+
echo "################## Ansible Sanity Tests ##################"
22+
echo "##########################################################"
23+
echo ""
24+
ansible-test sanity --python "$TRAVIS_PYTHON_VERSION"
25+
26+
echo ""
27+
echo "##########################################################"
28+
echo "################### Ansible Unit Tests ###################"
29+
echo "##########################################################"
30+
echo ""
31+
ansible-test units --python "$TRAVIS_PYTHON_VERSION"
32+
33+
echo ""
34+
echo "###########################################################"
35+
echo "################ Ansible Integration Tests ################"
36+
echo "###########################################################"
37+
echo ""
38+
ansible-test integration cics_cmci --python "$TRAVIS_PYTHON_VERSION"
39+
40+
echo ""
41+
echo "##########################################################"
42+
echo "############## Ansible Missing Module Tests ##############"
43+
echo "##########################################################"
44+
echo ""
45+
pip uninstall xmltodict -y
46+
ansible-test integration cics_cmci_missing_xmltodict_library --python "$TRAVIS_PYTHON_VERSION"
47+
48+
pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
49+
pip uninstall requests -y
50+
ansible-test integration cics_cmci_missing_requests_library --python "$TRAVIS_PYTHON_VERSION"
51+
52+
echo ""
53+
echo "###########################################################"
54+
echo "#################### Build Collection #####################"
55+
echo "###########################################################"
56+
echo ""
57+
pip install -r /root/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
58+
ansible-galaxy collection build /root/ansible_collections/ibm/ibm_zos_cics --output-path /root/ansible_collections/ibm/ibm_zos_cics --force
59+
ansible-galaxy collection install /root/ansible_collections/ibm/ibm_zos_cics/ibm-ibm_zos_cics-* --force

.travis/build_env.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
A="A"
4+
B="B"
5+
star="*"
6+
7+
TRAVIS_NO_DOT="${TRAVIS_JOB_NUMBER//./D}"
8+
9+
program_name_1="A$TRAVIS_NO_DOT$A"
10+
program_name_2="A$TRAVIS_NO_DOT$B"
11+
program_filter="A$TRAVIS_NO_DOT$star"
12+
13+
echo ""
14+
echo "################ Job-Specific Variables ################"
15+
echo "## Program 1 Name: $program_name_1"
16+
echo "## Program 2 Name: $program_name_2"
17+
echo "## Program Filter: $program_filter"
18+
echo ""
19+
20+
echo "############# Creating cmci-variables.yml #############"
21+
touch "$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml
22+
{
23+
echo cmci_host: "$CMCI_HOST"
24+
echo cmci_port: "$CMCI_PORT"
25+
echo cmci_secure_port: "$CMCI_SECURE_PORT"
26+
echo cmci_user: "$CMCI_USER"
27+
echo cmci_password: "$CMCI_PASS"
28+
echo cmci_context: "$CMCI_CONTEXT"
29+
echo cmci_scope: "$CMCI_SCOPE"
30+
echo cmci_scope_region_1: "$CMCI_REGION_1"
31+
echo cmci_scope_region_2: "$CMCI_REGION_2"
32+
echo cmci_program_name_1: "$program_name_1"
33+
echo cmci_program_name_2: "$program_name_2"
34+
echo cmci_program_filter: "$program_filter"
35+
} >>"$TRAVIS_BUILD_DIR"/tests/integration/targets/cics_cmci/cmci-variables.yml

.travis/get_vault_data.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# Wiki page on Vault Integration:
4+
# https://cicswiki.hursley.ibm.com:9443/wiki/CICS_Explorer/artifactory_vault
5+
6+
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")
7+
ARTI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/"artifactory" | jq -r ".data.data")
8+
export "ARTIFACTORY_USER"="$(jq -r ".user" <<<"$ARTI")"
9+
export "ARTIFACTORY_TOKEN"="$(jq -r ".token" <<<"$ARTI")"
10+
11+
PLEX=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/plex2 | jq -r ".data.data")
12+
export "CMCI_USER"="$(jq -r ".username" <<<"$PLEX")"
13+
export "CMCI_PASS"="$(jq -r ".password" <<<"$PLEX")"
14+
15+
CMCI=$(curl -k -s --header "X-Vault-Token: $VAULT_ONETIME_TOKEN" "$VAULT_URL"/"$VAULT_PATH"/cmci | jq -r ".data.data")
16+
export "CMCI_HOST"="$(jq -r ".url" <<<"$CMCI")"
17+
export "CMCI_PORT"="$(jq -r ".port" <<<"$CMCI")"
18+
export "CMCI_SECURE_PORT"="$(jq -r ".secure_port" <<<"$CMCI")"
19+
export "CMCI_SCOPE"="$(jq -r ".scope" <<<"$CMCI")"
20+
export "CMCI_REGION_1"="$(jq -r ".region_1" <<<"$CMCI")"
21+
export "CMCI_REGION_2"="$(jq -r ".region_2" <<<"$CMCI")"
22+
export "CMCI_CONTEXT"="$(jq -r ".context" <<<"$CMCI")"

.travis/push_artifactory.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
pip install https://github.com/ansible/ansible/archive/stable-2.14.tar.gz
6+
7+
ansible-galaxy collection build "$TRAVIS_BUILD_DIR" --force
8+
9+
file_with_prefix="$(find . -type f -iname "ibm-ibm_zos_cics-*")"
10+
file="${file_with_prefix//.\//}"
11+
no_extension="${file//.tar.gz/}"
12+
no_starting="${no_extension//.\//}"
13+
version_number="${no_starting//ibm-ibm_zos_cics-/}"
14+
TRAVIS_NO_DOT="${TRAVIS_JOB_NUMBER//./D}"
15+
16+
echo ""
17+
echo "##########################################################"
18+
echo "############# Uploading build to Artifactory #############"
19+
echo "##########################################################"
20+
echo "#"
21+
echo "# File: $file"
22+
echo "# Version: $version_number"
23+
echo "#"
24+
echo "##########################################################"
25+
26+
curl -ksSf \
27+
-H "Authorization: Bearer $ARTIFACTORY_TOKEN" -X PUT \
28+
-T "$TRAVIS_BUILD_DIR"/"$file" \
29+
"$ARTIFACTORY_URL"/"$version_number"/"$TRAVIS_NO_DOT"/"$file"

.whitesource

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"settingsInheritedFrom": "whitesource-config/whitesource-config@master",
3+
"remediateSettings": {
4+
"enableRenovate": true,
5+
"extends": [
6+
"config:base"
7+
]
8+
},
9+
"issueSettings": {
10+
"issueRepoName": "cics-ts-tracking"
11+
}
12+
}

dev-requirements.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# (c) Copyright IBM Corp. 2020,2021
1+
# (c) Copyright IBM Corp. 2020,2023
22
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
33
-r requirements.txt
4-
ansible-core==2.13.7; python_version >= '3'
5-
ansible-core==2.11.12; python_version < '3'
4+
# ansible-core==2.13.7; python_version >= '3'
5+
# ansible-core==2.11.12; python_version < '3'
66
junit-xml==1.9 # To get JUnit xml report from ansible-test
77
pytest_mock==1.12.1
88
mock==3.0.5
@@ -16,8 +16,7 @@ shellcheck-py==0.9.0.2; python_version >= '3'
1616
rstcheck==3.3.1; python_version >= '3'
1717
yamllint==1.29.0; python_version >= '3'
1818
voluptuous==0.13.1; python_version >= '3'
19-
ansible-doc-extractor==0.1.6; python_version >= '3'
20-
ansible-lint==6.10.2; python_version >= '3'
21-
pycodestyle==2.6.0; python_version >= '3'
22-
Sphinx==3.4.3; python_version >= '3'
23-
sphinx-rtd-theme==0.5.1; python_version >= '3'
19+
# needed to lint devel ansible version
20+
ansible-lint==6.12.2; python_version >= '3' and python_version < '3.9'
21+
ansible-lint==6.13.1; python_version >= '3.9'
22+
pycodestyle==2.10.0; python_version >= '3'

0 commit comments

Comments
 (0)