Creates a build rule of an image repository.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateRepoBuildRule

The operation that you want to perform. Set the value to CreateRepoBuildRule.

RegionId String Yes cn-shanghai

The region ID of the image repository.

InstanceId String Yes cri-xkx6vujuhay0****

The ID of the instance.

RepoId String Yes crr-8dz3aedjqlmk****

The ID of the image repository.

DockerfileLocation String Yes /

The path to the Dockerfile.

DockerfileName String Yes Dockerfile

The name of the Dockerfile.

PushType String Yes GIT_BRANCH

The type of push that triggers the build rule. Valid values:

  • GIT_TAG: tag push
  • GIT_BRANCH: branch push
PushName String Yes master

The name of the push that triggers the build rule.

ImageTag String Yes v0.9.5

The tag of the image.

BuildArgs.N String No UserName=Test

Build argument N.

Platforms.N String No linux/amd64

Architecture N for building the repository. Valid values:

  • linux/amd64
  • linux/arm64
  • linux/386
  • linux/arm/v7
  • inux/arm/v6

Default value: linux/amd64

Response parameters

Parameter Type Example Description
Code String success

The return value.

IsSuccess Boolean true

Indicates whether the request is successful. Valid values:

  • true: The request is successful.
  • false: The request fails.
RequestId String 4CE1F661-75DD-4EBD-A4AD-057B26834ABB

The ID of the request.

BuildRuleId String crbr-ly77w5i3t31f****

The ID of the repository build rule.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateRepoBuildRule
&InstanceId=cri-xkx6vujuhay0****
&RepoId=crr-8dz3aedjqlmk****
&DockerfileLocation=/
&DockerfileName=Dockerfile
&PushType=GIT_BRANCH
&PushName=master
&ImageTag=v0.9.5
&BuildArgs=["UserName=Test"]
&Platforms=["linux/amd64"]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateRepoBuildRuleResponse>
    <Code>success</Code>
    <IsSuccess>true</IsSuccess>
    <RequestId>4CE1F661-75DD-4EBD-A4AD-057B26834ABB</RequestId>
    <BuildRuleId>crbr-ly77w5i3t31f****</BuildRuleId>
</CreateRepoBuildRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Code" : "success",
  "IsSuccess" : true,
  "RequestId" : "4CE1F661-75DD-4EBD-A4AD-057B26834ABB",
  "BuildRuleId" : "crbr-ly77w5i3t31f****"
}

Error codes

For a list of error codes, visit the API Error Center.