Catatan
Pengembangan aktif proyek ini telah bergerak dalam prefecthq/prefek. Kode dapat ditemukan di sini dan dokumentasi di sini. Harap buka masalah dan PR terhadap prefecthq/prefek alih -alih repositori ini.
Integrasi prefek untuk bekerja dengan repositori bitbucket.
Membutuhkan pemasangan Python 3.7+.
Kami merekomendasikan penggunaan Manajer Lingkungan Virtual Python seperti Pipenv, Conda atau VirtualEnv.
Tugas -tugas ini dirancang untuk bekerja dengan Prefek 2.0. Untuk informasi lebih lanjut tentang cara menggunakan prefek, silakan merujuk ke dokumentasi prefek.
Instal prefect-bitbucket
dengan pip
:
PIP menginstal prefek-bitbucket
Kemudian, daftar untuk melihat blok pada cloud prefek:
Register blok prefek -m prefek_bitbucket
Catatan, untuk menggunakan metode load
pada blok, Anda harus sudah memiliki dokumen blok yang disimpan melalui kode atau disimpan melalui UI.
Dari prefek impor flowFrom prefect_bitbucket.credentials impor bitbucketcredentials@flowdef use_stored_bitbucket_creds_flow (): bitbucket_credentials_block = bitbucketcredentials.load ("block_name") return bitbucket_credentials_block_loade_stored_stored (block_name ") return bitbucket_credockeSe.block_blocke (" block_name ")
Dari prefek impor flow dari prefect_bitbucket.credentials impor bitbucketcredentials@flowdef create_new_bitbucket_creds_flow (): bitbucket_credentials_block = bitbucketcredentials (token = "my-token", username = "my-username")
dari prefect_bitbucket Impor bitbucketrepositorypublic_repo = "https://bitbucket.org/my-workspace/my-repository.git"bet_buckoCoCository kecepatan (dalam tab blok) public_bitbucket_block.save ("my-bitbucket-block")
dari prefect_bitbucket impor bitbucketrepositorypublic_repo = "https://bitbucket.org/my-workspace/my-repository.git"#-tugetory (bitbucketorory (bitbucketorory (bitbucketorory (Bitbucketorory (Bitbucketorory (Bitbucketorory (Bitbucketorory (Bitbucketorory (Bitbucketorory (Bitbucketorory (Bitbucketorory," master "repository = public_repo)# menyimpan blok bitbucketrepository ke ruang kerja prefek Anda (di tab blok) cabang_bitbucket_block.save (" my-bitbucket-block-block ")
Dari prefect_bitbucket Impor bitbucketcredentials, bitbucketrepository# untuk repo pribadi, kita perlu kredensial untuk mengakses itbitbucket_credentials_block = bitbucketcredentials (token = "my-token", username = "my-username"# opsional)# bitbucketcred (my-token ", my-username"# opsional)# bitbucketcred (my uSername = "my-username"# opsional)# bitbucketcred tab blok) bitbucket_credentials_block.save (name = "my-bitbucket-credentials-block")# membuat repositori bitbucket pribadi bitbucketrepository blockprivate_repo = "https:/bitbucket.org/boPospospoCosor.goPository. Bitbucketrepository (repository = private_repo, bitbucket_credentials = bitbucket_credentials_block)# menyimpan blok bitbucketrepository ke ruang kerja prefek Anda (di tab blok) private_bitbucket_block.save (name = "my-private-bitbucket
dari prefect_bitbucket Impor bitbucketcredentials, bitbucketrepository# memuat bitbucketcredentials yang sudah ada sebelumnya blockbitbucketcredentials.load ("my-bitbucketpredentials ory .git "private_bitbucket_block = bitbucketrepository (repository = private_repo, bitbucket_credentials = bitbucket_credentials_block)# menghemat blok bitbucketrepository ke ruang kerja prefek Anda (di tab blok) private_bitbucket_bucket.save (" di Tab Blocks) Private-BOBUCKET_BUCKET (NAMA = "
!!! Info "Perbedaan Antara Bitbucket Server dan Bitbucket Cloud"
For Bitbucket Cloud, only set the `token` to authenticate. For Bitbucket Server, set both the `token` and the `username`.
Jika Anda menemukan bug apa pun saat menggunakan prefect-bitbucket
, jangan ragu untuk membuka masalah di repositori prefek-bitbucket.
Jika Anda memiliki pertanyaan atau masalah saat menggunakan prefect-bitbucket
, Anda dapat menemukan bantuan di forum wacana prefek atau komunitas prefek Slack.
Jangan ragu untuk ️ atau tonton prefect-bitbucket
untuk pembaruan juga!
Jika Anda ingin menginstal versi prefect-bitbucket
untuk pengembangan, klon repositori dan melakukan instalasi yang dapat diedit dengan pip
:
git clone https://github.com/prefecthq/prefect-bitbucket.gitcd prefect-bitbucket/ Pip Instal -e ". [dev]"# instal instalasi instalasi hookspre pra-komit pra-komit