Skip to content

Commit 568ba54

Browse files
Module defaults (#2)
* added group module_defaults support Signed-off-by: Andrew Twydell <[email protected]> * run build and tests in docker container Signed-off-by: Andrew Twydell <[email protected]> * created common dockerfile for testing Signed-off-by: Andrew Twydell <[email protected]> * testing with Jenkinsfile Signed-off-by: Andrew Twydell <[email protected]> * specify git branch Signed-off-by: Andrew Twydell <[email protected]> * alternate git syntax Signed-off-by: Andrew Twydell <[email protected]> * removed git line Signed-off-by: Andrew Twydell <[email protected]> * added integration tests for python 27 Signed-off-by: Andrew Twydell <[email protected]> Signed-off-by: Andrew Twydell <[email protected]>
1 parent f0c849a commit 568ba54

File tree

10 files changed

+547
-16
lines changed

10 files changed

+547
-16
lines changed

Dockerfile

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,28 @@
33
# Docker Image for Testing Environment #
44
# ---------------------------------------------------------------------------- #
55
FROM python:3.8-buster
6+
7+
SHELL [ "/bin/bash", "-c" ]
8+
69
RUN apt-get update && apt-get install -y gnupg2 git python-pip python3-pip openssh-client && python2.7 -m pip install virtualenv==20.4.7
10+
11+
RUN python3 -m venv /venv3
12+
RUN python2.7 -m virtualenv /venv2
13+
RUN source /venv3/bin/activate
14+
15+
COPY ./requirements.txt /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/
16+
COPY ./dev-requirements.txt /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/
17+
18+
RUN pip install -r /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
19+
20+
COPY ./ /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics
21+
WORKDIR /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics
22+
723
# -------------------- Map UID and GID to Jenkins host IDs ------------------- #
8-
ARG UNAME=jenkins
9-
ARG UID=114
10-
ARG GID=121
11-
RUN groupadd -g $GID -o $UNAME
12-
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
13-
USER ${UNAME}
14-
ENV PATH="/home/jenkins/.local/bin:${PATH}"
24+
# ARG UNAME=jenkins
25+
# ARG UID=114
26+
# ARG GID=121
27+
# RUN groupadd -g $GID -o $UNAME
28+
# RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
29+
# USER ${UNAME}
30+
# ENV PATH="/home/jenkins/.local/bin:${PATH}"

common.Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG PYTHON_VERSION
2+
3+
FROM python:${PYTHON_VERSION}
4+
5+
SHELL [ "/bin/bash", "-c" ]
6+
7+
ENV PYTHON_VERSION_SET=${PYTHON_VERSION}
8+
RUN echo $PYTHON_VERSION_SET
9+
RUN apt-get update && apt upgrade -y
10+
11+
COPY ./requirements.txt /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/
12+
COPY ./dev-requirements.txt /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/
13+
14+
RUN pip install -r /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics/dev-requirements.txt
15+
16+
COPY ./ /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics
17+
WORKDIR /ibm_zos_cics/ansible_collections/ibm/ibm_zos_cics

dev-requirements.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# (c) Copyright IBM Corp. 2020,2021
22
# Apache License, Version 2.0 (see https://opensource.org/licenses/Apache-2.0)
33
-r requirements.txt
4-
ansible==2.10.7
4+
ansible-core==2.13.7; python_version >= '3'
5+
ansible-core==2.11.12; python_version < '3'
56
junit-xml==1.9 # To get JUnit xml report from ansible-test
67
pytest_mock==1.12.1
78
mock==3.0.5
@@ -13,10 +14,10 @@ pytest==6.2.1; python_version >= '3'
1314
pylint==2.5.3; python_version >= '3'
1415
shellcheck-py==0.7.1.1; python_version >= '3'
1516
rstcheck==3.3.1; python_version >= '3'
16-
yamllint==1.25.0; python_version >= '3'
17+
yamllint==1.28.0; python_version >= '3'
1718
voluptuous==0.12.1; python_version >= '3'
1819
ansible-doc-extractor==0.1.6; python_version >= '3'
19-
ansible-lint==4.3.7; python_version >= '3'
20+
ansible-lint==6.9.1; python_version >= '3'
2021
pycodestyle==2.6.0; python_version >= '3'
2122
Sphinx==3.4.3; python_version >= '3'
2223
sphinx-rtd-theme==0.5.1; python_version >= '3'

docker-compose.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3.9'
2+
3+
services:
4+
python27:
5+
build:
6+
context: .
7+
dockerfile: common.Dockerfile
8+
args:
9+
PYTHON_VERSION: 2.7.18
10+
11+
python38:
12+
build:
13+
context: .
14+
dockerfile: common.Dockerfile
15+
args:
16+
PYTHON_VERSION: 3.8

jenkinsfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
}
8+
}
9+
}
10+
11+
// agent {
12+
// dockerfile {
13+
// filename 'common.Dockerfile'
14+
// additionalBuildArgs '--build-arg PYTHON_VERSION=3.8'
15+
// }
16+
// }

meta/runtime.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
requires_ansible: '>=2.10.7'
1+
requires_ansible: ">=2.10.7"
2+
action_groups:
3+
cmci:
4+
- cmci_action
5+
- cmci_create
6+
- cmci_delete
7+
- cmci_get
8+
- cmci_update

0 commit comments

Comments
 (0)