The prefect-gitlab library makes it easy to interact with GitLab repositories and credentials.
prefect-gitlab
The following command will install a version of prefect-gitlab
compatible with your installed version of prefect
.
If you don’t already have prefect
installed, it will install the newest version of prefect
as well.
Upgrade to the latest versions of prefect
and prefect-gitlab
:
Register the block types in the prefect-gitlab
module to make them available for use.
In the examples below, you create blocks with Python code. Alternatively, blocks can be created through the Prefect UI.
To create a deployment where the flow code is stored in a private GitLab repository, you can use the GitLabCredentials
block.
A deployment can use flow code stored in a GitLab repository without using this library in either of the following cases:
Code to create a GitLab Credentials block:
Use the credentials block you created above to pass the GitLab access token during deployment creation. The code below assumes there’s flow code in your private GitLab repository.
Alternatively, if you use a prefect.yaml
file to create the deployment, reference the GitLab Credentials block in the pull
step:
The code below shows how to reference a particular branch or tag of a GitLab repository.
Exclude the access_token
field if the repository is public and exclude the reference
field to use the default branch.
Use the newly created block to interact with the GitLab repository.
For example, download the repository contents with the .get_directory()
method like this:
For assistance using GitLab, consult the GitLab documentation.
Refer to the prefect-gitlab
SDK documentation to explore all the capabilities of the prefect-gitlab
library.
The prefect-gitlab library makes it easy to interact with GitLab repositories and credentials.
prefect-gitlab
The following command will install a version of prefect-gitlab
compatible with your installed version of prefect
.
If you don’t already have prefect
installed, it will install the newest version of prefect
as well.
Upgrade to the latest versions of prefect
and prefect-gitlab
:
Register the block types in the prefect-gitlab
module to make them available for use.
In the examples below, you create blocks with Python code. Alternatively, blocks can be created through the Prefect UI.
To create a deployment where the flow code is stored in a private GitLab repository, you can use the GitLabCredentials
block.
A deployment can use flow code stored in a GitLab repository without using this library in either of the following cases:
Code to create a GitLab Credentials block:
Use the credentials block you created above to pass the GitLab access token during deployment creation. The code below assumes there’s flow code in your private GitLab repository.
Alternatively, if you use a prefect.yaml
file to create the deployment, reference the GitLab Credentials block in the pull
step:
The code below shows how to reference a particular branch or tag of a GitLab repository.
Exclude the access_token
field if the repository is public and exclude the reference
field to use the default branch.
Use the newly created block to interact with the GitLab repository.
For example, download the repository contents with the .get_directory()
method like this:
For assistance using GitLab, consult the GitLab documentation.
Refer to the prefect-gitlab
SDK documentation to explore all the capabilities of the prefect-gitlab
library.