Project Args
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const example = new gitlab.Project("example", {
description: "My awesome codebase",
visibilityLevel: "public",
});
// Project with custom push rules
const example_two = new gitlab.Project("example-two", {pushRules: {
authorEmailRegex: "@example\\.com$",
commitCommitterCheck: true,
memberCheck: true,
preventSecrets: true,
}});
const peterParker = gitlab.getUser({
username: "peter_parker",
});
const petersRepo = new gitlab.Project("petersRepo", {
description: "This is a description",
namespaceId: peterParker.then(peterParker => peterParker.namespaceId),
});
// Fork a project
const forkProject = new gitlab.Project("forkProject", {
description: "This is a fork",
forkedFromProjectId: example.id,
});
// Fork a project and setup a pull mirror
const forkIndex_projectProject = new gitlab.Project("forkIndex/projectProject", {
description: "This is a fork",
forkedFromProjectId: example.id,
importUrl: example.httpUrlToRepo,
mirror: true,
});
// Create a project by importing it from a public project
const importPublic = new gitlab.Project("importPublic", {importUrl: "https://gitlab.example.com/repo.git"});
// Create a project by importing it from a public project and setup the pull mirror
const importPublicWithMirror = new gitlab.Project("importPublicWithMirror", {
importUrl: "https://gitlab.example.com/repo.git",
mirror: true,
});
// Create a project by importing it from a private project
const importPrivateProject = new gitlab.Project("importPrivateProject", {
importUrl: "https://gitlab.example.com/repo.git",
importUrlUsername: "user",
importUrlPassword: "pass",
});
// Create a project by importing it from a private project and setup the pull mirror
const importPrivateWithMirror = new gitlab.Project("importPrivateWithMirror", {
importUrl: "https://gitlab.example.com/repo.git",
importUrlUsername: "user",
importUrlPassword: "pass",
mirror: true,
});
// Create a project by importing it from a private project and provide credentials in `import_url`
// NOTE: only use this if you really must, use `import_url_username` and `import_url_password` whenever possible
// GitLab API will always return the `import_url` without credentials, therefore you must ignore the `import_url` for changes:
const importPrivateIndex_projectProject = new gitlab.Project("importPrivateIndex/projectProject", {importUrl: "https://user:pass@gitlab.example.com/repo.git"});
import pulumi
import pulumi_gitlab as gitlab
example = gitlab.Project("example",
description="My awesome codebase",
visibility_level="public")
# Project with custom push rules
example_two = gitlab.Project("example-two", push_rules=gitlab.ProjectPushRulesArgs(
author_email_regex="@example\\.com$",
commit_committer_check=True,
member_check=True,
prevent_secrets=True,
))
peter_parker = gitlab.get_user(username="peter_parker")
peters_repo = gitlab.Project("petersRepo",
description="This is a description",
namespace_id=peter_parker.namespace_id)
# Fork a project
fork_project = gitlab.Project("forkProject",
description="This is a fork",
forked_from_project_id=example.id)
# Fork a project and setup a pull mirror
fork_index_project_project = gitlab.Project("forkIndex/projectProject",
description="This is a fork",
forked_from_project_id=example.id,
import_url=example.http_url_to_repo,
mirror=True)
# Create a project by importing it from a public project
import_public = gitlab.Project("importPublic", import_url="https://gitlab.example.com/repo.git")
# Create a project by importing it from a public project and setup the pull mirror
import_public_with_mirror = gitlab.Project("importPublicWithMirror",
import_url="https://gitlab.example.com/repo.git",
mirror=True)
# Create a project by importing it from a private project
import_private_project = gitlab.Project("importPrivateProject",
import_url="https://gitlab.example.com/repo.git",
import_url_username="user",
import_url_password="pass")
# Create a project by importing it from a private project and setup the pull mirror
import_private_with_mirror = gitlab.Project("importPrivateWithMirror",
import_url="https://gitlab.example.com/repo.git",
import_url_username="user",
import_url_password="pass",
mirror=True)
# Create a project by importing it from a private project and provide credentials in `import_url`
# NOTE: only use this if you really must, use `import_url_username` and `import_url_password` whenever possible
# GitLab API will always return the `import_url` without credentials, therefore you must ignore the `import_url` for changes:
import_private_index_project_project = gitlab.Project("importPrivateIndex/projectProject", import_url="https://user:pass@gitlab.example.com/repo.git")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var example = new GitLab.Project("example", new()
{
Description = "My awesome codebase",
VisibilityLevel = "public",
});
// Project with custom push rules
var example_two = new GitLab.Project("example-two", new()
{
PushRules = new GitLab.Inputs.ProjectPushRulesArgs
{
AuthorEmailRegex = "@example\\.com$",
CommitCommitterCheck = true,
MemberCheck = true,
PreventSecrets = true,
},
});
var peterParker = GitLab.GetUser.Invoke(new()
{
Username = "peter_parker",
});
var petersRepo = new GitLab.Project("petersRepo", new()
{
Description = "This is a description",
NamespaceId = peterParker.Apply(getUserResult => getUserResult.NamespaceId),
});
// Fork a project
var forkProject = new GitLab.Project("forkProject", new()
{
Description = "This is a fork",
ForkedFromProjectId = example.Id,
});
// Fork a project and setup a pull mirror
var forkIndex_projectProject = new GitLab.Project("forkIndex/projectProject", new()
{
Description = "This is a fork",
ForkedFromProjectId = example.Id,
ImportUrl = example.HttpUrlToRepo,
Mirror = true,
});
// Create a project by importing it from a public project
var importPublic = new GitLab.Project("importPublic", new()
{
ImportUrl = "https://gitlab.example.com/repo.git",
});
// Create a project by importing it from a public project and setup the pull mirror
var importPublicWithMirror = new GitLab.Project("importPublicWithMirror", new()
{
ImportUrl = "https://gitlab.example.com/repo.git",
Mirror = true,
});
// Create a project by importing it from a private project
var importPrivateProject = new GitLab.Project("importPrivateProject", new()
{
ImportUrl = "https://gitlab.example.com/repo.git",
ImportUrlUsername = "user",
ImportUrlPassword = "pass",
});
// Create a project by importing it from a private project and setup the pull mirror
var importPrivateWithMirror = new GitLab.Project("importPrivateWithMirror", new()
{
ImportUrl = "https://gitlab.example.com/repo.git",
ImportUrlUsername = "user",
ImportUrlPassword = "pass",
Mirror = true,
});
// Create a project by importing it from a private project and provide credentials in `import_url`
// NOTE: only use this if you really must, use `import_url_username` and `import_url_password` whenever possible
// GitLab API will always return the `import_url` without credentials, therefore you must ignore the `import_url` for changes:
var importPrivateIndex_projectProject = new GitLab.Project("importPrivateIndex/projectProject", new()
{
ImportUrl = "https://user:pass@gitlab.example.com/repo.git",
});
});
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v6/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := gitlab.NewProject(ctx, "example", &gitlab.ProjectArgs{
Description: pulumi.String("My awesome codebase"),
VisibilityLevel: pulumi.String("public"),
})
if err != nil {
return err
}
// Project with custom push rules
_, err = gitlab.NewProject(ctx, "example-two", &gitlab.ProjectArgs{
PushRules: &gitlab.ProjectPushRulesArgs{
AuthorEmailRegex: pulumi.String("@example\\.com$"),
CommitCommitterCheck: pulumi.Bool(true),
MemberCheck: pulumi.Bool(true),
PreventSecrets: pulumi.Bool(true),
},
})
if err != nil {
return err
}
peterParker, err := gitlab.LookupUser(ctx, &gitlab.LookupUserArgs{
Username: pulumi.StringRef("peter_parker"),
}, nil)
if err != nil {
return err
}
_, err = gitlab.NewProject(ctx, "petersRepo", &gitlab.ProjectArgs{
Description: pulumi.String("This is a description"),
NamespaceId: pulumi.Int(peterParker.NamespaceId),
})
if err != nil {
return err
}
// Fork a project
_, err = gitlab.NewProject(ctx, "forkProject", &gitlab.ProjectArgs{
Description: pulumi.String("This is a fork"),
ForkedFromProjectId: example.ID(),
})
if err != nil {
return err
}
// Fork a project and setup a pull mirror
_, err = gitlab.NewProject(ctx, "forkIndex/projectProject", &gitlab.ProjectArgs{
Description: pulumi.String("This is a fork"),
ForkedFromProjectId: example.ID(),
ImportUrl: example.HttpUrlToRepo,
Mirror: pulumi.Bool(true),
})
if err != nil {
return err
}
// Create a project by importing it from a public project
_, err = gitlab.NewProject(ctx, "importPublic", &gitlab.ProjectArgs{
ImportUrl: pulumi.String("https://gitlab.example.com/repo.git"),
})
if err != nil {
return err
}
// Create a project by importing it from a public project and setup the pull mirror
_, err = gitlab.NewProject(ctx, "importPublicWithMirror", &gitlab.ProjectArgs{
ImportUrl: pulumi.String("https://gitlab.example.com/repo.git"),
Mirror: pulumi.Bool(true),
})
if err != nil {
return err
}
// Create a project by importing it from a private project
_, err = gitlab.NewProject(ctx, "importPrivateProject", &gitlab.ProjectArgs{
ImportUrl: pulumi.String("https://gitlab.example.com/repo.git"),
ImportUrlUsername: pulumi.String("user"),
ImportUrlPassword: pulumi.String("pass"),
})
if err != nil {
return err
}
// Create a project by importing it from a private project and setup the pull mirror
_, err = gitlab.NewProject(ctx, "importPrivateWithMirror", &gitlab.ProjectArgs{
ImportUrl: pulumi.String("https://gitlab.example.com/repo.git"),
ImportUrlUsername: pulumi.String("user"),
ImportUrlPassword: pulumi.String("pass"),
Mirror: pulumi.Bool(true),
})
if err != nil {
return err
}
// Create a project by importing it from a private project and provide credentials in `import_url`
// NOTE: only use this if you really must, use `import_url_username` and `import_url_password` whenever possible
//
// GitLab API will always return the `import_url` without credentials, therefore you must ignore the `import_url` for changes:
_, err = gitlab.NewProject(ctx, "importPrivateIndex/projectProject", &gitlab.ProjectArgs{
ImportUrl: pulumi.String("https://user:pass@gitlab.example.com/repo.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.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.inputs.ProjectPushRulesArgs;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetUserArgs;
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 example = new Project("example", ProjectArgs.builder()
.description("My awesome codebase")
.visibilityLevel("public")
.build());
// Project with custom push rules
var example_two = new Project("example-two", ProjectArgs.builder()
.pushRules(ProjectPushRulesArgs.builder()
.authorEmailRegex("@example\\.com$")
.commitCommitterCheck(true)
.memberCheck(true)
.preventSecrets(true)
.build())
.build());
final var peterParker = GitlabFunctions.getUser(GetUserArgs.builder()
.username("peter_parker")
.build());
var petersRepo = new Project("petersRepo", ProjectArgs.builder()
.description("This is a description")
.namespaceId(peterParker.applyValue(getUserResult -> getUserResult.namespaceId()))
.build());
// Fork a project
var forkProject = new Project("forkProject", ProjectArgs.builder()
.description("This is a fork")
.forkedFromProjectId(example.id())
.build());
// Fork a project and setup a pull mirror
var forkIndex_projectProject = new Project("forkIndex/projectProject", ProjectArgs.builder()
.description("This is a fork")
.forkedFromProjectId(example.id())
.importUrl(example.httpUrlToRepo())
.mirror(true)
.build());
// Create a project by importing it from a public project
var importPublic = new Project("importPublic", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.build());
// Create a project by importing it from a public project and setup the pull mirror
var importPublicWithMirror = new Project("importPublicWithMirror", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.mirror(true)
.build());
// Create a project by importing it from a private project
var importPrivateProject = new Project("importPrivateProject", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.importUrlUsername("user")
.importUrlPassword("pass")
.build());
// Create a project by importing it from a private project and setup the pull mirror
var importPrivateWithMirror = new Project("importPrivateWithMirror", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.importUrlUsername("user")
.importUrlPassword("pass")
.mirror(true)
.build());
// Create a project by importing it from a private project and provide credentials in `import_url`
// NOTE: only use this if you really must, use `import_url_username` and `import_url_password` whenever possible
// GitLab API will always return the `import_url` without credentials, therefore you must ignore the `import_url` for changes:
var importPrivateIndex_projectProject = new Project("importPrivateIndex/projectProject", ProjectArgs.builder()
.importUrl("https://user:pass@gitlab.example.com/repo.git")
.build());
}
}
resources:
example:
type: gitlab:Project
properties:
description: My awesome codebase
visibilityLevel: public
# Project with custom push rules
example-two:
type: gitlab:Project
properties:
pushRules:
authorEmailRegex: '@example\.com$'
commitCommitterCheck: true
memberCheck: true
preventSecrets: true
petersRepo:
type: gitlab:Project
properties:
description: This is a description
namespaceId: ${peterParker.namespaceId}
# Fork a project
forkProject:
type: gitlab:Project
properties:
description: This is a fork
forkedFromProjectId: ${example.id}
# Fork a project and setup a pull mirror
forkIndex/projectProject:
type: gitlab:Project
properties:
description: This is a fork
forkedFromProjectId: ${example.id}
importUrl: ${example.httpUrlToRepo}
mirror: true
# Create a project by importing it from a public project
importPublic:
type: gitlab:Project
properties:
importUrl: https://gitlab.example.com/repo.git
# Create a project by importing it from a public project and setup the pull mirror
importPublicWithMirror:
type: gitlab:Project
properties:
importUrl: https://gitlab.example.com/repo.git
mirror: true
# Create a project by importing it from a private project
importPrivateProject:
type: gitlab:Project
properties:
importUrl: https://gitlab.example.com/repo.git
importUrlUsername: user
importUrlPassword: pass
# Create a project by importing it from a private project and setup the pull mirror
importPrivateWithMirror:
type: gitlab:Project
properties:
importUrl: https://gitlab.example.com/repo.git
importUrlUsername: user
importUrlPassword: pass
mirror: true
# Create a project by importing it from a private project and provide credentials in `import_url`
# NOTE: only use this if you really must, use `import_url_username` and `import_url_password` whenever possible
# GitLab API will always return the `import_url` without credentials, therefore you must ignore the `import_url` for changes:
importPrivateIndex/projectProject:
type: gitlab:Project
properties:
importUrl: https://user:pass@gitlab.example.com/repo.git
variables:
peterParker:
fn::invoke:
Function: gitlab:getUser
Arguments:
username: peter_parker
Import
$ pulumi import gitlab:index/project:Project You can import a project state using `<resource> <id>`. The
id
can be whatever the get_single_project takes for its :id
value, so for example:
$ pulumi import gitlab:index/project:Project example richardc/example
NOTE: the import_url_username
and import_url_password
cannot be imported.
Constructors
Properties
Set to true if you want to treat skipped pipelines as if they finished with success.
Set the analytics access level. Valid values are disabled
, private
, enabled
.
Number of merge request approvals required for merging. Default is 0. This field does not work well in combination with the gitlab.ProjectApprovalRule
resource and is most likely gonna be deprecated in a future GitLab version (see this upstream epic). In the meantime we recommend against using this attribute and use gitlab.ProjectApprovalRule
instead.
Set to true
to archive the project instead of deleting on destroy. If set to true
it will entire omit the DELETE
operation.
Auto-cancel pending pipelines. This isn’t a boolean, but enabled/disabled.
Set whether auto-closing referenced issues on default branch.
Auto Deploy strategy. Valid values are continuous
, manual
, timed_incremental
.
Enable Auto DevOps for this project.
The hash of the avatar image. Use filesha256("path/to/avatar.png")
whenever possible. Note: this is used to trigger an update of the avatar. If it's not given, but an avatar is given, the avatar will be updated each time.
Test coverage parsing for the project. This is deprecated feature in GitLab 15.0.
The Git strategy. Defaults to fetch. Valid values are clone
, fetch
.
Set the builds access level. Valid values are disabled
, private
, enabled
.
The maximum amount of time, in seconds, that a job can run.
Custom Path to CI config file.
Default number of revisions for shallow cloning.
When a new deployment job starts, skip older deployment jobs that are still pending.
The role required to cancel a pipeline or job. Introduced in GitLab 16.8. Premium and Ultimate only. Valid values are developer
, maintainer
, no one
Use separate caches for protected branches.
Set the image cleanup policy for this project. Note: this field is sometimes named container_expiration_policy_attributes
in the GitLab Upstream API.
Set visibility of container registry, for this project. Valid values are disabled
, private
, enabled
.
Enable container registry for the project.
The default branch for the project.
A description of the project.
Disable email notifications.
Enable email notifications.
Set the environments access level. Valid values are disabled
, private
, enabled
.
The classification label for the project.
Set the feature flags access level. Valid values are disabled
, private
, enabled
.
The id of the project to fork. During create the project is forked and during an update the fork relation is changed.
Set the forking access level. Valid values are disabled
, private
, enabled
.
Enable group runners for this project.
For group-level custom templates, specifies ID of group from which all the custom project templates are sourced. Leave empty for instance-level templates. Requires usecustomtemplate to be true (enterprise edition).
Git URL to a repository to be imported. Together with mirror = true
it will setup a Pull Mirror. This can also be used together with forked_from_project_id
to setup a Pull Mirror for a fork. The fork takes precedence over the import. Make sure to provide the credentials in import_url_username
and import_url_password
. GitLab never returns the credentials, thus the provider cannot detect configuration drift in the credentials. They can also not be imported using pulumi import
. See the examples section for how to properly use it.
The password for the import_url
. The value of this field is used to construct a valid import_url
and is only related to the provider. This field cannot be imported using pulumi import
. See the examples section for how to properly use it.
The username for the import_url
. The value of this field is used to construct a valid import_url
and is only related to the provider. This field cannot be imported using pulumi import
. See the examples section for how to properly use it.
Set the infrastructure access level. Valid values are disabled
, private
, enabled
.
Create main branch with first commit containing a README.md file.
Set the issues access level. Valid values are disabled
, private
, enabled
.
Enable issue tracking for the project.
Sets the template for new issues in the project.
Disable or enable the ability to keep the latest artifact for this project.
Enable LFS for the project.
Template used to create merge commit message in merge requests. (Introduced in GitLab 14.5.)
Set the merge method. Valid values are merge
, rebase_merge
, ff
.
Enable or disable merge pipelines.
Set the merge requests access level. Valid values are disabled
, private
, enabled
.
Enable merge requests for the project.
Sets the template for new merge requests in the project.
Enable or disable merge trains. Requires merge_pipelines_enabled
to be set to true
to take effect.
Enable overwrite diverged branches for a mirrored project.
Enable trigger builds on pushes for a mirrored project.
Set the monitor access level. Valid values are disabled
, private
, enabled
.
For forked projects, target merge requests to this project. If false, the target will be the upstream project.
The namespace (group or user) of the project. Defaults to your user.
Set to true if you want allow merges only if all discussions are resolved.
Set to true if you want allow merges only if a pipeline succeeds.
Enable only mirror protected branches for a mirrored project.
Enable packages repository for the project.
Enable pages access control. Valid values are public
, private
, enabled
, disabled
.
Enable pipelines for the project. The pipelines_enabled
field is being sent as jobs_enabled
in the GitLab API calls.
Show link to create/view merge request when pushing from the command line
If true, jobs can be viewed by non-project members.
If true, jobs can be viewed by non-project members.
Push rules for the project.
Set the releases access level. Valid values are disabled
, private
, enabled
.
Enable Delete source branch
option by default for all new merge requests.
Set the repository access level. Valid values are disabled
, private
, enabled
.
Which storage shard the repository is on. (administrator only)
Allow users to request member access.
Set the requirements access level. Valid values are disabled
, private
, enabled
.
Automatically resolve merge request diffs discussions on lines changed with a push.
Allow only users with the Maintainer role to pass user-defined variables when triggering a pipeline.
Set the security and compliance access level. Valid values are disabled
, private
, enabled
.
Enable shared runners for this project.
If true
, the default behavior to wait for the default branch protection to be created is skipped. This is necessary if the current user is not an admin and the default branch protection is disabled on an instance-level. There is currently no known way to determine if the default branch protection is disabled on an instance-level for non-admin users. This attribute is only used during resource creation, thus changes are suppressed and the attribute cannot be imported.
Set the snippets access level. Valid values are disabled
, private
, enabled
.
Enable snippets for the project.
Template used to create squash commit message in merge requests. (Introduced in GitLab 14.6.)
Squash commits when merge request. Valid values are never
, always
, default_on
, or default_off
. The default value is default_off
. GitLab >= 14.1
The commit message used to apply merge request suggestions.
When used without usecustomtemplate, name of a built-in project template. When used with usecustomtemplate, name of a custom project template. This option is mutually exclusive with template_project_id
.
When used with usecustomtemplate, project ID of a custom project template. This is preferable to using templatename since templatename may be ambiguous (enterprise edition). This option is mutually exclusive with template_name
. See gitlab.GroupProjectFileTemplate
to set a project as a template project. If a project has not been set as a template, using it here will result in an error.
Use either custom instance or group (with groupwithprojecttemplatesid) project template (enterprise edition).
Set to public
to create a public project. Valid values are private
, internal
, public
.
Set the wiki access level. Valid values are disabled
, private
, enabled
.
Enable wiki for the project.