Note
Active development of this project has moved within PrefectHQ/prefect. The code can be found here and documentation here. Please open issues and PRs against PrefectHQ/prefect instead of this repository.
prefect-gitlab
is a Prefect collection for working with GitLab repositories.
Requires an installation of Python 3.8 or higher.
We recommend using a Python virtual environment manager such as pipenv, conda, or virtualenv.
This integration 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.
Install prefect-gitlab
with pip
:
pip install prefect-gitlab
Then, register the block types) in this integration to view the storage block type on Prefect Cloud:
prefect block register -m prefect_gitlab
Note, to use the load
method on a block, you must already have a block document saved.
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()
# Get all history of a specific branch or tag of a GitLab repository
branch_gitlab_block = GitLabRepository(
name="my-gitlab-block",
reference="branch-or-tag-name",
git_depth=None,
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()
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:
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 the Prefect Slack community.
Feel free to ⭐️ or watch prefect-gitlab
for updates!
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