prefect-gitlab
Welcome!
prefect-gitlab
is a Prefect collection for working with GitLab repositories.
Getting Started
Python setup
Requires an installation of Python 3.7+.
We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
This collection is designed to work with Prefect 2.3.0 or higher. For more information about how to use Prefect, please refer to the Prefect documentation.
Installation
Install prefect-gitlab
with pip
:
pip install prefect-gitlab
Then, register to view the storage block on Prefect Cloud:
prefect block register -m prefect_gitlab
Note, to use the load
method on Blocks, you must already have a block document saved through code or saved through the UI.
Creating a GitLab storage block
In Python
from prefect_gitlab import GitLabRepository
# public GitLab repository
public_gitlab_block = GitLabRepository(
name="my-gitlab-block",
repository="https://gitlab.com/testing/my-repository.git"
)
public_gitlab_block.save()
# specific branch or tag of a GitLab repository
branch_gitlab_block = GitLabRepository(
name="my-gitlab-block",
reference="branch-or-tag-name"
repository="https://gitlab.com/testing/my-repository.git"
)
branch_gitlab_block.save()
# private GitLab repository
private_gitlab_block = GitLabRepository(
name="my-private-gitlab-block",
repository="https://gitlab.com/testing/my-repository.git",
access_token="YOUR_GITLAB_PERSONAL_ACCESS_TOKEN"
)
private_gitlab_block.save()
In the UI
Click on the Blocks menu, then click the + button in the page header to open the block catalog:
Then, find the GitLab block and click the Add button:
Finally, enter your repository information in the form and click Create:
Resources
If you encounter any bugs while using prefect-gitlab
, feel free to open an issue in the prefect-gitlab repository.
If you have any questions or issues while using prefect-gitlab
, you can find help in either the Prefect Discourse forum or the Prefect Slack community.
Feel free to ⭐️ or watch prefect-gitlab
for updates too!
Development
If you'd like to install a version of prefect-gitlab
for development, clone the repository and perform an editable install with pip
:
git clone https://github.com/prefecthq/prefect-gitlab.git
cd prefect-gitlab/
pip install -e ".[dev]"
# Install linting pre-commit hooks
pre-commit install