Viewing docs for GitLab v9.10.0
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Viewing docs for GitLab v9.10.0
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
The gitlab.getArtifactFile data source allows downloading a single artifact file from a specific job in the latest successful pipeline for a given reference (branch, tag, or commit).
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
// Download a text artifact file from the latest successful pipeline
const config = gitlab.getArtifactFile({
project: "namespace/myproject",
job: "build-job",
ref: "main",
artifactPath: "config/settings.json",
});
export const configContent = config.then(config => config.content);
// Download a binary artifact file using base64 encoding
const binary = gitlab.getArtifactFile({
project: "namespace/myproject",
job: "build-job",
ref: "v1.0.0",
artifactPath: "dist/app.zip",
});
export const binaryContentBase64 = binary.then(binary => binary.contentBase64);
// Download artifact from a specific tag
const release = gitlab.getArtifactFile({
project: "12345",
job: "release-job",
ref: "v2.1.0",
artifactPath: "release-notes.txt",
});
// Download a larger artifact with custom size limit
const largeArtifact = gitlab.getArtifactFile({
project: "namespace/myproject",
job: "build-job",
ref: "main",
artifactPath: "dist/large-file.zip",
maxSizeBytes: 20971520,
});
import pulumi
import pulumi_gitlab as gitlab
# Download a text artifact file from the latest successful pipeline
config = gitlab.get_artifact_file(project="namespace/myproject",
job="build-job",
ref="main",
artifact_path="config/settings.json")
pulumi.export("configContent", config.content)
# Download a binary artifact file using base64 encoding
binary = gitlab.get_artifact_file(project="namespace/myproject",
job="build-job",
ref="v1.0.0",
artifact_path="dist/app.zip")
pulumi.export("binaryContentBase64", binary.content_base64)
# Download artifact from a specific tag
release = gitlab.get_artifact_file(project="12345",
job="release-job",
ref="v2.1.0",
artifact_path="release-notes.txt")
# Download a larger artifact with custom size limit
large_artifact = gitlab.get_artifact_file(project="namespace/myproject",
job="build-job",
ref="main",
artifact_path="dist/large-file.zip",
max_size_bytes=20971520)
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v9/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Download a text artifact file from the latest successful pipeline
config, err := gitlab.GetArtifactFile(ctx, &gitlab.GetArtifactFileArgs{
Project: "namespace/myproject",
Job: "build-job",
Ref: "main",
ArtifactPath: "config/settings.json",
}, nil)
if err != nil {
return err
}
ctx.Export("configContent", config.Content)
// Download a binary artifact file using base64 encoding
binary, err := gitlab.GetArtifactFile(ctx, &gitlab.GetArtifactFileArgs{
Project: "namespace/myproject",
Job: "build-job",
Ref: "v1.0.0",
ArtifactPath: "dist/app.zip",
}, nil)
if err != nil {
return err
}
ctx.Export("binaryContentBase64", binary.ContentBase64)
// Download artifact from a specific tag
_, err = gitlab.GetArtifactFile(ctx, &gitlab.GetArtifactFileArgs{
Project: "12345",
Job: "release-job",
Ref: "v2.1.0",
ArtifactPath: "release-notes.txt",
}, nil)
if err != nil {
return err
}
// Download a larger artifact with custom size limit
_, err = gitlab.GetArtifactFile(ctx, &gitlab.GetArtifactFileArgs{
Project: "namespace/myproject",
Job: "build-job",
Ref: "main",
ArtifactPath: "dist/large-file.zip",
MaxSizeBytes: pulumi.IntRef(20971520),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
// Download a text artifact file from the latest successful pipeline
var config = GitLab.GetArtifactFile.Invoke(new()
{
Project = "namespace/myproject",
Job = "build-job",
Ref = "main",
ArtifactPath = "config/settings.json",
});
// Download a binary artifact file using base64 encoding
var binary = GitLab.GetArtifactFile.Invoke(new()
{
Project = "namespace/myproject",
Job = "build-job",
Ref = "v1.0.0",
ArtifactPath = "dist/app.zip",
});
// Download artifact from a specific tag
var release = GitLab.GetArtifactFile.Invoke(new()
{
Project = "12345",
Job = "release-job",
Ref = "v2.1.0",
ArtifactPath = "release-notes.txt",
});
// Download a larger artifact with custom size limit
var largeArtifact = GitLab.GetArtifactFile.Invoke(new()
{
Project = "namespace/myproject",
Job = "build-job",
Ref = "main",
ArtifactPath = "dist/large-file.zip",
MaxSizeBytes = 20971520,
});
return new Dictionary<string, object?>
{
["configContent"] = config.Apply(getArtifactFileResult => getArtifactFileResult.Content),
["binaryContentBase64"] = binary.Apply(getArtifactFileResult => getArtifactFileResult.ContentBase64),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetArtifactFileArgs;
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) {
// Download a text artifact file from the latest successful pipeline
final var config = GitlabFunctions.getArtifactFile(GetArtifactFileArgs.builder()
.project("namespace/myproject")
.job("build-job")
.ref("main")
.artifactPath("config/settings.json")
.build());
ctx.export("configContent", config.content());
// Download a binary artifact file using base64 encoding
final var binary = GitlabFunctions.getArtifactFile(GetArtifactFileArgs.builder()
.project("namespace/myproject")
.job("build-job")
.ref("v1.0.0")
.artifactPath("dist/app.zip")
.build());
ctx.export("binaryContentBase64", binary.contentBase64());
// Download artifact from a specific tag
final var release = GitlabFunctions.getArtifactFile(GetArtifactFileArgs.builder()
.project("12345")
.job("release-job")
.ref("v2.1.0")
.artifactPath("release-notes.txt")
.build());
// Download a larger artifact with custom size limit
final var largeArtifact = GitlabFunctions.getArtifactFile(GetArtifactFileArgs.builder()
.project("namespace/myproject")
.job("build-job")
.ref("main")
.artifactPath("dist/large-file.zip")
.maxSizeBytes(20971520)
.build());
}
}
variables:
# Download a text artifact file from the latest successful pipeline
config:
fn::invoke:
function: gitlab:getArtifactFile
arguments:
project: namespace/myproject
job: build-job
ref: main
artifactPath: config/settings.json
# Download a binary artifact file using base64 encoding
binary:
fn::invoke:
function: gitlab:getArtifactFile
arguments:
project: namespace/myproject
job: build-job
ref: v1.0.0
artifactPath: dist/app.zip
# Download artifact from a specific tag
release:
fn::invoke:
function: gitlab:getArtifactFile
arguments:
project: '12345'
job: release-job
ref: v2.1.0
artifactPath: release-notes.txt
# Download a larger artifact with custom size limit
largeArtifact:
fn::invoke:
function: gitlab:getArtifactFile
arguments:
project: namespace/myproject
job: build-job
ref: main
artifactPath: dist/large-file.zip
maxSizeBytes: 2.097152e+07
outputs:
# Use the artifact content
configContent: ${config.content}
binaryContentBase64: ${binary.contentBase64}
Using getArtifactFile
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getArtifactFile(args: GetArtifactFileArgs, opts?: InvokeOptions): Promise<GetArtifactFileResult>
function getArtifactFileOutput(args: GetArtifactFileOutputArgs, opts?: InvokeOptions): Output<GetArtifactFileResult>def get_artifact_file(artifact_path: Optional[str] = None,
job: Optional[str] = None,
max_size_bytes: Optional[int] = None,
project: Optional[str] = None,
ref: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetArtifactFileResult
def get_artifact_file_output(artifact_path: Optional[pulumi.Input[str]] = None,
job: Optional[pulumi.Input[str]] = None,
max_size_bytes: Optional[pulumi.Input[int]] = None,
project: Optional[pulumi.Input[str]] = None,
ref: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetArtifactFileResult]func GetArtifactFile(ctx *Context, args *GetArtifactFileArgs, opts ...InvokeOption) (*GetArtifactFileResult, error)
func GetArtifactFileOutput(ctx *Context, args *GetArtifactFileOutputArgs, opts ...InvokeOption) GetArtifactFileResultOutput> Note: This function is named GetArtifactFile in the Go SDK.
public static class GetArtifactFile
{
public static Task<GetArtifactFileResult> InvokeAsync(GetArtifactFileArgs args, InvokeOptions? opts = null)
public static Output<GetArtifactFileResult> Invoke(GetArtifactFileInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetArtifactFileResult> getArtifactFile(GetArtifactFileArgs args, InvokeOptions options)
public static Output<GetArtifactFileResult> getArtifactFile(GetArtifactFileArgs args, InvokeOptions options)
fn::invoke:
function: gitlab:index/getArtifactFile:getArtifactFile
arguments:
# arguments dictionaryThe following arguments are supported:
- Artifact
Path string - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - Job string
- The name of the job.
- Project string
- The ID or URL-encoded path of the project.
- Ref string
- The name of the branch, tag, or commit SHA.
- Max
Size intBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- Artifact
Path string - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - Job string
- The name of the job.
- Project string
- The ID or URL-encoded path of the project.
- Ref string
- The name of the branch, tag, or commit SHA.
- Max
Size intBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact
Path String - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - job String
- The name of the job.
- project String
- The ID or URL-encoded path of the project.
- ref String
- The name of the branch, tag, or commit SHA.
- max
Size IntegerBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact
Path string - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - job string
- The name of the job.
- project string
- The ID or URL-encoded path of the project.
- ref string
- The name of the branch, tag, or commit SHA.
- max
Size numberBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact_
path str - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - job str
- The name of the job.
- project str
- The ID or URL-encoded path of the project.
- ref str
- The name of the branch, tag, or commit SHA.
- max_
size_ intbytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact
Path String - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - job String
- The name of the job.
- project String
- The ID or URL-encoded path of the project.
- ref String
- The name of the branch, tag, or commit SHA.
- max
Size NumberBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
getArtifactFile Result
The following output properties are available:
- Artifact
Path string - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - Content string
- The content of the artifact file as a UTF-8 string. Use
content_base64for binary files. - Content
Base64 string - The content of the artifact file as a base64-encoded string. Useful for binary files.
- Id string
- The ID of this datasource. In the format
<project>:<ref>:<job>:<artifact_path>. - Job string
- The name of the job.
- Project string
- The ID or URL-encoded path of the project.
- Ref string
- The name of the branch, tag, or commit SHA.
- Max
Size intBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- Artifact
Path string - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - Content string
- The content of the artifact file as a UTF-8 string. Use
content_base64for binary files. - Content
Base64 string - The content of the artifact file as a base64-encoded string. Useful for binary files.
- Id string
- The ID of this datasource. In the format
<project>:<ref>:<job>:<artifact_path>. - Job string
- The name of the job.
- Project string
- The ID or URL-encoded path of the project.
- Ref string
- The name of the branch, tag, or commit SHA.
- Max
Size intBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact
Path String - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - content String
- The content of the artifact file as a UTF-8 string. Use
content_base64for binary files. - content
Base64 String - The content of the artifact file as a base64-encoded string. Useful for binary files.
- id String
- The ID of this datasource. In the format
<project>:<ref>:<job>:<artifact_path>. - job String
- The name of the job.
- project String
- The ID or URL-encoded path of the project.
- ref String
- The name of the branch, tag, or commit SHA.
- max
Size IntegerBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact
Path string - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - content string
- The content of the artifact file as a UTF-8 string. Use
content_base64for binary files. - content
Base64 string - The content of the artifact file as a base64-encoded string. Useful for binary files.
- id string
- The ID of this datasource. In the format
<project>:<ref>:<job>:<artifact_path>. - job string
- The name of the job.
- project string
- The ID or URL-encoded path of the project.
- ref string
- The name of the branch, tag, or commit SHA.
- max
Size numberBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact_
path str - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - content str
- The content of the artifact file as a UTF-8 string. Use
content_base64for binary files. - content_
base64 str - The content of the artifact file as a base64-encoded string. Useful for binary files.
- id str
- The ID of this datasource. In the format
<project>:<ref>:<job>:<artifact_path>. - job str
- The name of the job.
- project str
- The ID or URL-encoded path of the project.
- ref str
- The name of the branch, tag, or commit SHA.
- max_
size_ intbytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
- artifact
Path String - Path to the artifact file within the job's artifacts archive. This path is relative to the archive contents (not the local filesystem). Ensure each
gitlab.getArtifactFiledata source in your configuration uses a unique artifact_path to avoid ambiguity. - content String
- The content of the artifact file as a UTF-8 string. Use
content_base64for binary files. - content
Base64 String - The content of the artifact file as a base64-encoded string. Useful for binary files.
- id String
- The ID of this datasource. In the format
<project>:<ref>:<job>:<artifact_path>. - job String
- The name of the job.
- project String
- The ID or URL-encoded path of the project.
- ref String
- The name of the branch, tag, or commit SHA.
- max
Size NumberBytes - Maximum bytes to read from the artifact. Defaults to 10MB (10485760 bytes).
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlabTerraform Provider.
Viewing docs for GitLab v9.10.0
published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
