Skip to content

ci: the integration branch script can now update an existing branch

Paul Gascou-Vaillancourt requested to merge integration-branch-ci-job-update into main

What does this MR do?

ci: the integration branch script can now update an existing branch

This updates the bin/create_integration_branch.mjs script so that it detects when the integration branch already exists and pushes to it instead of trying to re-create it.

Remote verification

The normal developer workflow would look like this:

  1. Push a development branch to GitLab UI.
  2. In the latest pipeline, run the create_integration_branch job. This creates the integration branch.
  3. Push some more changes to the GitLab UI branch.
  4. In the latest pipeline, run the create_integration_branch job. This updates the integration branch.

This process can be verified right here:

  1. In this MR's first pipeline, I've run the create_integration_branch job, which did create the integration branch:
  2. I then ran another pipeline in this MR and triggered the create_integration_branch there too, which ended up updating the previously created integration branch:

Test locally

You will need a Project Access Token with the api scope in the https://gitlab.com/gitlab-org/frontend/gitlab-ui-integrations project. As a maintainer of GitLab UI, you may copy the one from the GITLAB_INTEGRATION_REST_TOKEN CI variable: https://gitlab.com/gitlab-org/gitlab-ui/-/settings/ci_cd.

  1. Expose the necessary environment variables:

    export CI_COMMIT_REF_NAME="<your_branh_name>" # The integration branch suffix of your choice
    export GITLAB_INTEGRATION_REST_TOKEN="<project_access_token>"
    export  DEPENDENCY_URL="https://gitlab.com/gitlab-org/gitlab-ui/-/jobs/<job_id>artifacts/raw/<archive>.tgz" # The URL provided by any `build` CI job in the GitLab UI project
  2. Run the script:

    bin/create_integration_branch.mjs

    This should create a new branch in the fork.

  3. Change the DEPENDENCY_URL environment variable to some other package URL:

    export  DEPENDENCY_URL="https://gitlab.com/gitlab-org/gitlab-ui/-/jobs/<job_id>artifacts/raw/<archive>.tgz"
  4. Run the script again:

    bin/create_integration_branch.mjs

    The branch that was created at step #2 should get updated with the new DEPENDENCY_URL.

Edited by Paul Gascou-Vaillancourt

Merge request reports

Loading