Create a build
Create a build.
Query parameters
callbackUrlstringOptional
callback URL
Body
Build modification model
accountSeqintegerOptionalExample:
Account number (your system's account number)
1
autotagUseYnstringOptionalExample:
automatic tagging usage status (enabled: Y, unused: N)
N
autotagPrefixstringOptionalExample:
test
autotagSeqTypestringOptionalExample:
autotag sequence number type('DATETIME' or 'SEQUENCE')
DATETIME
descriptionstringOptionalExample:
build test
editTypestringRequiredExample:
Edit type (New: N)
N
externalRegistrySeqintegerOptionalExample:
External registry number (number of the external registry to store build images).
0
imageNamestringOptionalExample:
Image name (name of the image to be built)
build-api-test-gradle
registryNamestringOptionalExample:
Registry name (name of the registry to store the build image)
dev
registryProjectIdintegerOptionalExample:
Registry project ID (project ID of the registry to store the build image)
27
tagNamestringOptionalExample:
Image tag name (tag name of the image to be built)
8u292-rmsoft
Responses
200
OK
*/*
post
POST /v1/build HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 2220
{
"accountSeq": 1,
"autotagUseYn": "N",
"autotagPrefix": "test",
"autotagSeqType": "DATETIME",
"buildSteps": [
{
"stepType": "CODE_DOWN",
"useFlag": true,
"buildStepSeq": 0,
"buildStepConfig": {
"stepType": "CODE_DOWN",
"repositoryType": "GIT",
"stepTitle": "Code repository task",
"repositoryUrl": "github.com/codefresh-contrib/gradle-sample-app.git",
"branchName": "master",
"codeSaveDir": "repo",
"commonType": "COMMON",
"protocolType": "https"
},
"stepOrder": 1
},
{
"stepType": "USER_TASK",
"useFlag": true,
"buildStepSeq": 1,
"buildStepConfig": {
"stepType": "USER_TASK",
"stepTitle": "user task",
"cmd": [
"mvn",
"clean",
"install"
],
"workingDir": "/build",
"imageName": "build-api-test-gradle",
"imageTag": "8u292-rmsoft",
"dockerVolumeMountVOList": [
{
"containerPath": "/build",
"hostPath": "$PWD/repo"
}
]
},
"stepOrder": 2
},
{
"stepType": "FTP",
"useFlag": true,
"buildStepSeq": 2,
"buildStepConfig": {
"stepType": "FTP",
"stepTitle": "file(FTP) task",
"url": "test-ftp.gradle-sample-test",
"ftpType": "SFTP",
"username": "runapps",
"sourceFiles": "/data/dataset",
"remoteDirectory": "data/gradle-sample-dataset",
"ftpExecType": "DIR_FTP_DOWN"
},
"stepOrder": 1
},
{
"stepType": "HTTP",
"useFlag": true,
"buildStepSeq": 3,
"buildStepConfig": {
"stepType": "CODE_DOWN",
"repositoryType": "GIT",
"stepTitle": "Source Download",
"repositoryUrl": "github.com/codefresh-contrib/gradle-sample-app.git",
"branchName": "master",
"codeSaveDir": "repo",
"commonType": "COMMON",
"protocolType": "https"
},
"stepOrder": 3
},
{
"stepType": "SHELL",
"useFlag": true,
"buildStepSeq": 4,
"buildStepConfig": {
"stepType": "SHELL",
"stepTitle": "Script task.",
"shellType": "SCRIPT",
"command": "echo \">>> move app source \"\ncd repo\n\necho \">>> node_modules Compression\"\ntar -cf node_modules.tar node_modules/\n\nls -al"
},
"stepOrder": 4
},
{
"stepType": "CREATE_IMAGE",
"useFlag": true,
"buildStepSeq": 5,
"buildStepConfig": {
"stepType": "CREATE_IMAGE",
"buildStepSeq": 5,
"exitCode": "0",
"dockerFileType": "CONTENTS",
"stepTitle": "Image Build task",
"dockerFile": "FROM gradle:6.9.2-jdk8",
"severity": "",
"registryId": 27,
"registryName": "dev",
"imageTag": "8u292-rmsoft",
"imageName": "buildapi-test-gradle"
},
"stepOrder": 5
}
],
"description": "build test",
"editType": "N",
"externalRegistrySeq": 0,
"imageName": "build-api-test-gradle",
"registryName": "dev",
"registryProjectId": 27,
"tagName": "8u292-rmsoft"
}
200
OK
[
{
"useYn": "Y",
"created": "2022-12-02 08:42:46",
"updated": "2022-12-02 08:42:46",
"buildSeq": 1,
"buildNo": 1,
"buildName": "build-test",
"buildDesc": "build test",
"accountSeq": 1,
"registryProjectId": 27,
"registryName": "dev",
"imageName": "build-api-test-gradle",
"autotagUseYn": "N",
"autotagPrefix": "test",
"autotagSeqType": "DATETIME",
"tagName": "8u292-rmsoft",
"externalRegistrySeq": 0,
"buildServerHost": "topic:build-20230623-ws-namespace-thingcluster",
"buildServerTlsVerify": "N",
"buildServerCacrt": "",
"buildServerClientCert": "",
"buildServerClientKey": "",
"buildSteps": [
{
"stepType": "CODE_DOWN",
"useFlag": true,
"buildStepSeq": 0,
"buildStepConfig": {
"stepType": "CODE_DOWN",
"repositoryType": "GIT",
"stepTitle": "Code repository task.",
"repositoryUrl": "github.com/codefresh-contrib/gradle-sample-app.git",
"branchName": "master",
"codeSaveDir": "repo",
"commonType": "COMMON",
"protocolType": "https"
},
"stepOrder": 1
},
{
"stepType": "USER_TASK",
"useFlag": true,
"buildStepSeq": 0,
"buildStepConfig": {
"stepType": "USER_TASK",
"stepTitle": "user task.",
"cmd": [
"mvn",
"clean",
"install"
],
"workingDir": "/build",
"imageName": "build-api-test-gradle",
"imageTag": "8u292-rmsoft",
"dockerVolumeMountVOList": [
{
"containerPath": "/build",
"hostPath": "$PWD/repo"
}
]
},
"stepOrder": 2
},
{
"stepType": "FTP",
"useFlag": true,
"buildStepSeq": 110,
"buildStepConfig": {
"stepType": "FTP",
"stepTitle": "file(FTP) task.",
"url": "test-ftp.gradle-sample-test",
"ftpType": "SFTP",
"username": "runapps",
"sourceFiles": "/data/dataset",
"remoteDirectory": "data/gradle-sample-dataset",
"ftpExecType": "DIR_FTP_DOWN"
},
"stepOrder": 3
},
{
"stepType": "HTTP",
"useFlag": true,
"buildStepSeq": 0,
"buildStepConfig": {
"stepType": "HTTP",
"stepTitle": "REST call task",
"url": "https://priv-regi.cocktailcloud.io/api/gradle-sample-dataset",
"httpMode": "GET",
"ignoreSslErrors": false,
"username": "admin",
"timeout": 5,
"validResponseCodes": "200",
"outputFile": "project-list.txt",
"consoleLogResponseBody": false
},
"stepOrder": 4
},
{
"stepType": "SHELL",
"useFlag": true,
"buildStepSeq": 0,
"buildStepConfig": {
"stepType": "SHELL",
"stepTitle": "script task",
"shellType": "SCRIPT",
"command": "echo \">>> move app source\"\ncd repo\n\necho \">>> node_modules compression\"\ntar -cf node_modules.tar node_modules/\n\nls -al"
},
"stepOrder": 5
},
{
"stepType": "CREATE_IMAGE",
"useFlag": true,
"buildStepSeq": 0,
"buildStepConfig": {
"stepType": "CREATE_IMAGE",
"buildStepSeq": 0,
"exitCode": "0",
"dockerFileType": "CONTENTS",
"stepTitle": "image build task",
"dockerFile": "FROM gradle:6.9.2-jdk8",
"severity": "",
"registryId": 27,
"registryName": "dev",
"imageTag": "8u292-rmsoft",
"imageName": "build-api-test-gradle"
},
"stepOrder": 6
}
],
"hostUrl": "dev.cocktailcloud.io",
"buildCount": 6,
"runningCount": 6,
"doneCount": 3,
"errorCount": 3,
"pipelineCount": 1,
"tagCount": 3,
"buildTimeAvg": 606,
"imgSizeAvg": 351720643,
"latestBuildTime": 752,
"latestImgSize": 352886544,
"latestExecTime": "2022-12-02 08:42:46"
}
]
Was this helpful?