Junie GitLab CI/CD
Run AI tasks from GitLab issues or MRs with Junie GitLab CI/CD.
How it works
Junie GitLab CI/CD integrates Junie into your GitLab CI/CD pipelines.
When you tag #junie in a comment to a GitLab issue or merge request, the agent is invoked to run the task. Junie runs a CI pipeline to execute the task, creates a new Merge Request with the changes, and posts a comment with a link to the created MR.

Why use Junie GitLab CI/CD?
Delegate tasks to Junie: Junie creates merge requests with code changes from issue comments.
Have Junie review MRs: Tag and instruct
#juniein a comment to an existing merge request to have the agent review and fix the changes before merging.Fix issues in projects without opening the IDE: When running the task, the agent is aware of your entire project structure, agent guidelines, and existing code patterns the same way as it would when working directly in the IDE.
Iterate on tasks with follow-up instructions: The MR submitted by Junie needs another iteration? Tag
#juniein a comment to it and provide follow-up instructions.Work on multiple tasks at a time: Junie GitLab CI/CD can work on multiple tasks simultaneously, excluding parallel runs on the same MR branch.
Setup
The setup process requires creation of a separate container project for Junie's CI/CD pipelines (one per GitLab instance). This allows you to run Junie without tweaking the CI/CD pipelines in your existing projects.
Step 1: Set up a project for Junie
Create a new empty GitLab project.
Add the following environment variables in the project's Settings → CI/CD → Variables:
JUNIE_API_KEYwith your API token for Junie. To generate the token, go to junie.jetbrains.com/cli.GITLAB_TOKEN_FOR_JUNIEwith a personal or group Gitlab access token. Make sure that the token has at least Maintainer role and the api checkbox selected for Selected scope. Selectinitfrom the Environments dropdown to restrict the variable's exposure to Junie initialization jobs.
Add a
.gitlab-ci.ymlfile with the following contents to the project:
Step 2: Initialize Junie in your project
In Junie's project, go to Build → Pipelines and click New pipeline.
On the Run new pipeline page that opens, fill in the Variable value for the
PROJECTS_TO_INITVariable key with a comma-separated lost of IDs for the projects where Junie needs to be initialized. For a project's ID, go to its Settings → General page.
Click the New pipeline button to open the new pipeline's page and run it.

Once the pipeline run is finished, make sure that the target projects have a webhook for triggering pipelines in Junie's project (Settings → Webhooks) and an access token allowing Junie to access the project's repository, MRs, or issues (Settings → Access tokens).


Use Junie GitLab CI/CD
Basic usage
Type #junie or tag the Junie by JetBrains bot in an issue comment, followed by the description of what needs to be done.


Code reviews
Junie will perform a code review with a pre-defined prompt for any opened merge request automatically.

To customize the prompt for automatically triggered reviews, adjust the
JUNIE_CUSTOM_PROMPTvariable in the.gitlab-ci.ymlconfiguration file.To disable automated code reviews, uncheck the Merge request events checkbox in the Junie webhook's settings.
To trigger a code review in an existing merge request on demand, leave a comment tagging Junie along with the
code-reviewkeyword.