All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::PAI::CodeSource

更新时间:Feb 19, 2025

ALIYUN::PAI::CodeSource is used to create a code build in Platform for AI (PAI).

Syntax

{
  "Type": "ALIYUN::PAI::CodeSource",
  "Properties": {
    "Accessibility": String,
    "CodeRepo": String,
    "DisplayName": String,
    "MountPath": String,
    "WorkspaceId": String,
    "CodeRepoAccessToken": String,
    "CodeCommit": String,
    "CodeBranch": String,
    "CodeRepoUserName": String,
    "Description": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Accessibility

String

Yes

Yes

The visible scale of the code build.

Valid values:

  • PUBLIC: The code build is visible to all users in the current workspace.

  • PRIVATE: The code build is visible only to you and the administrators in the current workspace.

CodeRepo

String

Yes

Yes

The address of the code repository.

None.

DisplayName

String

Yes

Yes

The name of the code build.

None.

MountPath

String

Yes

Yes

The local mount path of the code.

None.

WorkspaceId

String

Yes

No

The ID of the workspace.

None.

CodeRepoAccessToken

String

No

Yes

The token that is used to access the code repository.

None.

CodeCommit

String

No

Yes

The ID of the code commit.

None.

CodeBranch

String

No

Yes

The branch of the code repository.

None.

CodeRepoUserName

String

No

Yes

The username that is used to access the code repository.

None.

Description

String

No

Yes

The description of the code build.

None.

Return values

Fn::GetAtt

  • CodeRepo: the address of the code repository.

  • Description: the description of the code build.

  • Accessibility: the visible scale of the code build.

  • CreateTime: the creation time of the code build.

  • WorkspaceId: the ID of the workspace.

  • CodeBranch: the branch of the code repository.

  • MountPath: the local mount path of the code.

  • CodeSourcesId: the ID of the code build.

  • CodeRepoAccessToken: the token that is used to access the code repository.

  • GmtModifyTime: the modification time of the code build.

  • UserId: the ID of the creator account of the code build.

  • CodeCommit: the ID of the code commit.

  • DisplayName: the name of the code build.

  • CodeRepoUserName: the username that is used to access the code repository.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters: {}
Resources:
  ExtensionResource:
    Type: ALIYUN::PAI::CodeSource
    Properties:
      MountPath: /root/code/
      DisplayName: demo1893
      CodeRepo: https://github.com/aliyun/Resource-Orchestration-Service-Cloud-Development-Kit.git
      Accessibility: PRIVATE
      WorkspaceId: '17283523466333'
      Description: test code desc.
      CodeBranch: master
Outputs:
  CodeRepo:
    Description: Code repository address.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CodeRepo
  Description:
    Description: A detailed description of the code configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Description
  Accessibility:
    Description: Visibility of the code configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Accessibility
  CreateTime:
    Description: The creation time of the code.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CreateTime
  WorkspaceId:
    Description: The ID of the workspace.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - WorkspaceId
  CodeBranch:
    Description: Code repository branch.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CodeBranch
  MountPath:
    Description: The local Mount Directory of the code.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - MountPath
  CodeSourcesId:
    Description: The ID of the created code configuration.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CodeSourcesId
  CodeRepoAccessToken:
    Description: The Token used to access the code repository.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CodeRepoAccessToken
  GmtModifyTime:
    Description: Code configuration modification time. The time format is iso8601.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - GmtModifyTime
  UserId:
    Description: The ID of the creator of the code configuration source.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - UserId
  CodeCommit:
    Description: The code CommitId.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CodeCommit
  DisplayName:
    Description: Code source configuration name.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - DisplayName
  CodeRepoUserName:
    Description: The user name of the code repository.
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - CodeRepoUserName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::PAI::CodeSource",
      "Properties": {
        "MountPath": "/root/code/",
        "DisplayName": "demo1893",
        "CodeRepo": "https://github.com/aliyun/Resource-Orchestration-Service-Cloud-Development-Kit.git",
        "Accessibility": "PRIVATE",
        "WorkspaceId": "17283523466333",
        "Description": "test code desc.",
        "CodeBranch": "master"
      }
    }
  },
  "Outputs": {
    "CodeRepo": {
      "Description": "Code repository address.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CodeRepo"
        ]
      }
    },
    "Description": {
      "Description": "A detailed description of the code configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Description"
        ]
      }
    },
    "Accessibility": {
      "Description": "Visibility of the code configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Accessibility"
        ]
      }
    },
    "CreateTime": {
      "Description": "The creation time of the code.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CreateTime"
        ]
      }
    },
    "WorkspaceId": {
      "Description": "The ID of the workspace.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "WorkspaceId"
        ]
      }
    },
    "CodeBranch": {
      "Description": "Code repository branch.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CodeBranch"
        ]
      }
    },
    "MountPath": {
      "Description": "The local Mount Directory of the code.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "MountPath"
        ]
      }
    },
    "CodeSourcesId": {
      "Description": "The ID of the created code configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CodeSourcesId"
        ]
      }
    },
    "CodeRepoAccessToken": {
      "Description": "The Token used to access the code repository.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CodeRepoAccessToken"
        ]
      }
    },
    "GmtModifyTime": {
      "Description": "Code configuration modification time. The time format is iso8601.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "GmtModifyTime"
        ]
      }
    },
    "UserId": {
      "Description": "The ID of the creator of the code configuration source.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "UserId"
        ]
      }
    },
    "CodeCommit": {
      "Description": "The code CommitId.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CodeCommit"
        ]
      }
    },
    "DisplayName": {
      "Description": "Code source configuration name.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "DisplayName"
        ]
      }
    },
    "CodeRepoUserName": {
      "Description": "The user name of the code repository.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "CodeRepoUserName"
        ]
      }
    }
  }
}