Skip to content

Add script to download fixtures locally

David Dieulivol requested to merge 299914-download_fixtures_locally into master

Context

Closes #299914 (closed)

What does this MR do and why?

  • Extracts package-related functions into their own files, so that we can reuse them in a script meant to be called outside of the CI.
  • Adds a script to download fixtures locally. This will make the live of frontend developers easier.

Does it work?

The refactoring of scripts/gitlab_component_helpers.sh seems to work. I tested it with this test commit: !117672 (0edde93c). The interesting output in the job ishttps://gitlab.com/gitlab-org/gitlab/-/jobs/4115570004#L51: it behaves as expected 🎉.

Test it locally

Before the script

$ pwd
/Users/gitlab/src/gitlab-development-kit/gitlab

$ ls -l tmp/tests/frontend/fixtures-ee
ls: tmp/tests/frontend/fixtures-ee: No such file or directory

Running the script

$ scripts/frontend/download_fixtures.sh --help
Usage: scripts/frontend/download_fixtures.sh [--branch <branch-name>] [--max-commits <number>]

Looks for a frontend fixture package in the package registry for commits on a local branch.

If --branch isn't specified, the script will use the current branch as a commit reference.
If --max-commits isn't specified, the default is 50 commits.

$ scripts/frontend/download_fixtures.sh --max-commits 3
Looking for frontend fixtures for commit dd6174afade056ed372547a36072a1d6e2a6fd0f...
Looking for frontend fixtures for commit 31e6bcd3356fca40ed47a78852e9a2226e318c35...
Looking for frontend fixtures for commit 21cbe69f61762d255ac2bf860d13ef9658ff8e8e...

$ scripts/frontend/download_fixtures.sh --branch master
Looking for frontend fixtures for commit e9a30019d38693efa5102b3c83f0bae172768601...
We have found frontend fixtures at https://gitlab.com/api/v4/projects/278964/packages/generic/fixtures/e9a30019d38693efa5102b3c83f0bae172768601/fixtures-e9a30019d38693efa5102b3c83f0bae172768601.tar.gz!
Downloading from https://gitlab.com/api/v4/projects/278964/packages/generic/fixtures/e9a30019d38693efa5102b3c83f0bae172768601/fixtures-e9a30019d38693efa5102b3c83f0bae172768601.tar.gz ...
Extracting archive to .

After the script

$ ls -l tmp/tests/frontend/fixtures-ee
total 8
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 abuse_reports
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 admin
drwxr-xr-x   5 gitlab  staff  160 Apr 14 14:18 analytics
drwxr-xr-x  13 gitlab  staff  416 Apr 14 14:19 api
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:19 application_settings
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 autocomplete
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 autocomplete_sources
drwxr-xr-x   9 gitlab  staff  288 Apr 14 14:19 blob
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 branches
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 clusters
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 commit
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 deploy_keys
drwxr-xr-x   5 gitlab  staff  160 Apr 14 14:19 ee
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:19 epic
drwxr-xr-x  27 gitlab  staff  864 Apr 14 14:19 graphql
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:19 groups
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 integrations
drwxr-xr-x   5 gitlab  staff  160 Apr 14 14:20 issues
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 jobs
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:20 labels
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 listbox
drwxr-xr-x   5 gitlab  staff  160 Apr 14 14:18 merge_request_diffs
drwxr-xr-x  11 gitlab  staff  352 Apr 14 14:19 merge_requests
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 metrics_dashboard
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 milestones
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:18 pipeline_schedules
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:18 pipelines
drwxr-xr-x   5 gitlab  staff  160 Apr 14 14:19 projects
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:19 projects_json
-rw-r--r--   1 gitlab  staff   27 Apr 14 14:20 returns
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:19 search
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:18 security_configuration
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 sessions
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 settings
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 snippets
drwxr-xr-x  10 gitlab  staff  320 Apr 14 14:18 startup_css
drwxr-xr-x   3 gitlab  staff   96 Apr 14 14:19 tabs
drwxr-xr-x   5 gitlab  staff  160 Apr 14 14:19 timezones
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:20 todos
drwxr-xr-x   4 gitlab  staff  128 Apr 14 14:19 webauthn

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports