跳到主要内容

Git Push

Learn how to add and configure the "Git Push" notification action in your Buddy pipeline

Git Push (password)

POST参数

名称类型描述
name
必填
String操作名称
type
必填
StringThe type of the action. Should be set to PUSH.
push_url
必填
StringThe url to the repository.
git_auth_mode
必填
StringThe authentication mode for GIT. Should be set to HTTP.
tagStringThe name of the tag to push.
loginStringThe username required to connect to the server.
passwordStringThe password required to connect to the server.
push_tagsBooleanDefines whether the tags should be pushed to the remote repository or not.
use_custom_gitignoreBooleanWhen set to false the push will ignore paths listed in .gitignore file.
isolatedBooleanWhen set to true, action will push only repository files (without artifacts).
target_branchStringDefines the remote branch to which the push will be performed. If empty, files will be pushed to the same branch.
deployment_excludesString[]The paths and/or files that will be left out during the push. Only works when use_custom_gitignore is set to true.
without_forceBooleanDefines whether the --force flag should be used when invoking the git push command or not.
commentStringOptional custom git commit message.

示例

请求

POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions

JSON

{
"name": "Push to https://app.buddy.works/buddy/repo",
"login": "api_tests_user",
"password": "api_tests_password",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"push_url": "https://app.buddy.works/buddy/repo",
"target_branch": "$BUDDY_EXECUTION_BRANCH",
"tag": "tagName",
"deployment_excludes": [
"/tmp/"
],
"git_auth_mode": "HTTP",
"comment": "$BUDDY_EXECUTION_ID",
"push_tags": false,
"use_custom_gitignore": true,
"without_force": false
}

示例响应

HTTP

Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/2/edit",
"id": 2,
"name": "Push to https://app.buddy.works/buddy/repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"last_execution_status": "INITIAL",
"login": "api_tests_user",
"password": "api_tests_password",
"push_tags": false,
"git_auth_mode": "HTTP",
"target_branch": "$BUDDY_EXECUTION_BRANCH",
"push_url": "https://app.buddy.works/buddy/repo",
"comment": "$BUDDY_EXECUTION_ID",
"tag": "tagName",
"deployment_excludes": [
"/tmp/"
],
"without_force": false,
"use_custom_gitignore": true,
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}

Git Push (Private key)

POST参数

Buddy所有操作通用参数列表

:::

名称类型描述
name
必填
String操作名称
type
必填
StringThe type of the action. Should be set to PUSH.
git_auth_mode
必填
StringThe authentication mode for SSH. Should be set to PRIVATE_KEY.
push_url
必填
StringThe url to the repository.
server_key
必填
StringThe private SSH key.
tagStringThe name of the tag to push.
push_tagsBooleanDefines whether the tags should be pushed to the remote repository or not.
use_custom_gitignoreBooleanWhen set to false the push will ignore paths listed in .gitignore file.
isolatedBooleanWhen set to true, action will push only repository files (without artifacts).
target_branchStringDefines the remote branch to which the push will be performed. If empty, files will be pushed to the same branch.
deployment_excludesString[]The paths and/or files that will be left out during the push. Only works when use_custom_gitignore is set to true.
without_forceBooleanDefines whether the --force flag should be used when invoking the git push command or not.
commentStringOptional custom git commit message.

示例

请求

POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions

JSON

{
"name": "Push to Your Repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"git_auth_mode": "PRIVATE_KEY",
"push_url": "https://app.buddy.works/buddy/repo",
"push_tags": true,
"target_branch": "stage",
"tag": "tagName",
"use_custom_gitignore": true,
"without_force": true,
"comment": "Push from Buddy",
"deployment_excludes": [
"/tmp/",
"*.log"
],
"server_key": "-----BEGIN RSA PRIVATE KEY-----\r\nProc-Type: 4,ENCRYPTED\r\nDEK-Info: DES-EDE3-CBC,688DBB59CFC83D58\r\n\r\n1m3qZGEqXEf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\r\nFqbDZ2zGMwODjcDancXaghSS7ciIEdoAPGor1rftJ+l2oQVzBPk4pNfBKHJC7UmS\r\nUOGW3rGLSlRQcVEBFHbrsGP/JKXd06Cbrc3kDrdXbO430qRZh9LQQKbjvxHonU8Z\r\nXFeRpwG32YLSCSQunJtoEWQRJpVefc7rEmBAdLfNyA7xyqH2JLtlflaH9QApl7vE\r\nGNJJ5iuHCHPJwfhlaSMBF/Cb9Ofp4BM5fnNKrwaI9twv//U6XhVfYRcaKhCFEoMb\r\nYo4k7cKTQzL95xT1aYnwqSqtaDfoXASoA9j/mD0aMU+9zQEa0tVbJ/6Zjn3vMSTx\r\npvCYkXy9kZzEJZ2r7BiaQX0HX5Ki/Opt4eTWL5NbokDsE1bQu+D2BskJz30pRRRK\r\nvRargCRNl26158HNRLPkbo/gkwfJbfIBFgJ8YEQkcNap110oEaW6l3lnktZ0Ct3P\r\nEjkrppoV6UU1HCVmcoljOldTXQZuKmpz7aIuSwmUqoU4vWNvYteIZ3BhaVwCu/p8\r\nVaFL8Sapda0WYXPWXHuV+Dj295bedJxeqraWrQB87vKP4NVyzWv1WA==\r\n-----END RSA PRIVATE KEY-----\r\n"
}

示例响应

HTTP

Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/851",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/851/edit",
"id": 851,
"name": "Push to Your Repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"git_auth_mode": "PRIVATE_KEY",
"last_execution_status": "INITIAL",
"push_url": "https://app.app.buddy.works/buddy/repo",
"target_branch": "stage",
"tag": "tagName",
"push_tags": true,
"use_custom_gitignore": true,
"without_force": true,
"comment": "Push from Buddy",
"deployment_excludes": [
"/tmp/",
"*.log"
],
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}

Git Push (Private key from environment variables)

POST参数

Buddy所有操作通用参数列表

:::

名称类型描述
name
必填
String操作名称
type
必填
StringThe type of the action. Should be set to PUSH.
git_auth_mode
必填
StringThe authentication mode for SSH. Should be set to ENV_KEY.
push_url
必填
StringThe url to the repository.
env_key
必填
StringThe private SSH key name defined in environment variables.
tagStringThe name of the tag to push.
push_tagsBooleanDefines whether the tags should be pushed to the remote repository or not.
use_custom_gitignoreBooleanWhen set to false the push will ignore paths listed in .gitignore file.
isolatedBooleanWhen set to true, action will push only repository files (without artifacts).
target_branchStringDefines the remote branch to which the push will be performed. If empty, files will be pushed to the same branch.
deployment_excludesString[]The paths and/or files that will be left out during the push. Only works when use_custom_gitignore is set to true.
without_forceBooleanDefines whether the --force flag should be used when invoking the git push command or not.
commentStringOptional custom git commit message.

示例

请求

POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions

JSON

{
"name": "Push to Your Repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"git_auth_mode": "ENV_KEY",
"push_url": "https://app.buddy.works/buddy/repo",
"push_tags": true,
"target_branch": "stage",
"tag": "tagName",
"use_custom_gitignore": true,
"without_force": true,
"comment": "Push from Buddy",
"deployment_excludes": [
"/tmp/",
"*.log"
],
"env_key": "my_key"
}

示例响应

HTTP

Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/851",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/851/edit",
"id": 851,
"name": "Push to Your Repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"git_auth_mode": "ENV_KEY",
"env_key": "my_key",
"last_execution_status": "INITIAL",
"push_url": "https://app.app.buddy.works/buddy/repo",
"target_branch": "stage",
"tag": "tagName",
"push_tags": true,
"use_custom_gitignore": true,
"without_force": true,
"comment": "Push from Buddy",
"deployment_excludes": [
"/tmp/",
"*.log"
],
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}

Git Push (Public Buddy key)

POST参数

Buddy所有操作通用参数列表

:::

名称类型描述
name
必填
String操作名称
type
必填
StringThe type of the action. Should be set to PUSH.
push_url
必填
StringThe url to the repository.
git_auth_mode
必填
StringThe authentication mode for SSH. Should be set to PUBLIC_BUDDY_KEY.
tagStringThe name of the tag to push.
push_tagsBooleanDefines whether the tags should be pushed to the remote repository or not.
use_custom_gitignoreBooleanWhen set to false the push will ignore paths listed in .gitignore file.
isolatedBooleanWhen set to true, action will push only repository files (without artifacts).
target_branchStringDefines the remote branch to which the push will be performed. If empty, files will be pushed to the same branch.
deployment_excludesString[]The paths and/or files that will be left out during the push. Only works when use_custom_gitignore is set to true.
without_forceBooleanDefines whether the --force flag should be used when invoking the git push command or not.
commentStringOptional custom git commit message.

示例

请求

POST https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions

JSON

{
"name": "Push to https://app.buddy.works/buddy/repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"deployment_excludes": [
"/tmp/"
],
"push_url": "buddy@app.buddy.works:buddy/repo",
"comment": "$BUDDY_EXECUTION_ID",
"tag": "tagName",
"target_branch": "$BUDDY_EXECUTION_BRANCH",
"git_auth_mode": "PUBLIC_BUDDY_KEY",
"push_tags": false,
"use_custom_gitignore": true,
"without_force": false
}

示例响应

HTTP

Status: 201 Created
X-Rate-Limit-Limit: 1
X-Rate-Limit-Remaining: 999

JSON

{
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/2/edit",
"id": 2,
"name": "Push to https://app.buddy.works/buddy/repo",
"type": "PUSH",
"trigger_time": "ON_EVERY_EXECUTION",
"push_tags": false,
"git_auth_mode": "PUBLIC_BUDDY_KEY",
"deployment_excludes": [
"/tmp/"
],
"push_url": "buddy@app.buddy.works:buddy/repo",
"comment": "$BUDDY_EXECUTION_ID",
"tag": "tagName",
"target_branch": "$BUDDY_EXECUTION_BRANCH",
"git_auth_mode": "PUBLIC_BUDDY_KEY",
"push_tags": false,
"use_custom_gitignore": true,
"without_force": false,
"pipeline": {
"url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2",
"html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2",
"id": 2,
"name": "Live mirror",
"on": "CLICK",
"refs": [
"refs/heads/master"
],
"last_execution_status": "SUCCESSFUL",
"last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08"
}
}