[英]tagging releases in ansible and repo name
我之前使用語義標簽來標記我的版本,但現在我有一個要求,即每個版本都將附加一個名稱和編號,例如 rel-1.0.1、rel-1.0.2 ......所以如果我做對了我不能再使用這個庫了,因為我需要專門控制標簽。 所以我使用ansible,我發現了這個很酷的頁面: https : //docs.ansible.com/ansible/latest/modules/github_release_module.html
和
- name: Create a new release
github_release:
token: tokenabc1234567890
user: testuser
repo: testrepo
action: create_release
tag: test
target: master
name: My Release
body: Some description
現在我很困惑。 在 repo 名稱中,如果我的 repo 是這樣的:git@github.mycompany.com:test/test-backend.git
那么如果我只是將 test-backend.git 放在 repo name 部分,那將如何解決和工作? 我不應該放完整路徑嗎?
從github3.py 的文檔看來,必須使用專用方法github.enterprise_login(url="https://github.mycompany.com", ...)
遺憾的是 v2.9.5 不支持
據我所知,您唯一的辦法是將github_release.py
復制到您的劇本library
文件夾中,如精美手冊所述,並修補模塊以接受server_url
屬性,例如
--- a/github_release.py 2020-01-20 13:12:06.000000000 -0800
+++ b/github_release.py 2020-01-20 13:12:06.000000000 -0800
@@ -145,6 +145,7 @@
def main():
module = AnsibleModule(
argument_spec=dict(
+ server_url=dict(type='str', required=False),
repo=dict(required=True),
user=dict(required=True),
password=dict(no_log=True),
@@ -168,6 +169,7 @@
module.fail_json(msg=missing_required_lib('github3.py >= 1.0.0a3'),
exception=GITHUB_IMP_ERR)
+ server_url = module.params['server_url']
repo = module.params['repo']
user = module.params['user']
password = module.params['password']
@@ -182,12 +184,17 @@
# login to github
try:
+ login_mth = github3.login
+ login_kwargs = {}
+ if server_url:
+ login_mth = github3.enterprise_login
+ login_kwargs['url'] = server_url
if password:
- gh_obj = github3.login(user, password=password)
+ login_kwargs['username'] = user
+ login_kwargs['password'] = password
elif login_token:
- gh_obj = github3.login(token=login_token)
- else:
- gh_obj = github3.GitHub()
+ login_kwargs['token'] = login_token
+ gh_obj = login_mth(**login_kwargs)
# test if we're actually logged in
if password or login_token:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.