Skip to content

Commit

Permalink
Make the pre_e2e script echo the token
Browse files Browse the repository at this point in the history
debug

once again

maybe?

what

Debug

🤫 grep
  • Loading branch information
AbdulrhmnGhanem committed Jun 29, 2023
1 parent 3d0a9ef commit ef92824
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
17 changes: 5 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,21 +325,14 @@ jobs:

- name: Pre e2e
env:
FRONTEND_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.frontend_sha_short }}'
PROCESSOR_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.processor_sha_short }}'
NGINX_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.nginx_sha_short }}'
GITEA_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.gitea_sha_short }}'
FRONTEND_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.frontend_sha }}'
PROCESSOR_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.processor_sha }}'
NGINX_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.nginx_sha }}'
GITEA_DEPLOY_IMAGE_TAG: ':${{ needs.get_version.outputs.gitea_sha }}'
shell: bash
run: |
auto_gen_fixtures_path=e2e/cypress/fixtures/auto-gen
mkdir $auto_gen_fixtures_path
truncate -s "${MAX_FILE_SIZE}" "${auto_gen_fixtures_path}/big.txt"
# generate admin token used for importing projects during e2e tests
docker-compose -f docker-compose.yml -f docker-compose.deploy.yml up -d
until docker logs kitspace_gitea_1 | grep 'ORM engine initialization successful' ; do sleep 3s; done
token="$(deno run --allow-env --allow-net --allow-run ./scripts/importBoardsTxt.ts --tokenOnly)"
token=$(scripts/pre_e2e.sh)
echo "CYPRESS_GITEA_ADMIN_TOKEN=${token}" >> $GITHUB_ENV
docker-compose stop
- name: e2e
timeout-minutes: 40
Expand Down
19 changes: 17 additions & 2 deletions scripts/pre_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@ set -Eeuo pipefail
# Generate big files which are used during testing
# `uploadProject.spec.js` -> should reject files bigger than `MAX_FILE_SIZE`
auto_gen_fixtures_path=e2e/cypress/fixtures/auto-gen
mkdir $auto_gen_fixtures_path
truncate -s "${MAX_FILE_SIZE}" "${auto_gen_fixtures_path}/big.txt"
rm -rf $auto_gen_fixtures_path && mkdir $auto_gen_fixtures_path
truncate -s "${MAX_FILE_SIZE:-6M}" "${auto_gen_fixtures_path}/big.txt"

# generate admin token used for importing projects during e2e tests
if [[ "${CI:-}" = "true" ]]; then
docker-compose -f docker-compose.yml -f docker-compose.deploy.yml up -d
until docker logs kitspace_gitea_1 | grep -q 'ORM engine initialization successful' ; do sleep 3s; done
else
# The tests are running locally.
docker-compose up -d
fi

token="$(deno run --allow-env --allow-net --allow-run ./scripts/importBoardsTxt.ts --tokenOnly)"
docker-compose stop

# reutrn the token so it can be used as $(./scripts/pre_e2e.sh)
echo $token

0 comments on commit ef92824

Please sign in to comment.