Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
add cicd gitlab explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
fakepk committed Feb 15, 2024
1 parent e931134 commit 5472a06
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ module.exports = {
children: [
'cicd-integration/introduction',
'cicd-integration/github',
'cicd-integration/gitlab',
]
},
{
Expand Down
33 changes: 33 additions & 0 deletions src/cicd-integration/gitlab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Use GitLab Workflows 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](../cli-reference) to update your service on PlanQK.

To setup the workflow for a new service proceed with the [general setup](introduction) 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 CICD-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:

1. Create the file `.gitlab-ci.yml` via `touch .gitlab-ci.yml`
2. Paste the following snippet into `.gitlab-ci.yml` and save the file

```yaml
stages:
- deploy

deploy-to-planqk:
stage: deploy
rules:
- if: $CI_COMMIT_TAG
image: node:21-slim
before_script:
- npm install -g @anaqor/planqk
script:
- planqk login -t $PLANQK_TOKEN
- planqk set-context $CONTEXT_ID
- planqk up --silent
```
3. 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](https://docs.gitlab.com/ee/ci/variables/#for-a-project)).
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.

0 comments on commit 5472a06

Please sign in to comment.