Skip to content

Commit 21faf87

Browse files
Container Images, Jenkins, Linting (#3)
Using docker image as base to run tests and linting for consistency. Common Dockerfile used with python version argument Signed-off-by: Andrew Twydell <[email protected]>
1 parent 568ba54 commit 21faf87

37 files changed

+1400
-1451
lines changed

common.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ ARG PYTHON_VERSION
22

33
FROM python:${PYTHON_VERSION}
44

5+
USER root
6+
57
SHELL [ "/bin/bash", "-c" ]
68

7-
ENV PYTHON_VERSION_SET=${PYTHON_VERSION}
8-
RUN echo $PYTHON_VERSION_SET
99
RUN apt-get update && apt upgrade -y
1010

1111
COPY ./requirements.txt /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rstcheck==3.3.1; python_version >= '3'
1717
yamllint==1.28.0; python_version >= '3'
1818
voluptuous==0.12.1; python_version >= '3'
1919
ansible-doc-extractor==0.1.6; python_version >= '3'
20-
ansible-lint==6.9.1; python_version >= '3'
20+
ansible-lint==6.10.2; python_version >= '3'
2121
pycodestyle==2.6.0; python_version >= '3'
2222
Sphinx==3.4.3; python_version >= '3'
2323
sphinx-rtd-theme==0.5.1; python_version >= '3'

docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
version: '3.9'
1+
---
2+
version: "3.9"
23

34
services:
45
python27:

galaxy.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# (c) Copyright IBM Corp. 2020,2021
23

34
# IBM collection namespace
@@ -19,14 +20,14 @@ authors:
1920
- Sophie Green
2021
- Ya Qing Chen
2122
# Description
22-
description: The Red Hat Ansible Certified Content for IBM Z CICS collection includes connection plugins, action plugins, modules and sample playbooks to automate tasks for CICS
23+
description:
24+
The Red Hat Ansible Certified Content for IBM Z CICS collection includes connection plugins, action plugins,
25+
modules and sample playbooks to automate tasks for CICS
2326

2427
# License
25-
license: "Apache-2.0"
26-
28+
license: [Apache-2.0]
2729
# Tags
2830
tags: [ibm, z, zos, z_os, cics, cmci]
29-
3031
# Collections that this collection requires to be installed for it to be usable.
3132
# dependencies: {} # This collection depends on no other collections
3233

jenkinsfile

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
node {
2-
stage("Main") {
3-
docker.image('python:3.8').inside("-e PYTHON_VERSION=3.8") {
4-
stage("Run tests") {
5-
sh "ansible-test units --python 3.8"
6-
}
7-
}
1+
pipeline {
2+
3+
agent {
4+
dockerfile {
5+
filename 'common.Dockerfile'
6+
additionalBuildArgs '--build-arg PYTHON_VERSION=3.8'
7+
}
88
}
9-
}
109

11-
// agent {
12-
// dockerfile {
13-
// filename 'common.Dockerfile'
14-
// additionalBuildArgs '--build-arg PYTHON_VERSION=3.8'
15-
// }
16-
// }
10+
stages {
11+
stage('Unit Tests'){
12+
steps {
13+
sh 'cd ${WORKSPACE}/ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics && ansible-test units --python 3.8'
14+
}
15+
}
16+
17+
stage('disc') {
18+
steps {
19+
sh 'ls -al && ls -al ${WORKSPACE}/ibm_zos_cics/ansible_collections/ibm'
20+
}
21+
}
22+
23+
stage('Integration Tests'){
24+
steps {
25+
sh 'cd ${WORKSPACE}/ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics && ansible-test integration cics_cmci --python 3.8'
26+
}
27+
}
28+
29+
}
30+
}

meta/execution-environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
dependencies:
23
python: requirements.txt
3-
version: 1
4+
version: 1

meta/ibm_zos_cics_meta.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
---
12
name: ibm_zos_cics
2-
version: "1.0.3"
3+
version: 1.0.3
34
managed_requirements:
4-
- name: "Python"
5+
- name: Python
56
version: ">=2.7"
6-
- name: "CICS TS with CICSplex System Manager"
7-
version: ">=4.1"
7+
- name: CICS TS with CICSplex System Manager
8+
version: ">=4.1"

meta/runtime.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
requires_ansible: ">=2.10.7"
23
action_groups:
34
cmci:

plugins/module_utils/cmci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def handle_response(self, response_dict): # type: (Dict) -> None
436436
'Could not parse CMCI response: missing node "{0}"'
437437
.format(e.args[0])
438438
)
439-
439+
440440
def get_ok_cpsm_response_codes(self):
441441
return [1024]
442442

plugins/modules/cmci_get.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
description:
4545
- Specifies whether the module should fail if no data is returned by the
4646
query. If set to true, the module will fail if no data is returned.
47-
- Default behaviour is for the module to fail if no data is returned. When
47+
- Default behaviour is for the module to fail if no data is returned. When
4848
set to false, the module will return OK, just with no records.
4949
type: bool
5050
required: false
@@ -534,7 +534,7 @@ def init_argument_spec(self): # type: () -> Dict
534534
argument_spec.update({
535535
_RECORD_COUNT: {
536536
'type': 'int'
537-
},
537+
},
538538
_FAIL_ON_NODATA: {
539539
'type': 'bool',
540540
'default': True
@@ -553,7 +553,7 @@ def init_url(self): # type: () -> str
553553
url = url + '//' + str(self._p.get(_RECORD_COUNT))
554554

555555
return url
556-
556+
557557
def get_ok_cpsm_response_codes(self):
558558
ok_codes = super(AnsibleCMCIGetModule, self).get_ok_cpsm_response_codes()
559559

0 commit comments

Comments
 (0)