Skip to main content

GitLab

Playbook

Mission Control integrates with GitLab for GitOps workflows and repository operations.


Playbook

Use cases:

  • Clone repositories and push changes from playbooks
  • Create merge requests with reviewers and assignees
  • Commit configuration changes back to Git repositories
  • Integrate with GitLab CI/CD pipelines through GitOps
  • Support both GitLab.com and self-hosted GitLab instances

Perform Git operations against GitLab repositories in playbooks.

Push Changes to Repository​

gitlab-push-playbook.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: update-config
spec:
actions:
- name: push-config-change
gitops:
repo:
url: https://gitlab.com/org/config-repo.git
service: gitlab
accessToken:
valueFrom:
secretKeyRef:
name: gitlab-credentials
key: token
branch: main
commit:
author: Mission Control
email: automation@example.com
message: "Update configuration from playbook"
files:
- path: configs/app.yaml
content: |
replicas: {{.params.replicas}}
image: {{.params.image}}
Create Merge Request
gitlab-mr-playbook.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: create-merge-request
spec:
parameters:
- name: change_description
label: Change Description
type: text
actions:
- name: create-mr
gitops:
repo:
url: https://gitlab.com/org/infrastructure.git
service: gitlab
accessToken:
valueFrom:
secretKeyRef:
name: gitlab-credentials
key: token
base: main
branch: "auto/{{.run.id}}"
commit:
author: Mission Control
email: automation@example.com
message: "{{.params.change_description}}"
pullRequest:
title: "Automated Change: {{.params.change_description}}"
body: |
This merge request was created automatically by Mission Control.

**Change:** {{.params.change_description}}
**Triggered by:** {{.user.name}}
reviewers:
- platform-team
assignees:
- infrastructure-lead
Self-Hosted GitLab
gitlab-selfhosted-playbook.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: self-hosted-gitlab
spec:
actions:
- name: push-to-gitlab
gitops:
repo:
url: https://gitlab.internal.example.com/team/repo.git
service: gitlab
accessToken:
valueFrom:
secretKeyRef:
name: gitlab-internal-credentials
key: token
branch: main
commit:
author: Automation
email: automation@example.com
message: "Automated update"
SSH Authentication
gitlab-ssh-playbook.yaml
apiVersion: mission-control.flanksource.com/v1
kind: Playbook
metadata:
name: gitlab-ssh
spec:
actions:
- name: push-via-ssh
gitops:
repo:
url: git@gitlab.com:org/repo.git
service: gitlab
sshPrivateKey:
valueFrom:
secretKeyRef:
name: gitlab-ssh
key: private-key
sshPrivateKeyPassword:
valueFrom:
secretKeyRef:
name: gitlab-ssh
key: passphrase
branch: main
commit:
author: Mission Control
email: automation@example.com
message: "Update via SSH"

Configuration Options​

Repository Configuration​

FieldDescription
urlRepository URL (HTTPS or SSH)
serviceGit service type: gitlab, github, or azure
accessTokenGitLab personal access token
sshPrivateKeySSH private key for authentication
sshPrivateKeyPasswordPassphrase for encrypted SSH key
baseBase branch for merge requests
branchTarget branch for commits

Commit Configuration​

FieldDescription
authorCommit author name
emailCommit author email
messageCommit message

Merge Request Configuration​

FieldDescription
titleMerge request title
bodyMerge request description
reviewersList of reviewer usernames
assigneesList of assignee usernames
tagsLabels to apply

GitLab Access Token Scopes​

Create a Personal Access Token or Project Access Token with these scopes:

  • read_repository - Clone repositories
  • write_repository - Push commits
  • api - Create merge requests (if using MR feature)

Next Steps​