Appearance
Use GitLab CI to deploy to PlanQK
To setup a deploy job in a GitLab workflow you can use the below provided definition of a deploy stage. It uses the PlanQK CLI to update your service on PlanQK.
To setup the workflow for a new service proceed with the general setup of your git repo on GitLab, such that you have wired your service code with a PlanQK service referenced in the planqk.json
.
Then create a CI/CD pipeline that deploys service updates on PlanQK whenever you create new tag on GitLab via the following steps that must be executed in the root of your local clone of your GitLab repository:
- Create the file
.gitlab-ci.yml
viatouch .gitlab-ci.yml
- Paste the following snippet into
.gitlab-ci.yml
and save the fileyamlstages: - deploy deploy-to-planqk: stage: deploy rules: - if: $CI_COMMIT_TAG image: node:21-slim before_script: - npm install -g @planqk/planqk-cli script: - planqk login -t $PLANQK_TOKEN - planqk set-context $CONTEXT_ID - planqk up --silent
- Commit and push these changes to your remote via
git add . && git commit -m "add CD workflow" && git push
The deploy job requires the environment variables PLANQK_TOKEN
and CONTEXT_ID
being set, which you can setup in the settings of your repository (see here). If you have setup the workflow and the environment variables correctly, the workflow will run once you create a new tag in your GitLab repository.