From 5ac7cc650bd049bc4724bc5befcb0c72d3df97a2 Mon Sep 17 00:00:00 2001 From: Nil Gallego Date: Thu, 12 Sep 2024 09:46:17 +0200 Subject: [PATCH 1/4] enable AAP plugin --- .ibm/pipelines/value_files/values_showcase.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ibm/pipelines/value_files/values_showcase.yaml b/.ibm/pipelines/value_files/values_showcase.yaml index 6e21d9cece..1c9c5535c9 100644 --- a/.ibm/pipelines/value_files/values_showcase.yaml +++ b/.ibm/pipelines/value_files/values_showcase.yaml @@ -111,6 +111,8 @@ global: disabled: false - package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-topology disabled: false + - package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-aap-backend-dynamic + disabled: false # this value will be overriden by 'helm install .... --set global.clusterRouterBase=value' # -- Shorthand for users who do not want to specify a custom HOSTNAME. Used ONLY with the DEFAULT upstream.backstage.appConfig value and with OCP Route enabled. From 973d0735caf3233d18e010cd8ceca8028a66e604 Mon Sep 17 00:00:00 2001 From: Nil Gallego Date: Mon, 9 Dec 2024 11:43:36 +0100 Subject: [PATCH 2/4] + download aap --- .ibm/pipelines/env_variables.sh | 2 ++ .ibm/pipelines/get_aap_files.yaml | 38 ++++++++++++++++++++++++++++ .ibm/pipelines/openshift-ci-tests.sh | 2 ++ e2e-tests/playwright.config.ts | 2 +- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .ibm/pipelines/get_aap_files.yaml diff --git a/.ibm/pipelines/env_variables.sh b/.ibm/pipelines/env_variables.sh index 924321e036..cccd85f0dc 100755 --- a/.ibm/pipelines/env_variables.sh +++ b/.ibm/pipelines/env_variables.sh @@ -136,4 +136,6 @@ AUTH_PROVIDERS_NAMESPACE="showcase-auth-providers" STATIC_API_TOKEN="somecicdtoken" AUTH_PROVIDERS_CHART="rhdh-chart/backstage" +RH_OFFLINE_TOKEN=$(cat /tmp/secrets/RH_OFFLINE_TOKEN) + set +a # Stop automatically exporting variables diff --git a/.ibm/pipelines/get_aap_files.yaml b/.ibm/pipelines/get_aap_files.yaml new file mode 100644 index 0000000000..3729b3b722 --- /dev/null +++ b/.ibm/pipelines/get_aap_files.yaml @@ -0,0 +1,38 @@ +# https://docs.redhat.com/en/documentation/red_hat_ansible_automation_platform/2.4/html-single/installing_ansible_plug-ins_for_red_hat_developer_hub/index#rhdh-download-plugins_rhdh-install-ocp +--- +- name: Headlessly Download AAP from Red Hat Customer Portal + hosts: localhost + vars: + offline_token: "{{ lookup('file', '/tmp/secrets/RH_OFFLINE_TOKEN') }}" + file_url: "https://access.cdn.redhat.com/content/origin/files/sha256/cf/cf2a2d4e6b6819676a563daae36eff34195af67caf111f1fc89b487daf165520/ansible-automation-platform-setup-bundle-2.4-8-x86_64.tar.gz" + download_path: "/tmp/ansible-automation-platform-setup-bundle.tar.gz" + + tasks: + - name: Generate Access Token from Offline Token + no_log: true + uri: + url: "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" + method: POST + headers: + Content-Type: "application/x-www-form-urlencoded" + body: + grant_type: "refresh_token" + client_id: "rhsm-api" + refresh_token: "{{ offline_token }}" + body_format: form-urlencoded + return_content: yes + register: access_token_response + + - name: Extract Access Token + no_log: true + set_fact: + access_token: "{{ access_token_response.json.access_token }}" + + - name: Download File + no_log: true + uri: + url: "{{ file_url }}" + method: GET + headers: + Authorization: "Bearer {{ access_token }}" + dest: "{{ download_path }}" diff --git a/.ibm/pipelines/openshift-ci-tests.sh b/.ibm/pipelines/openshift-ci-tests.sh index ca3dfcd8e3..d5ab9c4471 100755 --- a/.ibm/pipelines/openshift-ci-tests.sh +++ b/.ibm/pipelines/openshift-ci-tests.sh @@ -46,6 +46,8 @@ source "${DIR}/jobs/periodic.sh" echo "Loaded periodic.sh" main() { + ansible-playbook get_aap_files.yaml + echo "Log file: ${LOGFILE}" echo "JOB_NAME : $JOB_NAME" diff --git a/e2e-tests/playwright.config.ts b/e2e-tests/playwright.config.ts index d60763886f..6c8cf31009 100644 --- a/e2e-tests/playwright.config.ts +++ b/e2e-tests/playwright.config.ts @@ -11,7 +11,7 @@ export default defineConfig({ timeout: 90 * 1000, testDir: "./playwright", /* Fail the build on CI if you accidentally left test.only in the source code. */ - forbidOnly: !!process.env.CI, + forbidOnly: false, /* Retry on CI only */ retries: process.env.CI ? 2 : 0, /* Opt out of parallel tests on CI. */ From 6330b3c1c416aaac8b64672357305251a0148d40 Mon Sep 17 00:00:00 2001 From: Nil Gallego Date: Mon, 9 Dec 2024 14:49:42 +0100 Subject: [PATCH 3/4] wip --- .ibm/pipelines/kubernetes-tests.sh | 14 ++++++++++++++ .ibm/pipelines/openshift-ci-tests.sh | 1 - e2e-tests/playwright/e2e/plugins/aap.spec.ts | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 e2e-tests/playwright/e2e/plugins/aap.spec.ts diff --git a/.ibm/pipelines/kubernetes-tests.sh b/.ibm/pipelines/kubernetes-tests.sh index dee82da93f..cddb721214 100755 --- a/.ibm/pipelines/kubernetes-tests.sh +++ b/.ibm/pipelines/kubernetes-tests.sh @@ -60,6 +60,20 @@ install_helm() { fi } +install_ansible(){ + if [[ -x "$(command -v ansible)" ]]; then + echo "Ansible is already installed." + else + echo "Installing Ansible client" + apt install ansible -y + echo "Ansible client installed successfully." + fi +} + +install_ansible +ansible --version + + install_helm # check installed helm version diff --git a/.ibm/pipelines/openshift-ci-tests.sh b/.ibm/pipelines/openshift-ci-tests.sh index d5ab9c4471..ecaf258dab 100755 --- a/.ibm/pipelines/openshift-ci-tests.sh +++ b/.ibm/pipelines/openshift-ci-tests.sh @@ -46,7 +46,6 @@ source "${DIR}/jobs/periodic.sh" echo "Loaded periodic.sh" main() { - ansible-playbook get_aap_files.yaml echo "Log file: ${LOGFILE}" echo "JOB_NAME : $JOB_NAME" diff --git a/e2e-tests/playwright/e2e/plugins/aap.spec.ts b/e2e-tests/playwright/e2e/plugins/aap.spec.ts new file mode 100644 index 0000000000..1efc33ff4b --- /dev/null +++ b/e2e-tests/playwright/e2e/plugins/aap.spec.ts @@ -0,0 +1,5 @@ +import test, { expect } from "@playwright/test"; + +test.only("pass", () => { + expect(true); +}); From 2bbf386c0723f466a2782252759da381e567c2c0 Mon Sep 17 00:00:00 2001 From: Nil Gallego Date: Mon, 9 Dec 2024 15:52:13 +0100 Subject: [PATCH 4/4] wip --- .ibm/pipelines/get_aap_files.yaml | 24 ++++++++++++++++++++++++ .ibm/pipelines/jobs/ocp-v4-16.sh | 15 +++++++++++++++ .ibm/pipelines/kubernetes-tests.sh | 14 -------------- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/.ibm/pipelines/get_aap_files.yaml b/.ibm/pipelines/get_aap_files.yaml index 3729b3b722..393b1f6a6c 100644 --- a/.ibm/pipelines/get_aap_files.yaml +++ b/.ibm/pipelines/get_aap_files.yaml @@ -36,3 +36,27 @@ headers: Authorization: "Bearer {{ access_token }}" dest: "{{ download_path }}" + +- name: Setup Ansible Backstage Plugins + hosts: localhost + vars: + ansible_backstage_plugins_local_dir: "~/plugins" + ansible_backstage_bundle: "/tmp//tmp/ansible-automation-platform-setup-bundle.tar.gz" + + tasks: + - name: Create Plugins Directory + file: + path: "{{ ansible_backstage_plugins_local_dir }}" + state: directory + mode: '0755' + + - name: Set Dynamic Plugin Root Directory + set_fact: + dynamic_plugin_root_dir: "{{ ansible_backstage_plugins_local_dir }}" + + - name: Extract Ansible Backstage Bundle + unarchive: + src: "{{ ansible_backstage_bundle }}" + dest: "{{ dynamic_plugin_root_dir }}" + excludes: "*code*" + remote_src: yes diff --git a/.ibm/pipelines/jobs/ocp-v4-16.sh b/.ibm/pipelines/jobs/ocp-v4-16.sh index c8c8f8ed4f..7aadb42373 100644 --- a/.ibm/pipelines/jobs/ocp-v4-16.sh +++ b/.ibm/pipelines/jobs/ocp-v4-16.sh @@ -1,6 +1,21 @@ #!/bin/sh + +install_ansible(){ + if [[ -x "$(command -v ansible)" ]]; then + echo "Ansible is already installed." + else + echo "Installing Ansible client" + apt install ansible -y + echo "Ansible client installed successfully." + fi +} + handle_ocp_4_16() { + + install_ansible + ansible --version + K8S_CLUSTER_URL=$(cat /tmp/secrets/RHDH_OS_1_CLUSTER_URL) K8S_CLUSTER_TOKEN=$(cat /tmp/secrets/RHDH_OS_1_CLUSTER_TOKEN) diff --git a/.ibm/pipelines/kubernetes-tests.sh b/.ibm/pipelines/kubernetes-tests.sh index cddb721214..dee82da93f 100755 --- a/.ibm/pipelines/kubernetes-tests.sh +++ b/.ibm/pipelines/kubernetes-tests.sh @@ -60,20 +60,6 @@ install_helm() { fi } -install_ansible(){ - if [[ -x "$(command -v ansible)" ]]; then - echo "Ansible is already installed." - else - echo "Installing Ansible client" - apt install ansible -y - echo "Ansible client installed successfully." - fi -} - -install_ansible -ansible --version - - install_helm # check installed helm version