Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cypress.yml: rename COMPOSE_PROFILE to BACKEND_FLAVOR #4110

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ jobs:
# pip install git+https://github.com/ansible/galaxykit.git@branch_name
pip install git+https://github.com/ansible/galaxykit.git

- name: "Set env.SHORT_BRANCH, COMPOSE_PROFILE"
- name: "Set env.SHORT_BRANCH, BACKEND_FLAVOR"
run: |
SHORT_BRANCH=`sed 's/^refs\/heads\///' <<< $BRANCH`

case "${{ matrix.test }}" in
insights*)
COMPOSE_PROFILE=insights
BACKEND_FLAVOR=insights
echo "insights"
;;
*)
COMPOSE_PROFILE=standalone
BACKEND_FLAVOR=standalone
echo "standalone"
;;
esac

echo "SHORT_BRANCH=${SHORT_BRANCH}" >> $GITHUB_ENV
echo "COMPOSE_PROFILE=${COMPOSE_PROFILE}" >> $GITHUB_ENV
echo "BACKEND_FLAVOR=${BACKEND_FLAVOR}" >> $GITHUB_ENV
echo "COMPOSE_INTERACTIVE_NO_CLI=1" >> $GITHUB_ENV

- name: "Set variables for screenshots"
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
pip install --editable ./client/
# merge common, profile-specific and test matrix specific config
cat ../ansible-hub-ui/.github/workflows/cypress/compose.env.common \
../ansible-hub-ui/.github/workflows/cypress/compose.env."$COMPOSE_PROFILE" \
../ansible-hub-ui/.github/workflows/cypress/compose.env."$BACKEND_FLAVOR" \
../ansible-hub-ui/test/cypress/e2e/"${{ matrix.test }}"/compose.env \
| sed 's/^\s\+//' | tee compose.env || [ -s compose.env ]

Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
npm-

- name: "Build standalone UI"
if: ${{ env.COMPOSE_PROFILE == 'standalone' }}
if: ${{ env.BACKEND_FLAVOR == 'standalone' }}
working-directory: 'ansible-hub-ui'
run: |
npm install
Expand All @@ -147,7 +147,7 @@ jobs:
echo "BUILD_HASH=${BUILD_HASH}" >> $GITHUB_ENV

- name: "Serve standalone UI"
if: ${{ env.COMPOSE_PROFILE == 'standalone' }}
if: ${{ env.BACKEND_FLAVOR == 'standalone' }}
run: |
mkdir -p www/static/
mv ansible-hub-ui/dist www/static/galaxy_ng
Expand All @@ -161,7 +161,7 @@ jobs:
--rewrite '/extensions/v2/(.*) -> http://localhost:5001/extensions/v2/$1' &

- name: "Run insights UI"
if: ${{ env.COMPOSE_PROFILE == 'insights' }}
if: ${{ env.BACKEND_FLAVOR == 'insights' }}
working-directory: 'ansible-hub-ui'
run: |
npm install
Expand Down Expand Up @@ -196,54 +196,54 @@ jobs:
- name: "Configure Cypress"
working-directory: 'ansible-hub-ui/test'
run: |
cp -aiv ../.github/workflows/cypress/cypress.env.json."$COMPOSE_PROFILE" cypress.env.json
cp -aiv ../.github/workflows/cypress/cypress.env.json."$BACKEND_FLAVOR" cypress.env.json

- name: "Ensure index.html uses the new js"
if: ${{ env.COMPOSE_PROFILE == 'standalone' }}
if: ${{ env.BACKEND_FLAVOR == 'standalone' }}
run: |
echo 'expecting /static/galaxy_ng/js/App.'"$BUILD_HASH"'.js'
curl http://localhost:8002/static/galaxy_ng/index.html | tee /dev/stderr | grep '/static/galaxy_ng/js/App.'"$BUILD_HASH"'.js'

- name: "Ensure insights is served"
if: ${{ env.COMPOSE_PROFILE == 'insights' }}
if: ${{ env.BACKEND_FLAVOR == 'insights' }}
run: |
echo waiting for containers to start
sleep 30
curl http://localhost:8002/preview/ansible/automation-hub/ | tee /dev/stderr | grep '/beta/apps/chrome/js/'
sleep 30

- name: "Ensure galaxykit can connect to API (standalone)"
if: ${{ env.COMPOSE_PROFILE == 'standalone' }}
if: ${{ env.BACKEND_FLAVOR == 'standalone' }}
run: |
galaxykit -s http://localhost:8002/api/galaxy/ -u admin -p admin collection list

- name: "Ensure galaxykit can connect to API (insights)"
if: ${{ env.COMPOSE_PROFILE == 'insights' }}
if: ${{ env.BACKEND_FLAVOR == 'insights' }}
run: |
galaxykit -s http://localhost:8002/api/automation-hub/ \
-u admin -p admin \
--auth-url http://localhost:8002/auth/realms/redhat-external/protocol/openid-connect/token \
collection list

- name: "Check initial feature flags (standalone)"
if: ${{ env.COMPOSE_PROFILE == 'standalone' }}
if: ${{ env.BACKEND_FLAVOR == 'standalone' }}
run: |
curl -s http://localhost:5001/api/galaxy/_ui/v1/feature-flags/ | jq

- name: "Check initial feature flags (insights)"
if: ${{ env.COMPOSE_PROFILE == 'insights' }}
if: ${{ env.BACKEND_FLAVOR == 'insights' }}
run: |
curl -s http://localhost:5001/api/automation-hub/_ui/v1/feature-flags/ | jq

- name: "Check component versions & settings (standalone)"
if: ${{ env.COMPOSE_PROFILE == 'standalone' }}
if: ${{ env.BACKEND_FLAVOR == 'standalone' }}
run: |
HUB_TOKEN=`curl -s -u admin:admin -d '' http://localhost:5001/api/galaxy/v3/auth/token/ | jq -r .token`
curl -s -H "Authorization: Token $HUB_TOKEN" http://localhost:5001/api/galaxy/ | jq
curl -s -H "Authorization: Token $HUB_TOKEN" http://localhost:5001/api/galaxy/_ui/v1/settings/ | jq

- name: "Check component versions & settings (insights)"
if: ${{ env.COMPOSE_PROFILE == 'insights' }}
if: ${{ env.BACKEND_FLAVOR == 'insights' }}
run: |
BEARER=`curl -s -H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=cloud-services&username=admin&password=admin&grant_type=password" \
Expand Down
Loading