Creates an image build rule for a repository.

Request information

Request line

PUT /repos/[RepoNamespace]/[RepoName]/rules HTTP/1.1

Request line parameters

Parameter Type Required Description
RepoNamespace String Yes The namespace to which the image repository belongs. The name of the namespace must be 2 to 30 characters in length, and can contain lowercase letters, digits, hyphens (-), and underscores (_). It must not start with a hyphen or an underscore.
RepoName String Yes The name of the repository. The name must be 1 to 64 characters in length, and can contain lowercase letters, digits, hyphens (-), and underscores (_). It must not start with a hyphen or an underscore.

Operation-specific request headers

None.

Request body

Request Body:

{
    "BuildRule": {
        "PushType": "String" //This parameter is required. Valid values: GIT_BRANCH and GIT_TAG.
        "PushName": "String" //This parameter is required.
        "DockerfileLocation": "String" //This parameter is required. The value of this parameter must be 1 to 128 characters in length.
        "DockerfileName": "String" //This parameter is required. The value of this parameter must be 4 to 64 characters in length.
        "Tag": "String" //This parameter is required.
    }
}

Request body parameters

Parameter Type Required Description
PushType String Yes The type of code branch in the source code repository based on which an image is built. Valid values: GIT_BRANCH and GIT_TAG.
PushName String Yes The name of code branch in the source code repository based on which an image is built.
DockerfileLocation String Yes The path of the Dockerfile in the source code repository based on which an image is built. The value of this parameter must be 1 to 128 characters in length.
DockerfileName String No The name of the Dockerfile in the source code repository based on which an image is built. The value of this parameter must be 4 to 64 characters in length.
Tag String Yes The image version.

Response information

Response line

HTTP/1.1 200 OK

Operation-specific response headers

None.

Response body

{
    "data": {
        "buildRuleId": Long
    },
    "requestId": "String"
}

Examples

Sample requests

PUT /repos/[RepoNamespace]/[RepoName]/rules HTTP/1.1
<Common request headers>

{
    "BuildRule": {
        "PushType": "GIT_BRANCH",
        "PushName": "master",
        "DockerfileLocation": "/",
        "DockerfileName": "Dockerfile",
        "ImageTag": "v1",
        "Tag": "v1"
    }
}

Sample responses

HTTP/1.1 200 OK
<Common response headers>

{
    "data": {
        "buildRuleId": 129304
    },
    "requestId": "26351387-EB18-48CA-9B73-20588A58A49C"
}