用途
產生使用者指定的github/gitee倉庫代碼的地址
文法
Tasks:
- Name: GitCodeRepo
Action: ACS::GitCodeRepo
Description: 指定代碼源,產生臨時授權連結
Properties:
Platform: github # 必填,平台,可選github/gitee
Owner: your-github-user-name # 必填,github賬戶名
Organization: your-github-organization # 可選,組織名稱
Repository: your-github-repository # 必填,倉庫名稱
Outputs:
authorizedUrl: # 輸出指定的github/gitee倉庫代碼的地址
Type: String
ValueSelector: AuthorizedUrl # jq的選取器文法,以task的返回作為JSON輸入,jq的文法請參考 https://stedolan.github.io/jq
說明
使用時需要完成授權:請在建立模板或執行時注意相關提示,按要求完成授權即可使用
輸出的結果是一個url,如:
https://your_***@github.com/owner/repo
可用於拉取代碼,如:
git clone https://your_***@github.com/owner/repo .
樣本
FormatVersion: OOS-2019-06-01
Parameters:
instanceId:
Description: the instance id that you will start.
Type: String
Tasks:
- Name: GitCodeRepo
Action: ACS::GitCodeRepo
Description: 指定代碼源,產生臨時授權連結
Properties:
Platform: github
Owner: your-github-user-name
Organization: your-github-organization
Repository: your-github-repository
Outputs:
authorizedUrl:
Type: String
ValueSelector: AuthorizedUrl
- Name: CloneCode
Action: ACS::ECS::RunCommand
Description:
en: Execute clone code command
zh-cn: 執行clone代碼命令
Properties:
instanceId: '{{ instanceId }}'
commandType: RunShellScript
commandContent: |-
git clone '{{ GitCodeRepo.authorizedUrl }}' .