生成Git仓库地址ACS::GitCodeRepo

用途

生成用户指定的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 }}' .