forked from redhat-openshift-ecosystem/operator-pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISV-3498][ISV-4140] E2E tests for community operator pipeline && Aut…
…henticated interceptor correctly triggers community hosted pipeline && Requests to github API from certified op hosted pipeline are authenticated (redhat-openshift-ecosystem#516)
- Loading branch information
Showing
12 changed files
with
296 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 126 additions & 0 deletions
126
ansible/playbooks/community-operators-integration-tests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
- name: Execute integration tests | ||
hosts: all | ||
vars_files: | ||
- ../vaults/{{ env }}/secret-vars.yml | ||
- ../vaults/{{ env }}/ocp-token.yml | ||
vars: | ||
# Customized defaults for the test-e2e-community-operator package | ||
git_upstream_repo: redhat-openshift-ecosystem/operator-pipelines-test | ||
git_repo_url: "[email protected]:{{ git_upstream_repo }}.git" | ||
git_upstream_branch: "{{ branch }}" | ||
git_bundle_branch: "{{ branch }}-{{ operator_package_name }}-{{ operator_bundle_version }}" | ||
src_operator_git_branch: e2e-community-test-operator | ||
src_operator_bundle_version: 0.0.8 | ||
operator_package_name: test-e2e-community-operator | ||
operator_pipeline_url: "https://community-operator-pipeline-{{ oc_namespace }}.apps.pipelines-stage.0ce8.p1.openshiftapps.com" | ||
git_base_branch: community # contains config.yaml containing pointer to community-operators index | ||
environment: | ||
K8S_AUTH_API_KEY: '{{ ocp_token }}' | ||
K8S_AUTH_HOST: '{{ ocp_host }}' | ||
|
||
tasks: | ||
- block: | ||
- name: Install CLI tools | ||
tags: | ||
- prepare-tools | ||
- test-community-hosted-pipeline | ||
- test-community-release-pipeline | ||
include_role: | ||
name: integration-tests | ||
tasks_from: tools | ||
apply: | ||
tags: | ||
- prepare-tools | ||
- test-community-hosted-pipeline | ||
- test-community-release-pipeline | ||
|
||
- name: Deploy operator pipelines | ||
tags: | ||
- deploy-operator-pipelines | ||
include_role: | ||
name: operator-pipeline | ||
apply: | ||
tags: | ||
- deploy-operator-pipelines | ||
|
||
- name: Prepare integration test data | ||
tags: | ||
- prepare-test-data | ||
include_role: | ||
name: integration-tests | ||
tasks_from: test_data | ||
apply: | ||
tags: | ||
- prepare-test-data | ||
|
||
- name: Prepare ci.yaml in target branch | ||
tags: | ||
- prepare-test-data | ||
include_role: | ||
name: integration-tests | ||
tasks_from: prepare_ci_file | ||
apply: | ||
tags: | ||
- prepare-test-data | ||
|
||
- name: Open pull request to trigger hosted pipeline | ||
tags: | ||
- open-pull-request | ||
include_role: | ||
name: integration-tests | ||
tasks_from: open_pull_request | ||
apply: | ||
tags: | ||
- open-pull-request | ||
|
||
- name: Verify the Community hosted pipeline run succeeds | ||
tags: | ||
- test-community-hosted-pipeline | ||
vars: | ||
pipeline_name: community-hosted-pipeline | ||
include_role: | ||
name: integration-tests | ||
tasks_from: check_pipeline_run | ||
apply: | ||
tags: | ||
- test-community-hosted-pipeline | ||
|
||
- name: Verify the Community release pipeline run succeeds | ||
tags: | ||
- test-community-release-pipeline | ||
vars: | ||
pipeline_name: community-release-pipeline | ||
include_role: | ||
name: integration-tests | ||
tasks_from: check_pipeline_run | ||
apply: | ||
tags: | ||
- test-community-release-pipeline | ||
ignore_errors: yes # Enabling integration tests errors in ISV-4242 | ||
always: | ||
- name: Cleanup test data | ||
tags: | ||
- clean | ||
- clean-test-data | ||
include_role: | ||
name: integration-tests | ||
tasks_from: clean | ||
apply: | ||
tags: | ||
- clean | ||
- clean-test-data | ||
|
||
- name: Cleanup operator pipeline | ||
tags: | ||
- clean | ||
- clean-deployment | ||
include_role: | ||
name: operator-pipeline | ||
apply: | ||
tags: | ||
- clean | ||
- clean-deployment | ||
vars: | ||
namespace_state: absent | ||
github_webhook_state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
ansible/roles/integration-tests/tasks/open_pull_request.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Create a pull request | ||
uri: | ||
url: "https://api.github.com/repos/{{ git_upstream_repo }}/pulls" | ||
method: POST | ||
status_code: 201 | ||
headers: | ||
Authorization: "token {{ ci_pipeline_github_personal_access_token }}" | ||
Accept: application/vnd.github.v3+json | ||
body_format: json | ||
body: | ||
title: "operator {{ operator_package_name }} ({{ operator_bundle_version }})" | ||
body: E2e test for community operators | ||
head: "{{ git_bundle_branch }}" | ||
base: "{{ git_upstream_branch }}" | ||
register: pr_response | ||
no_log: true | ||
|
||
- name: Display PR response | ||
debug: | ||
var: pr_response |
25 changes: 25 additions & 0 deletions
25
ansible/roles/integration-tests/tasks/prepare_ci_file.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- include_tasks: tasks/clone.yml | ||
|
||
- name: Prepare ci.yaml in target branch | ||
tags: | ||
- prepare-bundle | ||
shell: | | ||
UPSTREAM_BRANCH="{{ git_upstream_branch }}" | ||
OPERATOR_PACKAGE_NAME="{{ operator_package_name }}" | ||
SRC_BRANCH="{{ src_operator_git_branch }}" | ||
git config user.name 'rh-operator-bundle-test-e2e' | ||
git config user.email '[email protected]' | ||
git checkout "$UPSTREAM_BRANCH" | ||
# Fetch the ci.yaml from SRC_BRANCH and place it in the working directory | ||
git checkout "origin/$SRC_BRANCH" -- "operators/$OPERATOR_PACKAGE_NAME/ci.yaml" | ||
git add "operators/$OPERATOR_PACKAGE_NAME/ci.yaml" | ||
git commit -m "Copied ci.yaml from $SRC_BRANCH" | ||
git push origin "$UPSTREAM_BRANCH" | ||
args: | ||
executable: /bin/bash | ||
chdir: "{{ git_temp_dir.path }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.