Project Mirror Args
The gitlab.ProjectMirror
resource allows to manage the lifecycle of a project mirror. This is for pushing changes to a remote repository. Pull Mirroring can be configured using a combination of the import_url, mirror, and mirror_trigger_builds properties on the gitlab.Project resource.
Warning By default, the provider sets the
keep_divergent_refs
argument toTrue
. If you manually setkeep_divergent_refs
toFalse
, GitLab mirroring removes branches in the target that aren't in the source. This action can result in unexpected branch deletions. Destroy Behavior GitLab 14.10 introduced an API endpoint to delete a project mirror. Therefore, for GitLab 14.10 and newer the project mirror will be destroyed when the resource is destroyed. For older versions, the mirror will be disabled and the resource will be destroyed. Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const foo = new gitlab.ProjectMirror("foo", {
project: "1",
url: "https://username:password@github.com/org/repository.git",
});
import pulumi
import pulumi_gitlab as gitlab
foo = gitlab.ProjectMirror("foo",
project="1",
url="https://username:password@github.com/org/repository.git")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var foo = new GitLab.ProjectMirror("foo", new()
{
Project = "1",
Url = "https://username:password@github.com/org/repository.git",
});
});
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v7/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gitlab.NewProjectMirror(ctx, "foo", &gitlab.ProjectMirrorArgs{
Project: pulumi.String("1"),
Url: pulumi.String("https://username:password@github.com/org/repository.git"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.ProjectMirror;
import com.pulumi.gitlab.ProjectMirrorArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var foo = new ProjectMirror("foo", ProjectMirrorArgs.builder()
.project("1")
.url("https://username:password@github.com/org/repository.git")
.build());
}
}
resources:
foo:
type: gitlab:ProjectMirror
properties:
project: '1'
url: https://username:password@github.com/org/repository.git
Import
GitLab project mirror can be imported using an id made up of project_id:mirror_id
, e.g.
$ pulumi import gitlab:index/projectMirror:ProjectMirror foo "12345:1337"