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.
fromprefect_gitlabimportGitLabRepository# public GitLab repositorypublic_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 repositorybranch_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 repositorybranch_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 repositoryprivate_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()