# 7- Use vmr for CI/CD

# CI/CD

You can set up a vmr environment to use it in CI/CD pipelines.

    vmrStart()
    # do what you want
    vmrTakeSnapshot("cicdversionR")

## GitLab Runner CI/CD

> Using gitlab-runner >= 15.0.0 the option `[runners.ssh.disable_strict_host_key_checking]` have to be set to `true`.

Then you can get the command to run, to add it as a GitLab Runner (this will also configure the guest VM) :

    virtualboxGitlabRunner(vmr_env,
                           gitlab_url = "gitlab.com",
                           gt_token = "<mytoken>",
                           snapshot_name = "cicdversionR",
                           vm_name = <VirtualBox VM Name>)

Copy and paste the return command in a terminal where GitLab Runner and the vmr environment are installed (be careful with user right on Gitlab Runner and vmr environment).

## Snapshot

Once you set up your vmr environment and configure CI/CD take a snapshot of it (snapshot name as to be the same as given into virtualboxGitlabRunner).

    vmrTakeSnapshot("cicdversionR")
    vmrStop()

## Vignette summary

1. Working with vmr package
2. Start my first environment
3. Manage vmr environment
4. Manage boxes
5. Manage providers
6. Development with vmr
7. CI/CD
8. Functions resume

### Next vignette : 8- Functions resume