Skip to content

Commit

Permalink
Merge pull request #3557 from uselagoon/testing/ansible-core
Browse files Browse the repository at this point in the history
Update ansible used in tests
  • Loading branch information
tobybellwood authored Oct 31, 2023
2 parents ca861d9 + dfe28d4 commit 5e01c62
Show file tree
Hide file tree
Showing 119 changed files with 820 additions and 823 deletions.
4 changes: 2 additions & 2 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG UPSTREAM_REPO
ARG UPSTREAM_TAG
FROM ${UPSTREAM_REPO:-uselagoon}/python-3.10:${UPSTREAM_TAG:-latest}
FROM ${UPSTREAM_REPO:-uselagoon}/python-3.11:${UPSTREAM_TAG:-latest}

RUN apk add --no-cache \
bash \
Expand All @@ -24,7 +24,7 @@ RUN apk add --no-cache --virtual .build-deps \
&& pip3 install -r requirements.txt \
&& apk del .build-deps

RUN ansible-galaxy collection install ansible.posix community.general kubernetes.core
RUN ansible-galaxy collection install -vvv ansible.posix community.general kubernetes.core

# download, extract and install kubectl binary
ENV KUBECTL_VER=v1.25.5
Expand Down
5 changes: 1 addition & 4 deletions tests/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ host_key_checking = False
deprecation_warnings = False
interpreter_python = auto_silent
callback_whitelist = profile_tasks

[galaxy]
server = https://old-galaxy.ansible.com/
;server = https://galaxy.ansible.com/
callbacks_enabled=ansible.posix.profile_tasks
8 changes: 4 additions & 4 deletions tests/checks/check-branch-sha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_SHA={{ expected_head }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the branch name"
hosts: localhost
Expand All @@ -14,7 +14,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_BRANCH={{ expected_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml
when: expected_branch != ""

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash inside an environment variable set during buildtime"
Expand All @@ -24,7 +24,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_SHA_BUILDTIME={{ expected_head }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the branch name inside an environment variable set during buildtime"
hosts: localhost
Expand All @@ -33,4 +33,4 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_BRANCH_BUILDTIME={{ expected_branch_buildtime | default(expected_branch) }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml
12 changes: 6 additions & 6 deletions tests/checks/check-deployed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_SHA={{ expected_head }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the branch name"
hosts: localhost
Expand All @@ -14,7 +14,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_BRANCH={{ expected_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the hash inside an environment variable set during buildtime"
hosts: localhost
Expand All @@ -23,7 +23,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_SHA_BUILDTIME={{ expected_head }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the branch name inside an environment variable set during buildtime"
hosts: localhost
Expand All @@ -32,7 +32,7 @@
url: "{{ url }}"
expected_content: "LAGOON_GIT_BRANCH_BUILDTIME={{ expected_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the env variable set by .env file"
hosts: localhost
Expand All @@ -41,7 +41,7 @@
url: "{{ url }}"
expected_content: "VARIABLE_SET_BY_DOTENV=true"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for the env variable set by .env.defaults file"
hosts: localhost
Expand All @@ -50,4 +50,4 @@
url: "{{ url }}"
expected_content: "VARIABLE_SET_BY_DOTENV_DEFAULTS=true"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml
18 changes: 9 additions & 9 deletions tests/checks/check-pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
url: "{{ url }}"
expected_content: "LAGOON_BUILD_TYPE_BUILDTIME={{ expected_build_type }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_HEAD_BRANCH_BUILDTIME={{ expected_pr_head_branch }}"
hosts: localhost
Expand All @@ -14,7 +14,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_HEAD_BRANCH_BUILDTIME={{ expected_pr_head_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_HEAD_BRANCH={{ expected_pr_head_branch }}"
hosts: localhost
Expand All @@ -23,7 +23,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_HEAD_BRANCH={{ expected_pr_head_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_HEAD_SHA_BUILDTIME={{ expected_pr_head_sha }}"
hosts: localhost
Expand All @@ -32,7 +32,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_HEAD_SHA_BUILDTIME={{ expected_pr_head_sha }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_BASE_BRANCH_BUILDTIME={{ expected_pr_base_branch }}"
hosts: localhost
Expand All @@ -41,7 +41,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_BASE_BRANCH_BUILDTIME={{ expected_pr_base_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_BASE_BRANCH={{ expected_pr_base_branch }}"
hosts: localhost
Expand All @@ -50,7 +50,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_BASE_BRANCH={{ expected_pr_base_branch }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_BASE_SHA_BUILDTIME={{ expected_pr_base_sha }}"
hosts: localhost
Expand All @@ -59,7 +59,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_BASE_SHA_BUILDTIME={{ expected_pr_base_sha }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_TITLE_BUILDTIME={{ expected_pr_title }}"
hosts: localhost
Expand All @@ -68,7 +68,7 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_TITLE_BUILDTIME={{ expected_pr_title }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml

- name: "{{ testname }} - check if {{ project }} is deployed with searching for LAGOON_PR_TITLE={{ expected_pr_title }}"
hosts: localhost
Expand All @@ -77,4 +77,4 @@
url: "{{ url }}"
expected_content: "LAGOON_PR_TITLE={{ expected_pr_title }}"
tasks:
- include: check-url-content.yaml
- ansible.builtin.include_tasks: check-url-content.yaml
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-core==2.11.12
ansible-core==2.15.4
jmespath==1.0.1
kubernetes==25.3.0
PyJWT==2.6.0
2 changes: 1 addition & 1 deletion tests/tasks/api/add-deploytarget.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Add deploy target to project {{ project }}"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "{{ testname }} - POST api get project by name with target project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/api/add-environment-variable.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - POST api add envVariable with target environment {{ branch }} on project {{ project }} to {{ graphql_url }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - POST api add envVariable with target environment {{ branch }} on project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand All @@ -17,4 +17,4 @@
msg: "api response: {{ apiresponse.json }}"
- fail:
msg: "error adding environment variable"
when: apiresponse.json.data.addOrUpdateEnvVariableByName.name is not defined
when: apiresponse.json.data.addOrUpdateEnvVariableByName.name is not defined
2 changes: 1 addition & 1 deletion tests/tasks/api/add-environment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Add environment {{ name }} to project {{ project }}"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "{{ testname }} - POST api get project by name with target project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/api/add-project-variable.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - POST api add envVariable with target project {{ project }} to {{ graphql_url }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - POST api add envVariable with target project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand All @@ -16,4 +16,4 @@
msg: "api response: {{ apiresponse.json }}"
- fail:
msg: "error adding environment variable"
when: apiresponse.json.data.addOrUpdateEnvVariableByName.name is not defined
when: apiresponse.json.data.addOrUpdateEnvVariableByName.name is not defined
2 changes: 1 addition & 1 deletion tests/tasks/api/add-project.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Add project {{ project }} to openshift {{ openshift }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "Add project {{ project }} to openshift {{ openshift }}"
uri:
url: "{{ graphql_url }}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/api/delete-environment-variable.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - POST api delete envVariable with target environment {{ branch }} on project {{ project }} to {{ graphql_url }}"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "{{ testname }} - POST api delete envVariable with target environment {{ branch }} on project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand All @@ -17,4 +17,4 @@
msg: "api response: {{ apiresponse.json }}"
- fail:
msg: "error deleting environment variable"
when: apiresponse.json.errors[0].message is defined and apiresponse.json.errors[0].message is not search("doesn't exist")
when: apiresponse.json.errors[0].message is defined and apiresponse.json.errors[0].message is not search("doesn't exist")
2 changes: 1 addition & 1 deletion tests/tasks/api/delete-environment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - POST api deleteEnvironment with project {{ project }} and branch {{ branch }} to {{ graphql_url }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - POST api deleteEnvironment with project {{ project }} and branch {{ branch }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/api/delete-project-variable.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - POST api delete envVariable with target project {{ project }} to {{ graphql_url }}"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "{{ testname }} - POST api delete envVariable with target project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand All @@ -16,4 +16,4 @@
msg: "api response: {{ apiresponse.json }}"
- fail:
msg: "error deleting environment variable"
when: apiresponse.json.data.deleteEnvVariableByName != "success"
when: apiresponse.json.data.deleteEnvVariableByName != "success"
2 changes: 1 addition & 1 deletion tests/tasks/api/delete-project.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Delete project {{ project }} from openshift {{ openshift }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "Delete project {{ project }} from openshift {{ openshift }}"
uri:
url: "{{ graphql_url }}"
Expand Down
4 changes: 2 additions & 2 deletions tests/tasks/api/deploy-bulk-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - Trigger a bulk deployment for environments to {{ graphql_url }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - create the bulk deployment environments input"
set_fact:
environments: >
Expand All @@ -21,4 +21,4 @@
debug:
msg: "api response: {{ apiresponse.json }}"
- set_fact:
bulk_deploy_id: "{{ apiresponse.json.data.bulkDeployEnvironmentLatest }}"
bulk_deploy_id: "{{ apiresponse.json.data.bulkDeployEnvironmentLatest }}"
2 changes: 1 addition & 1 deletion tests/tasks/api/deploy-no-sha.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Start deployEnvironmentBranch (no SHA) loop with 3 retries"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "Set the retry count to {{ retry_count }}"
set_fact:
retry_count: "{{ 0 if retry_count is undefined else retry_count|int + 1 }}"
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/api/deploy-pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Start deployEnvironmentPullrequest loop with 3 retries"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "Set the retry count to {{ retry_count }}"
set_fact:
retry_count: "{{ 0 if retry_count is undefined else retry_count|int + 1 }}"
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/api/deploy-sha.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Start deployEnvironmentBranch (SHA) loop with 3 retries"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "Set the retry count to {{ retry_count }}"
set_fact:
retry_count: "{{ 0 if retry_count is undefined else retry_count|int + 1 }}"
Expand Down
6 changes: 3 additions & 3 deletions tests/tasks/api/get-bulk-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - Trigger a bulk deployment for environments to {{ graphql_url }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- debug:
msg: "{{ bulk_deploy_id }}"
- name: "{{ testname }} - POST api check new bulk deployments for environments to {{ graphql_url }}"
Expand All @@ -23,7 +23,7 @@
retries: 30
delay: 10

- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - POST api check running bulk deployments for environments to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand All @@ -44,7 +44,7 @@
retries: 60
delay: 10

- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - POST api check completed bulk deployments for environments to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/api/promote.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "{{ testname }} - POST api deployEnvironmentPromote with source environment {{ source_environment }}, target environment {{ promote_environment }} and project {{ project }} to {{ graphql_url }}"
block:
- include: refresh-token.yaml
- ansible.builtin.include_tasks: refresh-token.yaml
- name: "{{ testname }} - POST api deployEnvironmentPromote with source environment {{ source_environment }}, target environment {{ promote_environment }} and project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand Down
2 changes: 1 addition & 1 deletion tests/tasks/api/update-project-routerpattern.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: "Update project routerpattern for {{ project }} to openshift {{ openshift }}"
block:
- include: admin-token.yaml
- ansible.builtin.include_tasks: admin-token.yaml
- name: "{{ testname }} - POST api get project by name with target project {{ project }} to {{ graphql_url }}"
uri:
url: "{{ graphql_url }}"
Expand Down
Loading

0 comments on commit 5e01c62

Please sign in to comment.