Skip to content

[stable-4.6] Bump the babel group with 6 updates (#5069) #13688

[stable-4.6] Bump the babel group with 6 updates (#5069)

[stable-4.6] Bump the babel group with 6 updates (#5069) #13688

Workflow file for this run

name: Cypress
on:
# allow running manually
workflow_dispatch:
pull_request:
branches: [ 'stable-*' ]
push:
branches: [ 'stable-*' ]
concurrency:
group: cypress-${{ github.ref }}
cancel-in-progress: true
jobs:
cypress:
runs-on: ubuntu-latest
env:
# base of a PR, or pushed-to branch outside PRs, or stable-4.6
BRANCH: ${{ github.base_ref || github.ref || 'refs/heads/stable-4.6' }}
strategy:
fail-fast: false
matrix:
test:
- 'collections'
- 'approval'
- 'execution_environments'
- 'namespaces'
- 'groups_and_users'
- 'repo'
- 'misc'
- 'imports'
steps:
- name: "Install galaxykit dependency"
run: |
# pip install git+https://github.com/ansible/galaxykit.git@branch_name
pip install galaxykit==0.13.0
- name: "Set env.SHORT_BRANCH, env.GALAXY_NG_COMMIT"
run: |
SHORT_BRANCH=`sed 's/^refs\/heads\///' <<< $BRANCH`
GALAXY_NG_COMMIT=`curl -s https://api.github.com/repos/ansible/galaxy_ng/branches/${SHORT_BRANCH} | jq -r .commit.sha`
# blow up without galaxy_ng commit info
[ -n "$GALAXY_NG_COMMIT" ]
echo "SHORT_BRANCH=${SHORT_BRANCH}" >> $GITHUB_ENV
echo "GALAXY_NG_COMMIT=${GALAXY_NG_COMMIT}" >> $GITHUB_ENV
- run: "mkdir pulp_galaxy_ng"
- name: "Cache container image for pulp_galaxy_ng ${{ env.SHORT_BRANCH }} ${{ env.GALAXY_NG_COMMIT }}"
id: cache-container
uses: actions/cache@v4
with:
path: pulp_galaxy_ng/image
key: ${{ runner.os }}-container-${{ env.GALAXY_NG_COMMIT }}-post2547
- name: "Checkout ansible-hub-ui (${{ github.ref }})"
uses: actions/checkout@v4
with:
path: 'ansible-hub-ui'
- name: "Build pulp-galaxy-ng"
if: steps.cache-container.outputs.cache-hit != 'true'
working-directory: 'pulp_galaxy_ng'
run: |
cp -iv ../ansible-hub-ui/.github/workflows/scripts/* .
echo '# Containerfile'
echo '\
FROM ghcr.io/pulp/pulp-ci-centos:3.21
COPY --chmod=644 ansible-sign.key /tmp/
COPY --chmod=755 collection-sign.sh /var/lib/pulp/scripts/
COPY --chmod=755 container-sign.sh /var/lib/pulp/scripts/
COPY --chmod=755 signing-setup.sh /tmp/
RUN pip3 install --upgrade \
requests \
git+https://github.com/ansible/galaxy_ng.git@${{ env.SHORT_BRANCH }}
RUN mkdir -p /etc/nginx/pulp/
RUN ln /usr/local/lib/python*/site-packages/pulp_ansible/app/webserver_snippets/nginx.conf /etc/nginx/pulp/pulp_ansible.conf
RUN ln /usr/local/lib/python*/site-packages/pulp_container/app/webserver_snippets/nginx.conf /etc/nginx/pulp/pulp_container.conf
RUN ln /usr/local/lib/python*/site-packages/galaxy_ng/app/webserver_snippets/nginx.conf /etc/nginx/pulp/galaxy_ng.conf
RUN rm -rf /usr/local/lib/python*/site-packages/galaxy_ng/app/static/
RUN ln -sv /galaxy_ng_static `ls -d /usr/local/lib/python*/site-packages/galaxy_ng/app/`static
' | tee Containerfile
buildah bud --file Containerfile --tag localhost/pulp/pulp-galaxy-ng:latest .
rm -f image # ensure older version is gone, podman save errors otherwise
podman save localhost/pulp/pulp-galaxy-ng:latest -o image
- name: "Load pulp-galaxy-ng from cache"
if: steps.cache-container.outputs.cache-hit == 'true'
working-directory: 'pulp_galaxy_ng'
run: podman load -i image
- name: "Configure and run pulp-galaxy-ng"
working-directory: 'pulp_galaxy_ng'
run: |
mkdir settings static
echo '# settings/settings.py'
echo "\
ANSIBLE_API_HOSTNAME='http://localhost:8002'
ANSIBLE_CONTENT_HOSTNAME='http://localhost:8002/api/galaxy/v3/artifacts/collections'
CONTENT_ORIGIN='http://localhost:8002'
GALAXY_API_PATH_PREFIX='/api/galaxy/'
GALAXY_AUTHENTICATION_CLASSES=['rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.TokenAuthentication']
GALAXY_DEPLOYMENT_MODE='standalone'
PULP_CONTENT_PATH_PREFIX='/api/galaxy/v3/artifacts/collections/'
RH_ENTITLEMENT_REQUIRED='insights'
TOKEN_AUTH_DISABLED=True
X_PULP_CONTENT_HOST='localhost'
GALAXY_REQUIRE_CONTENT_APPROVAL=False
GALAXY_COLLECTION_SIGNING_SERVICE='ansible-default'
GALAXY_CONTAINER_SIGNING_SERVICE='container-default'
GALAXY_FEATURE_FLAGS__container_signing=True
" | sed 's/^\s\+//' | tee settings/settings.py
podman run \
--detach \
--publish 8002:80 \
--name pulp \
--volume "$(pwd)/settings":/etc/pulp \
--volume "$(pwd)/static":/galaxy_ng_static \
--tmpfs /var/lib/pulp \
--tmpfs /var/lib/pgsql \
--tmpfs /var/lib/containers \
--device /dev/fuse \
localhost/pulp/pulp-galaxy-ng:latest
- name: "Install node 18"
uses: actions/setup-node@v4
with:
node-version: '18'
- name: "Cache ~/.npm & ~/.cache/Cypress"
uses: actions/cache@v4
with:
path: |
~/.npm
~/.cache/Cypress
key: ${{ runner.os }}-node-${{ env.SHORT_BRANCH }}-${{ hashFiles('ansible-hub-ui/**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.SHORT_BRANCH }}-
${{ runner.os }}-node-
- name: "Build standalone UI"
working-directory: 'ansible-hub-ui'
run: |
npm install
# production displays unknown translations literally, make sure it's up to date
npm run gettext:extract
npm run gettext:compile
npm run build-standalone
# save the App.*.js hash for later verification
BUILD_HASH=`ls dist/js/App*js | cut -d. -f2`
echo "BUILD_HASH=${BUILD_HASH}" >> $GITHUB_ENV
rm -rf ../pulp_galaxy_ng/static/galaxy_ng/ || true
mv -v dist/ ../pulp_galaxy_ng/static/galaxy_ng
# apply changes, runs collectstatic and serves static assets
podman exec pulp pulpcore-manager collectstatic --no-input --clear
podman exec pulp bash -c "s6-svc -r /var/run/s6-rc/servicedirs/pulpcore-api"
- name: "Reset admin password"
run: |
# podman exec pulp pip install django_extensions
podman exec pulp pulpcore-manager reset-admin-password --password admin
- name: "Enable signing service"
run: |
podman exec pulp /tmp/signing-setup.sh
- name: "Install Cypress & test dependencies"
working-directory: 'ansible-hub-ui/test'
run: |
npm install
- name: "Configure Cypress"
working-directory: 'ansible-hub-ui/test'
run: |
echo -e '{
"prefix": "/api/galaxy/",
"pulpPrefix": "/api/galaxy/pulp/api/v3/",
"username": "admin",
"password": "admin",
"settings": "../../pulp_galaxy_ng/settings/settings.py",
"restart": "podman exec pulp bash -c \"s6-svc -r /var/run/s6-rc/servicedirs/pulpcore-api\"; sleep 10",
"containers": "localhost:8002",
"galaxykit": "galaxykit --ignore-certs"
}' > cypress.env.json
- name: "Ensure index.html uses the new js"
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 galaxykit can connect to the server"
run: |
galaxykit -s 'http://localhost:8002/api/galaxy/' -u admin -p admin collection list
- name: "Check initial feature flags"
run: |
curl -s http://localhost:8002/api/galaxy/_ui/v1/feature-flags/ | jq
- name: "Check component versions"
run: |
HUB_TOKEN=`curl -s -u admin:admin -d '' http://localhost:8002/api/galaxy/v3/auth/token/ | jq -r .token`
curl -s -H "Authorization: Token $HUB_TOKEN" http://localhost:8002/api/galaxy/ | jq
- name: "Check if e2e contains only dirs in matrix test array"
working-directory: 'ansible-hub-ui'
run: |
diff -Naur <(ls test/cypress/e2e) <(yq '.jobs.cypress.strategy.matrix.test[]' .github/workflows/cypress.yml | sort)
- name: "Run cypress"
working-directory: 'ansible-hub-ui/test'
env:
CONSOLE_LOG_TO_TERMINAL: true
run: |
sed -i '/specPattern:/s/\*\*/${{matrix.test}}/' cypress.config.js
echo "result of the config file:"
cat cypress.config.js
npm run cypress:chrome
- uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots_and_videos-${{matrix.test}}
path: |
ansible-hub-ui/test/cypress/screenshots
ansible-hub-ui/test/cypress/videos
- name: "Kill container, show debug info"
if: always()
run: |
podman exec pulp bash -c "pip3 list && pip3 install pipdeptree && pipdeptree"
podman logs pulp
podman kill pulp