DevSecOps CLI

DevSecOps CLI는 IBM Cloud® DevSecOps 참조 구현(예: 시프트 왼쪽 접근 방식 참조 파이프라인)에 따라 규정 준수 솔루션을 채택합니다. 원점 회귀 방식의 규제 준수 아키텍처에 관한 자세한 정보는 DevSecOps(Continuous Delivery 포함)를 참조하십시오.

CLI 인터페이스

CLI는 다음 순서로 지정해야 하는 명령행에서 다중 파트 구조를 사용합니다.

cocoa <command> <subcommand> [options]
  1. CLI에 대한 기본 호출입니다.

  2. 일반적으로 시프트-레프트 아키텍처에서 사용되는 서비스나 모듈에 해당하는 주요 명령어. 예를 들어, 변경 요청(change request), 인벤토리(inventory) 또는 테크톤(tekton) 등이 있다.

  3. 수행할 조치를 지정하는 하위 명령입니다.

  4. 조치에 필요한 CLI 옵션입니다. 1-3단계를 수행하는 조건에서 CLI 옵션을 임의의 순서로 지정할 수 있습니다.

일부 명령어는 환경 변수를 사용하여 API 키를 가져오거나, 명령줄에서 지정되지 않은 옵션 값을 설정합니다. 명령을 실행하기 전에 이 변수들을 내보내야 합니다.

명령줄 옵션은 숫자, 문자열, 부울 값, 배열, JSON 객체 등 다양한 유형의 입력 값을 받을 수 있습니다. 옵션의 유형은 사용자가 지정한 명령에 따라 달라집니다. cocoa <command> <subcommand> --help 를 사용하여 옵션 유형을 확인하세요.

실패한 API 호출 재시도

Cocoa CLI는 응답 상태가 5xx 인 실패한 API 호출을 세 번 재시도합니다. 다음 환경 변수를 제공하여 이 동작을 대체할 수 있습니다.

  • MAX_RETRY_ATTEMPTS-Cocoa CLI가 포기하기 전에 시도하는 재시도 횟수입니다. 예를 들어, MAX_RETRY_ATTEMPTS=5
  • RETRY_STATUS_CODE-재시도가 발생하는 응답 상태 코드. 예를 들어, 이 세 상태 코드에서 재시도하려면 RETRY_STATUS_CODE=409,422,500 를 입력하십시오.
export MAX_RETRY_ATTEMPTS=5                 # Retry API calls 5 times.
export RETRY_STATUS_CODE=409,422,500            # Retry API calls for response codes 409, 422 and 500.

재시도 횟수가 기하급수적으로 늘어나므로 재시도 횟수를 더 높게 설정하면 재시도 간격이 더 멀어집니다.

명령 실행 경과 시간

코코아 CLI는 다음과 같이 DISPLAY_ELAPSED_TIME 를 비어 있지 않은 문자열로 설정하여 명령의 경과 시간 (초) 을 표시할 수 있습니다.

export DISPLAY_ELAPSED_TIME=1`                # Display a snippet showing the total execution time of the cli command, example `Elapsed time: 5.32 seconds`

CLI 명령

ServiceNow 는 문서화되어 있지만, 기본 IBM Cloud DevSecOps 참조 구현에서는 지원되지 않습니다.

코코아 당기기 요청 명령

cocoa check pull-request-approval

커밋 해시에 대한 풀 리퀘스트의 승인 상태를 확인합니다. 풀 리퀘스트가 승인되지 않은 경우, 지정된 저장소에 새로운 인시던트 이슈가 생성됩니다. 이 명령은 레이블로 표시된 응급 가져오기 요청을 식별할 수 있습니다. 이 경우 종료 코드는 0 입니다.

필수 환경 변수:

GHE_TOKEN=              # Github Enterprise API Token (Optional if you are using --git-token-path field)
GHE_ORG=                # The owner of the repository
GHE_REPO=               # The repository name
INCIDENT_ISSUE_REPO=    # The incident issue repo name
EMERGENCY_LABEL=        # Emergency Label name
GIT_COMMIT=             # Commit hash of the Pull Request

옵션:

--label                 # Label to add to possible pr incident issue
--git-provider          # SCM provider (GitHub)
--git-token-path        # (Optional) GitHub Token's path
--git-api-url           # (Optional) GitHub API url

GitHub, 사용하는 경우 GHE_TOKENGH_URL 환경 변수 대신 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GitHub Enterprise API URL 설정할 수 있습니다. 둘 다 제공되는 경우 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

cocoa check pull-request-approval

cocoa check pull-request-status

지정된 가져오기 요청의 상태 및 저장소 설정을 확인합니다.

  • 분기 보호: 강제 푸시를 사용 안함으로 설정하고 분기가 삭제되지 않도록 하며 선택적으로 병합 전에 상태 검사가 필요한 규칙입니다. 향상된 기능으로, 기존의 브랜치 보호 기반 유효성 검사와 함께 GitHub 리포지토리에 대한 규칙 집합 기반 유효성 검사도 지원합니다. 기본적으로 이 명령은 GitHub 저장소의 브랜치에서 연관된 규칙 집합을 확인하고, 규칙 집합을 찾을 수 없으면 기존 브랜치 보호 기반 검증으로 돌아갑니다. 브랜치에 대해 규칙 집합과 기존 브랜치 보호 규칙이 모두 있는 경우 이 명령은 규칙 집합만 고려합니다. GitHub 규칙 집합에 대한 자세한 내용은 GitHub 리포지토리 구성하기를 참조하세요
  • 커밋 상태 확인: 외부 서비스를 통해 커밋에 ‘ error ’, ‘ failure ’, ‘ pending ’ 또는 ‘ success ’ 상태를 지정하면, 해당 커밋이 포함된 풀 리퀘스트에도 이 상태가 반영됩니다.
  • 검사 실행: 지속적 통합, 코드 린트 또는 코드 스캐닝 서비스를 수행하고 커미트에 관한 자세한 피드백을 제공하는 앱입니다.

필수 환경 변수:

REQUIRED_CHECKS=        # Minimum required checks to be compliant set by client
GIT_BRANCH=             # Branch name for branch protection check
GIT_COMMIT=             # Commit hash of the Pull Request
GHE_TOKEN=              # Github Enterprise API Token (Optional if you are using --git-token-path field)
GHE_ORG=                # The owner of the repository
GHE_REPO=               # The repository name

GitHub, 사용하는 경우 GHE_TOKENGH_URL 환경 변수 대신 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GitHub Enterprise API URL 설정할 수 있습니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

브랜치 보호 설정의 출력 파일 경로를 지정하려면 ' --branch-protection-settings-output-path ' 옵션을 사용하세요. 브랜치가 보호되면 리포지토리 브랜치 보호 설정의 JSON 표현이 이 지정된 경로에 저장됩니다.

Branch 보호 유효성 검사 결과의 출력 파일 경로를 지정하려면 ' --branch-protection-markdown-output-path ' 옵션을 사용합니다. 브랜치가 보호되면 유효성 검사 결과가 이 지정된 경로에 Markdown 형식으로 저장됩니다.

REQUIRED_CHECKS예:

  [
    {
      "type": "status",
      "name": "unit-test",
      "params": {
        "name": "travis/ci"
      }
    },
    {
      "type": "check-run",
      "name": "secret-detection",
      "params": {
        "name": "detect-secrets"
      }
    },
    {
      "type": "branch-protection",
      "name": "code review",
      "params": {
        "checks": ["travis/ci", "detect-secrets"]
      }
    },
    {
      "type": "check-run",
      "name": "open-source-license-scan",
      "params": {
        "name": "ossc/ci"
      }
    }
  ]

명령 실행:

 cocoa check pull-request-status
 cocoa check pull-request-status \
    --branch-protection-settings-output-path <path/to/file> \
    --branch-protection-markdown-output-path <path/to/file>

코코아 변경 요청 명령

cocoa change-request 명령은 다음 변경 관리 제공자를 지원합니다.

  • ServiceNow V1
  • ServiceNow V3

servicenow (기본값) 또는 servicenow-v3 값과 함께 --provider 옵션을 사용하여 제공자를 지정할 수 있습니다.

각 제공자에는 서로 다른 환경 변수 구성이 필요합니다.

  • servicenow:
    • SERVICENOW_TOKEN- ServiceNow V1 API 토큰
    • SERVICENOW_URL- ServiceNow V1 API URL
  • servicenow-v3:
    • PNP_IBMCLOUD_API_KEY- ServiceNow v3 엔드포인트에 액세스하기 위한 API키가 제공되지 않은 경우 IAM_ACCESS_TOKEN으로 폴백합니다.
    • IAM_ACCESS_TOKEN- IBMCloud IAM OAuth 토큰
    • SERVICENOW_URL- ServiceNow V3 API URL
  • github-enterprise:
    • GHE_TOKEN- GitHub Enterprise 토큰
    • GITHUB_CHANGE_MANAGEMENT_REPO- GitHub 변경 관리 저장소
    • GITHUB_CHANGE_MANAGEMENT_ORG- GitHub 변경 관리 조직

cocoa change-request get

ServiceNow API에서 변경 요청을 조회하여 파일을 통해 저장하거나 콘솔에 출력합니다.

ServiceNow v1 또는 v2:

SERVICENOW_TOKEN= # ServiceNow API Token
SERVICENOW_URL=   # ServiceNow API URL

ServiceNow v3:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

GitLab에 필요한 환경 변수:

GITLAB_TOKEN= # Gitlab token. (Optional if you are using --git-token-path)
GITLAB_URL=   # Change management API URL (Optional if you are using --git-api-url)

옵션:

--change-request-id='CHGXXXXXX'  # (Required) The Change Request ID to query from ServiceNow.
--output='filename.json'         # (Optional) If provided, the Change Request data will be written to this file.
--provider='servicenow'          # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

명령 실행:

# Read Change Request with number 'CHG123456' and output the JSON Data to the console.
$ cocoa change-request get --change-request-id='CHG123456'
# Read Change Request with number 'CHG123456' and output the JSON Data to the file named 'cr.json'.
$ cocoa change-request get --change-request-id='CHG123456' --output='cr.json'
# Read Change Request with number 'CHG123456' using the ServiceNow v3 API
$ cocoa change-request get --change-request-id='CHG123456' --provider='servicenow-v3'

cocoa change-request create

변경 요청을 작성하고 ServiceNow API에 게시합니다.

두 가지 사용 방법:

  • CLI 옵션에서 모든 필수 CR 필드를 제공합니다.

옵션:

--assigned-to      # A ServiceNow validated user (defaults to value found in the pull request)
--system           # the name of the system in ServiceNow
--impact           # impact explanation (defaults to value found in th pull request)
--outage-duration  # duration of the outage (format: 'd HH:mm:ss' or 'none')
--priority         # change priority, valid options: critical, high, moderate, low, planning (defaults to value found in the pull request)
--environment      # the environment for the deployment
--purpose          # purpose explanation (default to value found in the pull request)
--description      # description of the change
--backout-plan     # description of the backout plan (defaults to the value found in the PR)
--planned-start    # planned start time of the change (required format: YYYY-MM-DD HH:mm:ss, e.g 2020-05-13 13:00:12, in UTC)
--planned-end      # planned end time of the change (required format: YYYY-MM-DD HH:mm:ss, e.g 2020-05-13 13:00:12, in UTC)
--deployment-ready # readiness for deployment (choices: 'yes', 'no', default: 'yes')
--type             # change request type, option: standard, emergency
--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', 'github-enterprise', 'gitlab' default: 'servicenow')
--pipeline-name    # (Optional) name of the pipeline used for identifying the pipeline
--pipeline-version # (Optional) version of pipeline used (value must match regular expression [0-9.]+)
  • 변경 요청 데이터를 구문 분석할 파일 이름을 제공하십시오. JSON 형식이 예상됩니다.

옵션:

--file --f         # json file name to parse the cr data from
--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

예제 파일:

{
  "type": "emergency",
  "assignedto": "alexandra.szanto@ibm.com",
  "backoutplan": "rollback",
  "priority": "critical",
  "purpose": "bugfix",
  "description": "test description",
  "environment": "crn:v1:bluemix:public::ch-ctu-2::::",
  "impact": "bug",
  "system": "devopsinsights",
  "outageduration": "0 00:00:00",
  "plannedstart": "2020-10-05 14:48:00",
  "plannedend": "2020-10-05 14:49:00",
  "deploymentready": "yes",
}

ServiceNow v1 또는 v2:

SERVICENOW_TOKEN=   # ServiceNow API Token
SERVICENOW_URL=     # ServiceNow API URL

ServiceNow v3:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request create --file=test.json

또는

$ cocoa change-request create \
  --assigned-to=<your-ibm-email> \
  --system=<servicenow-configuration-item> \
  --impact=<impact description> \
  --outage-duration='0 00:00:00' \
  --priority=<the-priority> \
  --environment=<involved-environment> \
  --purpose=<purpose-explanation> \
  --description=<description-of-the-change> \
  --backout-plan=<description-of-a-backout-plan> \
  --planned-start='2020-05-13 13:00:12' \
  --planned-end='2020-05-13 13:10:12' \
  --deployment-ready=<yes/no> \
  --type=<change-type> \

코코아 변경 요청 업데이트

ServiceNow v3 API를 사용하여 기존 변경 요청을 업데이트하고 콘솔에 인쇄합니다.

ServiceNow v3:

SERVICENOW_URL=       # ServiceNow API URL
CHANGE_REQUEST_ID=    # ID of the Change Request

ServiceNow v3:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

옵션:

--close-notes                    # (Optional) Any pertinent notes to add to change request closure.
--close-category                 # (Optional) Change request close notes (choices:  'successful', 'successful_issues', 'unsuccessful', 'cancelled')
--description                    # (Optional) Description of the change

명령 실행:

# Update Change Request with sample close-notes, close category and description.
$ cocoa change-request update --close-notes="sample close-note" --close-category="successful" --description="sample change description"

설명 옵션을 사용하면 명령이 기존 설명을 새 설명으로 바꿉니다. 사용자가 원래 설명에 콘텐츠를 추가하려는 경우 이 명령을 사용하기 전에 기존 설명을 추출하여 수동으로 추가해야 합니다.

cocoa change-request change-state-to-implement

ServiceNow API를 통해 변경 요청의 상태를 ‘ implement ’로 변경합니다.

옵션:

--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

제공자에 관계없이 필수 환경 변수:

CHANGE_REQUEST_ID=  # ID of the Change Request

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request change-state-to-implement

cocoa change-request close

ServiceNow API를 통해 변경 요청을 종료합니다. --close-notes 옵션을 사용하여 ‘마감 메모’를 첨부할 수 있으며, --close-category 옵션을 사용하여 ‘마감 카테고리’를 지정할 수 있습니다.

옵션:

--close-category  # Choices: "successful" (default), "successful_issues", "unsuccessful", "cancelled"
--close-notes     # String, defaults to "Deployment done."
--provider        # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

제공자에 관계없이 필수 환경 변수:

CHANGE_REQUEST_ID=  # ID of the Change Request

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request close

cocoa change-request check-approval

변경 요청의 승인 상태를 조회합니다. 변경 요청이 긴급한 경우, 명령은 실패하지 않고 소급 승인을 요청하는 메시지가 표시됩니다.

옵션:

--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

제공자에 관계없이 필수 환경 변수:

CHANGE_REQUEST_ID=  # ID of the Change Request

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request check-approval

cocoa change-request prepare

변경 요청 데이터를 생성하고 콘솔이나 파일에 출력합니다.

필수 환경 변수:

GHE_TOKEN=              # Github Enterprise API Token (only required when parsing from pr)
GHE_ORG=                # The owner of the repository (optional, when --org is not provided)
GHE_REPO=               # The repository name (optional, when --repo is not provided)
EMERGENCY_LABEL=        # Emergency Label (optional, when --emergency-label is not provided)

가져오기 요청 본문에서 다음 필드를 구문 분석할 수 있습니다.

--assigned-to
--impact
--priority
--purpose
--backout-plan
--type
--customer-impact
--deployment-impact

CLI 옵션을 통해 해당 값이 지정된 경우, CLI 옵션이 풀 리퀘스트에 있는 값보다 우선 적용됩니다. 이 모든 항목이 제공되면 pr은 구문 분석되지 않으며, --org, --repoGHE_TOKEN 는 필요하지 않습니다.

옵션:

--org              # github organization where the parsed pr is (only needed if fields are parsed from pr, defaults to GHE_ORG)
--repo             # github repository name whre the parsed pr is (only needed if fields are parsed from pr, defaults to GHE_REPO)
--pr               # the pull request number to parse (mutually exclusive with sha and branch)
--sha              # infer the pr number from hash (mutually exclusive with pr and branch)
--branch           # infer PR based on the last merged pr into this branch (defaults to master)
--assigned-to      # A ServiceNow validated user (defaults to value found in the pull request)
--system           # the name of the system in ServiceNow
--impact           # implact explanation (defaults to value found in th pull request)
--outage-duration  # duration of the outage
--planned-start    # planned start time of the change (required format: YYYY-MM-DD HH:mm:ss, e.g 2020-05-13 13:00:12, in UTC)
--planned-end      # planned end time of the change (required format: YYYY-MM-DD HH:mm:ss, e.g 2020-05-13 13:00:12, in UTC)
--priority         # change priority, valid options: critical, high, moderate, low, planning (defaults to value found in the pull request)
--environment      # the environment for the deployment
--purpose          # purpose explanation (default to value found in the pull request)
--backout-plan     # description of the backout plan (defaults to the value found in the PR)
--deployment-ready # description of the change
--type             # change request type, option: standard, emergency
--emergency-label  # emergency label to look for in the pull request
--file             # file name to print the cr data to (optional, prints to stdout by default)
--service-environment # service environment of the change, valid options: production, pre_prod
--service-environment-detail # brief description of the service environment where change is deployed.
--pipeline-name    # (Required) name of the pipeline used (for example 'onepipeline | continuous-delivery')
--pipeline-version # version of pipeline used (for example '9.22.3')
--validation-record # Pre-prod change request numbers or NA if there is no pre-prod change request for the deployment

명령 실행:

$ cocoa cr prepare \
  --org=<github-organization> \
  --repo=<github-repo-name> \
  --pr=<pr number>

cocoa change-request request-approval

승인이 요청되지 않은 새 상태의 레코드에 대한 승인을 요청합니다. 실행 시, 해당 레코드는 수동 승인 절차를 따릅니다.

옵션:

--crid="<ID>"
# or
--change-request-id="<ID>"
--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request request-approval --crid="<insert-change-request-id-here>"

코코아 변경 요청 첨부 파일 추가

특정 변경 요청에 ‘변경’ 첨부 파일을 추가합니다.

옵션:

--description      # A more detailed description for the Change Task. [string]
--name             # Name of the Change Task. [string] [required]
--data             # Data for the Change Task or a path prefixed with @ to read the data from. [string] [default: "@/dev/stdin"]
--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'github-enterprise', 'servicenow-v3', default: 'servicenow')

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

$ cocoa change-request attachment add "CHGXXXXXXX" \
        --name='<attachment-name>' \
        --data='<data-for-the-attachment>'
$ cat data.txt | cocoa change-request attachment add "CHGXXXXXXX" --name='<attachment-name>'
$ cocoa change-request attachment add "CHGXXXXXXX" \
        --name='<attachment-name>' \
        --data='@<path/to/file>'

코코아 변경 요청 첨부 가져오기

변경 요청의 특정 변경 첨부 파일을 가져옵니다.

옵션:

--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request attachment get "CHGXXXXXXX" "CTASKXXXXXXX"

코코아 변경 요청 첨부 파일 목록

변경 요청에 대한 첨부 파일을 나열합니다.

옵션:

--provider         # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

 cocoa change-request attachment list "<insert-change-request-id-here>"

코코아 변경 요청 첨부 파일 업데이트

특정 변경 요청에 포함된 변경 첨부 파일을 업데이트합니다.

옵션:

--change-request-id  # The change request the change task belongs to [string] [required]
--change-task-id     # The change task id to be updated [string] [required]
--description        # A more detailed description for the Change Task. [string]
--data               # Data for the Change Task or a path prefixed with @ to read the data from. [string]
--provider           # (Optional) Change Management service provider (choices: 'servicenow', 'servicenow-v3', default: 'servicenow')

ServiceNow v1 또는 v2 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_TOKEN=    # ServiceNow API Token
SERVICENOW_URL=      # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=    # Github Enterprise API Token (only required when parsing from pr)
GITHUB_CHANGE_MANAGEMENT_ORG=   # The owner of the repository (optional, when --org is not provided)
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name (optional, when --repo is not provided)

명령 실행:

$ cocoa change-request attachment update
        --change-request-id='CHGXXXXXXX' \
        --change-attachment-id='CTASKXXXXXXX' \
        --data='<data-for-the-attachment>' \
        --description='<description>'
$ cat data.txt | cocoa change-request attachment update --change-request-id='CHGXXXXXXX' --change-attachment-id='CTASKXXXXXXX' --data='@/dev/stdin'
$ cocoa change-request attachment update --change-request-id='CHGXXXXXXX' --change-attachment-id='CTASKXXXXXXX' --data='@<path/to/file>'

코코아 변경 요청 댓글 추가

특정 변경 요청에 코멘트를 추가합니다.

옵션:

--comment          # Comment to add [string] [required]
--provider         # (Optional) Change Management service provider (choices: 'servicenow-v3', 'gitlab', 'github-enterprise', default: 'servicenow-v3')
--git-api-url      # (Optional) Git API URL [string]
--git-token-path   # (Optional) Git token path to read the secret from [string]

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitLab 공급자에 필요한 환경 변수입니다:

GITLAB_TOKEN=    # Gitlab Token
GITLAB_URL=      # Gitlab API URL
GITLAB_ORG=      # Gitlab ORG
GITLAB_REPO=     # Gitlab REPO Name

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=                        # Github Enterprise API Token
GITHUB_CHANGE_MANAGEMENT_ORG=     # The owner of the repository
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name

명령 실행:

$ cocoa change-request comment add "CHGXXXXXXX" \
        --comment='This is a comment for the change request'
$ cocoa change-request comment add "CHGXXXXXXX" \
        --comment='Adding comment using GitLab provider' \
        --provider='gitlab'

코코아 변경 요청 댓글 목록

특정 변경 요청에 대한 모든 댓글을 나열합니다.

옵션:

--provider         # (Optional) Change Management service provider (choices: 'servicenow-v3', 'gitlab', 'github-enterprise', default: 'servicenow-v3')
--git-api-url      # (Optional) Git API URL [string]
--git-token-path   # (Optional) Git token path to read the secret from [string]
--last             # (Optional) Retrieve only the last n comments [number]
--before           # (Optional) Filter comments created before this date (ISO 8601 format, e.g., YYYY-MM-DDTHH:MM:SSZ) [string]
--after            # (Optional) Filter comments created after this date (ISO 8601 format, e.g., YYYY-MM-DDTHH:MM:SSZ) [string]

참고:

  • --last 매개변수는 0 이상의 숫자여야 합니다.
  • --before--after 매개 변수는 ISO 8601 형식의 날짜를 허용하며 미래가 될 수 없습니다.
  • --before--after 을 모두 사용하는 경우 --before 날짜가 --after 날짜보다 커야 합니다.
  • 필터는 날짜 필터(--before, --after)를 먼저 적용한 다음 --last 으로 결과를 제한하는 순서로 적용됩니다.

ServiceNow v3 제공자를 사용하는 경우 필수 환경 변수:

SERVICENOW_URL=       # ServiceNow API URL

ServiceNow v3 제공자를 사용하는 경우 추가 환경 변수:

PNP_IBMCLOUD_API_KEY= # API Key to access ServiceNow v3 endpoints, if not provided, falls back to IAM_ACCESS_TOKEN
IAM_ACCESS_TOKEN=     # Access token obtained from the IAM service

GitLab 공급자에 필요한 환경 변수입니다:

GITLAB_TOKEN=    # Gitlab Token
GITLAB_URL=      # Gitlab API URL
GITLAB_ORG=      # Gitlab ORG
GITLAB_REPO=     # Gitlab REPO Name

GitHub Enterprise 제공자의 필수 환경 변수:

GHE_TOKEN=                        # Github Enterprise API Token
GITHUB_CHANGE_MANAGEMENT_ORG=     # The owner of the repository
GITHUB_CHANGE_MANAGEMENT_REPO=    # The repository name

명령 실행:

# List all comments for a change request
$ cocoa change-request comment list "CHGXXXXXXX"
# List comments using GitHub Enterprise provider
$ cocoa change-request comment list "CHGXXXXXXX" --provider='github-enterprise'
# Get only the last 5 comments
$ cocoa change-request comment list "CHGXXXXXXX" --last=5
# Get comments created before a specific date
$ cocoa change-request comment list "CHGXXXXXXX" --before="2026-03-20T10:00:00Z"
# Get comments created after a specific date
$ cocoa change-request comment list "CHGXXXXXXX" --after="2026-03-15T08:00:00Z"
# Get comments within a date range
$ cocoa change-request comment list "CHGXXXXXXX" --after="2026-03-15T08:00:00Z" --before="2026-03-20T10:00:00Z"
# Get the last 10 comments within a date range
$ cocoa change-request comment list "CHGXXXXXXX" --after="2026-03-15T08:00:00Z" --before="2026-03-20T10:00:00Z" --last=10

코코아 증거 명령

cocoa evidence format-summary

증거 요약을 사용자가 읽을 수 있는 형식으로 형식화합니다. 이 요약은 변경 요청 컨텐츠에 피드할 수 있습니다.

명령 실행:

$ cocoa evidence format-summary \
  --input=<filepath> \          # (default: -, referring to stdin) If present, the formatted evidence will be read from the given file.
  --output=<filepath>           # (default: -, referring to stdout) If present, the formatted evidence will be saved to the given file.
# Reading from stdin and printing to stdout:
$ cat raw-summary.json | cocoa evidence format-summary -i - -o - | tee formatted-summary.txt
$ cat raw-summary.json | cocoa evidence format-summary | tee formatted-summary.txt
# Reading to and from file:
$ cocoa evidence format-summary --input=raw-summary.json --output=formatted-summary.txt

코코아 증거 마크다운 - 요약

증거 요약을 GitHub 풀 요청 주석으로 피드할 수 있는 마크다운 형식으로 형식화합니다.

입력은 원시 요약이며 다음 두 형식 중 하나일 수 있습니다.

  • JSON 형식의 요약.
  • 개별 앱 요약의 JSON 배열인 집계된 요약입니다.

집계된 요약이 입력으로 전달되면 출력은 요약의 앱을 기반으로 증거 상태를 그룹화합니다.

선택적 플래그:

  • --detailed: 플래그가 true로 설정된 경우 자세한 마크다운 요약이 생성됩니다(기본값은 true, 잘린 요약의 경우 false 로 설정).

명령 실행:

$ cocoa evidence markdown-summary \
  --input=<filepath> \          # (default: -, referring to stdin) If present, the formatted evidence will be read from the given file.
  --output=<filepath>           # (default: -, referring to stdout) If present, the formatted evidence will be saved to the given file.
# Reading from stdin and printing to stdout:
$ cat raw-summary.json | cocoa evidence markdown-summary -i - -o - | tee markdown-summary.md
$ cat aggr-summary.json | cocoa evidence markdown-summary | tee markdown-summary.md
# Reading to and from file:
$ cocoa evidence markdown-summary --input=raw-summary.json --output=markdown-summary.md

코코아 아티팩트 명령

cocoa artifact upload

지정된 백엔드에 아티팩트를 업로드합니다. 백엔드는 여러 증거 라커 유형(예: Object Storage, GitHub 또는 DevOps Insights)일 수 있습니다. 여러 라커에는 서로 다른 매개변수를 제공해야 합니다.

옵션:

--backend           # (Required) Specifies the types of lockers we upload the artifact ('cos', 'git')
--pipeline-run-id   # The ID of the PipelineRun running the CLI command
--namespace         # Specifies the pipeline the evidence is collected from
--upload-path       # If present, this overrides the artifact name with the specified value
--is-summary        # If present, this uploads the artifact to the location where evidence summary is usually stored

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url

필수 환경 변수:

PIPELINE_RUN_ID=    # Can be used instead of '--pipeline-run-id' option
NAMESPACE=          # Can be used instead of '--namespace' option

'git' 제공자를 사용하는 경우 필수 환경 변수:

EVIDENCE_REPO_ORG=  # The Git repo org (Required if you are using 'git' backend)
EVIDENCE_REPO_NAME= # The Git repo name (Required if you are using 'git' backend)

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=          # Github Enterprise API Token (Optional if you are using --git-token-path)

Cloud Object Storage를 사용하는 경우 필수 환경 변수:

COS_API_KEY=        # Cloud Object Storage API Key (Required if you are using 'cos' backend)
COS_BUCKET_NAME=    # Bucket Name where the artifact will be uploaded in the COS Instance (Required if you are using 'cos' backend)
COS_ENDPOINT=       # The COS API Endpoint matching the region where the bucket is located (Required if you are using 'cos' backend)

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

$ cocoa artifact upload
$ cocoa artifact upload \
  --backend=[choices: "git", "cos"] \ # e.g. --backend=cos,git
  --pipeline-run-id=<pipeline-run-id> # can be substituted by PIPELINE_RUN_ID
  --namespace=[choices: "ci", "cd"] \ # Pipeline type the evidence was collected from, can be substituted by NAMESPACE
  --is-summary        # If present, this uploads the artifact to the location where evidence summary is usually stored
  <file-path>

backendupload-path 를 제외한 CLI 옵션은 환경 변수를 통해서도 설정할 수 있습니다.

아티팩트 검색하기

Object Storage, GitHub,, DevOps Insights 등 다양한 증거 보관함에서 코코아 아티팩트 가져오기 명령을 사용하여 아티팩트를 검색할 수 있습니다. 이 명령을 사용하면 각각 특정 매개변수가 필요한 여러 종류의 보관함에서 아티팩트를 가져올 수 있습니다.

cocoa artifact get 명령은 지정된 백엔드에서 아티팩트를 검색합니다. 여러 라커에는 서로 다른 매개변수를 제공해야 합니다. 옵션:

--backend           # Specifies the types of locker to retrieve the artifact from ('cos', 'git')
--artifact-prefix   # Path where the artifact is present. To be used in COS only, not available in Git. (Use this or --artifact-path, can't be used together)
--artifact-path     # Absolute path on where the artifact is present.
--is-summary        # If present, this returns the merged summary from all the file paths.

git의 옵션:

--git-token-path        # Github Token's path
--git-api-url           # (Optional) Github API url

필수 환경 변수:

'git' 제공자를 사용하는 경우 필수 환경 변수:

EVIDENCE_REPO_ORG=  # The Git repo org (Required if you are using 'git' backend)
EVIDENCE_REPO_NAME= # The Git repo name (Required if you are using 'git' backend)

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=          # Github Enterprise API Token (Optional if you are using --git-token-path)

Cloud Object Storage를 사용하는 경우 필수 환경 변수:

COS_API_KEY=               # Cloud Object Storage API Key (Required if you are using 'cos' backend)
COS_BUCKET_NAME=           # Bucket Name where the artifact will be uploaded in the COS Instance (Required if you are using 'cos' backend)
COS_ENDPOINT=              # The COS API Endpoint matching the region where the bucket is located (Required if you are using 'cos' backend)
BACKUP_COS_API_KEY=        # Cloud Object Storage API Key (Required while migrating from one COS bucket to another to read the old artifacts)
BACKUP_COS_BUCKET_NAME=    # Bucket Name where the artifact will be uploaded in the COS Instance (Required while migrating from one COS bucket to another to read the old artifacts)
BACKUP_COS_ENDPOINT=       # The COS API Endpoint matching the region where the bucket is located (Required while migrating from one COS bucket to another to read the old artifacts)

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

$ cocoa artifact get
$ cocoa artifact get \
  --backend=[choices: "git", "cos"] \ # e.g. --backend=cos
  --artifact-path <file-path> \ # full path in case of git, cos can utilise --artifact-prefix <file-path>

backendartifact-path / artifact-prefix 를 제외한 환경 변수를 통해서도 CLI 옵션을 설정할 수 있습니다.

cocoa set-status

커미트의 상태를 설정합니다. 현재 구현은 GitHub에서 테스트됩니다. GitHub 상태에 대한 문서를 참조하십시오.

필수 환경 변수:

GHE_ORG=      # Github organization/username
GHE_REPO=     # Github repository
GHE_COMMIT=   # Github commit hash

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github token (Optional if you are using --git-token-path)

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

git의 옵션:

--git-token-path    #(Optional) GitHub token's path
--git-api-url       #(Optional) GitHub API url

명령 실행:

$ cocoa set-status \
 --state="pending" \
 --targetURL="https://cloud.ibm.com/devops/pipelines/tekton/some-toolchain/runs/some-pipelinerun/lint/lint?env_id=ibm:yp:us-south" \
 --context="tekton/lint" \
 --description="Tekton linter is running."

코코아 재고 명령

cocoa inventory add

인벤토리 저장소에 값을 추가합니다. name 옵션이 지정된 파일을 생성하며, 해당 파일이 존재하지 않을 경우 기존 파일을 덮어씁니다.

필수 환경 변수:

GHE_ORG=     # Github Organization (required if --org option is not specified).
GHE_REPO=    # Github Repository (required if --repo option is not specified).

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token(Optional if you are using --git-token-path)

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url
Git 에 대한 옵션
옵션 설명 값 유형 필수 또는 선택사항 사용 가능한 값 / 기본값 / 설명
아티팩트(artifact) 애플리케이션을 위해 생성된 아티팩트의 이름입니다. 문자열 필수 아티팩트 유형이 이미지인 경우, 다음 형식을 사용하십시오:
<static_name>:<version>@sha256:<sha256_digest>
또는
<static_name>@sha256:<sha256_digest>.

항목 유형이 이미지가 아닌 경우, 모든 항목 업데이트에 걸쳐 변하지 않는 고정 이름을 사용하십시오.
버전 애플리케이션 버전입니다. 문자열 필수
저장소-URL 애플리케이션의 소스 코드 리포지토리(github 또는 GRIT/gitlab 리포지토리)를 가리키는 URL 문자열 필수 이 리포지토리는 도커 리포지토리(예: 아티팩토리)가 아닌 유효한 소스 코드 리포지토리(예: github/Gitlab)여야 합니다
PIPELINE-RUN-ID 파이프라인 실행의 ID입니다. 문자열 필수 이는 증거의 범위를 정하는 데 사용됩니다. 파이프라인 실행 ID 또는 UUID여야 합니다. (예시 값: ' f21321af-9084-4af3-80b8-4fb34143b7d9 )
Commit-sha 아티팩트가 빌드되는 애플리케이션 리포지토리의 커밋입니다. 문자열 필수 긴 형식의 커밋 샤(40자 소문자)여야 합니다
이름 아티팩트가 속한 애플리케이션의 이름 문자열 필수 이 분야는 독특한 분야입니다. name=subdir/foo 와 같은 하위 디렉터리를 사용하면 인벤토리 저장소를 더 잘 정리할 수 있습니다.
빌드 번호 빌드 번호. 필수 빌드 번호는 빌드 아티팩트와 배포 아티팩트를 연관시키는 데 사용됩니다
조직(org) 재고 저장소를 소유하는 GitHub 조직입니다. 문자열 GHE_ORG 환경 변수가 설정된 경우 선택 사항입니다
저장소 인벤토리 저장소의 이름. 문자열 GHE_REPO 환경 변수가 설정된 경우 선택 사항입니다
앱 아티팩트 JSON 형식의 임의 앱 컨텐츠 문자열 선택사항 자동화/워크플로 사용을 위해 여기에 추가 콘텐츠를 추가할 수 있습니다
유형 아티팩트의 유형입니다. 이미지의 경우 "이미지"일 수도 있고, 배포 파일, 헬름 차트 등과 같은 일반 유형의 경우 정적 값일 수도 있습니다. 문자열 필수 사용 가능한 값: 이미지 유형 아티팩트의 경우 ["image"], '
그렇지 않으면 ["helm-chart", "deployment-file] " 또는 임의의 값을 사용할 수 있습니다
sha256 아티팩트의 sha256 해시입니다. 문자열 필수 ' sha256:<64 character hash> 형식이어야 합니다
출처 아티팩트를 가리키는 URL (예: 빌드된 이미지)입니다. 문자열 필수 '이미지' 유형 인벤토리 항목의 경우 출처는 아티팩트 필드와 동일해야 합니다
signature 아티팩트의 서명 문자열 필수
환경 항목이 추가되는 환경의 이름입니다. 문자열 선택사항 기본값: "마스터"
파일에서 인벤토리 항목의 세부 정보가 포함된 파일 이름입니다. 이 플래그를 사용하면 인벤토리 리포지토리에 한 번의 커밋으로 여러 개의 인벤토리 항목을 업로드할 수 있습니다. 문자열 선택사항 예: ' path/to/file.json
git-provider Git 버전 제어 서비스 제공자입니다. 문자열 선택사항 기본값 : "github"
사용 가능한 값 : ["github","gitlab"]
git-token-경로 시크릿을 읽을 Git 토큰 경로 문자열 GHE_TOKEN 환경 변수가 설정된 경우 선택 사항입니다 예: ' path/to/git-token
git-api-url Git API URL 문자열 선택사항 기본값: ' https://<region>.git.cloud.ibm.com/api/v4
위치 다른 레거시에서 아티팩트의 위치와 함께 sha256 문자열 선택사항 예: <environment>#<static_name>:<version>@sha256:<sha256_digest>.
이 플래그는 여러 번 지정할 수 있습니다.

명령 실행:

$ cocoa inventory add \
  --artifact=us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0 \
  --type=image \
  --sha256=sha256:786800e8e48938664fe2397ca14ab8dabd48f34656ef5cfda4143b4519cb714f \
  --name=hello-compliance-app \
  --repository-url=https://github.com/test-org/compliance-app-20201211 \
  --commit-sha=8e86dc4647ce28632103dce46b756c70d339349a \
  --version=v4 \
  --build-number=33 \
  --pipeline-run-id=f21321af-9084-4af3-80b8-4fb34143b7d9 \
  --git-token-path=./git-token \
  --org=test-org \
  --app-artifacts='{"app": "test", "some_value": "value"}' \
  --repo=compliance-inventory-repo
  --signature=owFNUX1IE3EY3vwAEy0VyoSJdkVWtu0+d3eTjNIIi0jETCSU3353cz+83V23myi2BlFgYiUFqSmZLciUzCJkRYJp9IEWFWXB0hAyrBQxEjIIuhFSf70vL8/7vM/zPi3JsaYEc+TnbqG8qrnTPDZ8w2WqiqwtacCghnQEgYQ5GzAkiLKO9PpoLyiwRtSsmugWNVGGIubE/D4bgpoNKXag60gCdo8oSYoVKl5VQsDAWIGqOkmcxAmSYHGO4AjC6gU+3eBxcYxICTRLijyEFOOiSR5SvMhBys2LLpIjWYqDJA6wwHYMeUG1+J8GL5CRW/TpVgFVG8VQ4vMAknE4BUA5OIoQGIKhKZwFkIeAdnECj+OCmxQADh2QoFmG5lkWUiTN8gJ0kDxPuxiWJAU8ekyvV6PegK54EcyGiqwDJItatg9Vy0D3a2IUpKg6UuS/T4KaaIC1fzuMDbfhmMGEvIY64FUxJ+Ew3PMU5SADgdNmKs5kTjBlrtsQ99iyY49nns8o6jsXWgkjPiYahClxVcrK5Flngumz2j7YdmD0ecutytsvxxNPHflKlRV2RyqD69NjC6Smji9XuukFyZ+lvM18gUr7F4NXge9YyZPik411tc1n9bKO/hDz7oGaX/ur94OnNHiwOG6n5ZsrsCsvtyvmkH4zOWlrRWuL7fzgj9zlcCTAhtu2LbeGLNfv3Ju0Jc9PZPk7Pm3Ov2CW+2xj8ReX6ooGamZ610yqRM/+8Qo2XnOeyZzbVKgs+f2+9unpJOve4Tmla+PdqftDWkHPm9Vq3nsyZ2DUkmP/nTb7qNw5l2SfWtiSemJx9nLaYOpx6amlOT18aeIwJQhHg1XOjJF9r18NXQvPuL9rH5tSQqbGhyN/AA== \
  --location=stage#stage-us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0
$ cocoa inventory add \
  --environment=staging \
  --artifact=foo-helm-chart/foo/chart.yaml \
  --repository-url=https://github.com/test-org/compliance-app-20201211 \
  --provenance=https://github.com/test-org/compliance-app-20201211/foo-helm-chart/foo/chart.yaml \
  --commit-sha=786800e8e48938664fe2397ca14ab8dabd48f34656ef5cfda4143b4519cb714f \
  --build-number=33 \
  --pipeline-run-id=f21321af-9084-4af3-80b8-4fb34143b7d9 \
  --version=v4 \
  --name=foo-app-helm-chart \
  --sha256=sha256:9106cdf8c0f5c110f1cdf65825edd195927cdb439db8767791ac2011c2d41894 \
  --signature=9106cdf8c0f5c110f1cdf65825edd195927cdb439db8767791ac2011c2d41894 \
  --type=helm-chart
$ cocoa inventory add --from-file multi-artifacts.json \
  --environment=environment  \
  --org=test \
  --repo=repository

--from-file 옵션 사용

--from-file 옵션을 사용하는 경우 이 명령은 단일 커밋에 여러 항목을 추가하는 것을 지원합니다. 이 옵션은 객체 배열이 포함된 JSON 파일을 기대하며, 배열의 각 객체는 위의 옵션 표에 설명된 것과 동일한 필드를 가져야 합니다. 필드 요구 사항(필수 및 선택 사항)은 개별 명령줄 옵션을 사용할 때와 동일하게 유지됩니다. 유일한 차이점은 이러한 필드를 명령줄 인수로 제공하는 대신 JSON 파일에서 읽는다는 점입니다.

--environment, --org, --repo 옵션은 명령줄에 제공해야 하며 파일의 모든 항목에 적용됩니다.

JSON 파일 구조 예시:

[
  {
    "artifact": "us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0",
    "type": "image",
    "sha256": "sha256:786800e8e48938664fe2397ca14ab8dabd48f34656ef5cfda4143b4519cb714f",
    "name": "hello-compliance-app",
    "repository-url": "https://github.com/test-org/compliance-app-20201211",
    "commit-sha": "8e86dc4647ce28632103dce46b756c70d339349a",
    "version": "v4",
    "build-number": 33,
    "pipeline-run-id": "f21321af-9084-4af3-80b8-4fb34143b7d9",
    "provenance": "us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0",
    "signature": "owFNUX1IE3EY3vwAEy0VyoSJdkVWtu0+d3eTjNIIi0jETCSU3353cz+83V23myi2BlFgYiUFqSmZLciUzCJkRYJp9IEWFWXB0hAyrBQxEjIIuhFSf70vL8/7vM/zPi3JsaYEc+TnbqG8qrnTPDZ8w2WqiqwtacCghnQEgYQ5GzAkiLKO9PpoLyiwRtSsmugWNVGGIubE/D4bgpoNKXag60gCdo8oSYoVKl5VQsDAWIGqOkmcxAmSYHGO4AjC6gU+3eBxcYxICTRLijyEFOOiSR5SvMhBys2LLpIjWYqDJA6wwHYMeUG1+J8GL5CRW/TpVgFVG8VQ4vMAknE4BUA5OIoQGIKhKZwFkIeAdnECj+OCmxQADh2QoFmG5lkWUiTN8gJ0kDxPuxiWJAU8ekyvV6PegK54EcyGiqwDJItatg9Vy0D3a2IUpKg6UuS/T4KaaIC1fzuMDbfhmMGEvIY64FUxJ+Ew3PMU5SADgdNmKs5kTjBlrtsQ99iyY49nns8o6jsXWgkjPiYahClxVcrK5Flngumz2j7YdmD0ecutytsvxxNPHflKlRV2RyqD69NjC6Smji9XuukFyZ+lvM18gUr7F4NXge9YyZPik411tc1n9bKO/hDz7oGaX/ur94OnNHiwOG6n5ZsrsCsvtyvmkH4zOWlrRWuL7fzgj9zlcCTAhtu2LbeGLNfv3Ju0Jc9PZPk7Pm3Ov2CW+2xj8ReX6ooGamZ610yqRM/+8Qo2XnOeyZzbVKgs+f2+9unpJOve4Tmla+PdqftDWkHPm9Vq3nsyZ2DUkmP/nTb7qNw5l2SfWtiSemJx9nLaYOpx6amlOT18aeIwJQhHg1XOjJF9r18NXQvPuL9rH5tSQqbGhyN/AA==",
    "app-artifacts": "{\"app\": \"test\", \"some_value\": \"value\"}",
    "locations": {
      "stage":"stage-us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0",
      "prod":"prod-us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0"
   },
  },
  {
    "artifact": "foo-helm-chart/foo/chart.yaml",
    "repository-url": "https://github.com/test-org/compliance-app-20201211",
    "provenance": "https://github.com/test-org/compliance-app-20201211/foo-helm-chart/foo/chart.yaml",
    "commit-sha": "786800e8e48938664fe2397ca14ab8dabd48f34656ef5cfda4143b4519cb714f",
    "build-number": 34,
    "pipeline-run-id": "f21321af-9084-4af3-80b8-4fb34143b7d9",
    "version": "v4",
    "name": "foo-app-helm-chart",
    "sha256": "sha256:9106cdf8c0f5c110f1cdf65825edd195927cdb439db8767791ac2011c2d41894",
    "signature": "9106cdf8c0f5c110f1cdf65825edd195927cdb439db8767791ac2011c2d41894",
    "type": "helm-chart",
  }
]

--from-file 을 사용하는 경우 다른 레지스트리에 아티팩트의 위치를 제공할 수 있습니다. 이 명령은 locations 필드가 키가 <environment>, 값이 <static_name>:<version>@sha256:<sha256_digest> 형식의 객체일 것으로 예상합니다.

cocoa inventory get

인벤토리 저장소에서 항목을 가져옵니다. 대상은 특정 버전 또는 환경일 수 있습니다. --version 또는 --environment 중 하나만 사용하십시오. --property 옵션이 누락된 경우, 인벤토리 항목의 전체 컨텐츠가 인쇄됩니다.

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token (Optional if you are using --git-token-path)

git의 옵션:

--git-token-path       #(Optional) Github Token's path
--git-api-url          #(Optional) Github API url

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

기본적으로 각 호출의 CLI를 사용하면 최신 버전의 Git 로커로 작업할 수 있습니다. COCOA_USE_CACHE0, false, no 또는 n 를 제외한 임의의 값으로 설정하여 이 동작을 사용 안함으로 설정할 수 있습니다. 이 경우 CLI는 내부 캐시를 사용하여 증거를 검색하지만 (훨씬 더 빠르게) 결과가 손상될 수 있습니다.

명령 실행:

# Uses the environment as target, and pretty-prints only a given property of the inventory entry to the console.
$ cocoa inventory get \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --entry='hello-compliance-app' \
  --environment='master' \
  --property='name'
# Uses the version as target, and pretty-prints the whole content of the inventory entry to the console.
$ cocoa inventory get \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --entry='hello-compliance-app' \
  --version='v1'

cocoa inventory get-sha

인벤토리 저장소에서 레이블이나 환경을 기준으로 최신 커밋 해시를 가져옵니다. --label 또는 --environment 중 하나만 사용하십시오.

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token (Optional if you are using --git-token-path)

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url       #(Optional) Github API url

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 제공되면 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

# Get the latest commit hash of the staging branch
$ cocoa inventory get-sha \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --environment='staging'
# Get the commit hash of the "pipeline-run-id" label
$ cocoa inventory get-sha \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --label='pipeline-run-id'

cocoa inventory label

인벤토리 레이블을 사용하면 인벤토리 항목 내에 레이블을 추가하거나 위치를 변경하여 브랜치나 다른 레이블의 최신 커밋을 타겟팅할 수 있습니다.

옵션:

--org          # The Github organisation which owns the inventory repository.
--repo         # The name of the inventory repository.
--environment  # The inventory branch ( not required for deleting a cocoa inventory label)
--to-label     # Another label in the inventory that can be referenced or removed. ( not required for deleting a cocoa inventory label )

필수 환경 변수:

GHE_ORG=     # Github Organization (required if --org option is not specified).
GHE_REPO=    # Github Repository (required if --repo option is not specified).

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token (Optional if you are using --git-token-path)

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 쌍이 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

# label the latest state on "staging" branch
$ cocoa inventory label add \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --environment='staging' \
  "new-label-to-add"
# attach a label to another label (to the same commit)
$ cocoa inventory label add \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --to-label="some-label" \
  "new-label-to-add"
# move or create the `label-to-move` label to another label (to the same commit)
$ cocoa inventory label move \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --to-label="some-label" \
  "label-to-move"
# delete the `label-to-delete` label from the inventory
$ cocoa inventory label delete \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  "label-to-delete"

cocoa inventory promote

인벤토리의 항목을 한 환경에서 다른 환경으로 승격합니다. 소스 환경은 분기 또는 태그일 수 있습니다.

필수 환경 변수:

GHE_ORG=          # Github Organization (required if --org option is not specified).
GHE_REPO=         # Github Repository (required if --repo option is not specified).
PIPELINE_RUN_ID=  # Can be used instead of --pipeline-run-id (either the option or the variable is required).

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token (Optional if you are using --git-token-path)

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. 둘 다 제공되는 경우 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

$ cocoa inventory promote \
  --org='Github-ID' \
  --repo='compliance-inventory-repo' \
  --source='master' \
  --target='prod' \
  --priority='Critical' \
  --assigned-to='employee@ibm.com' \
  --description='desc' \
  --purpose='purpose' \
  --impact='impact' \
  --customer-impact='impact' \
  --deployment-impact='small' \
  --backout-plan='rollback'

코코아 인벤토리 검증

인벤토리 저장소(또는 JSON 파일)에 있는 항목의 유효성을 검사합니다. 인벤토리 리포지토리는 환경(브랜치) 또는 레이블(태그)의 유효성을 검사할 수 있습니다.

유효성을 검사할 옵션은 다음과 같습니다(플래그 중 하나 이상을 사용해야 함)

  1. 브랜치를 값으로 받아 그 안에 있는 모든 항목의 유효성을 검사하는 ' --environment ' 플래그를 사용합니다.
  2. 태그를 값으로 받아 그 안에 있는 모든 항목의 유효성을 검사하는 ' --label ' 플래그를 사용합니다.
  3. 인벤토리 항목이 포함된 JSON 파일 경로(하이픈으로 묶인 형식)를 받는 ' --from-file ' 플래그를 사용합니다.

선택사항:

  1. 사용자 지정 인벤토리 무시 파일명을 사용해야 하는 경우 ' --inventory-ignore-file-name ' 플래그를 사용하여 기본값을 재정의할 수 있습니다.
  2. 복제된 인벤토리 리포지토리가 이미 존재하고 명령이 이를 활용하도록 하려면 ' --inventory-path 플래그를 사용하여 복제된 인벤토리 리포지토리의 경로를 제공하면 됩니다.

필수 옵션:

--org          # The Github organisation which owns the inventory repository.
--repo         # The name of the inventory repository.
--environment  # The inventory branch to validate
--label        # label in the inventory, that will be validated

환경 변수(선택 사항이며 --org --repo 및 --git-token-path) 제공하는 대신 사용할 수 있음):

GHE_ORG=                    # Can be used instead of --org (either the option or the variable is required)
GHE_REPO=                   # Can be used instead of --repo (either the option or the variable is required)
GHE_TOKEN=    # Github Enterprise API Token (Optional if using --git-token-path)

명령 실행:

$ cocoa inventory validate \
   --org "Github-ID" \
   --repo "inventory-repo" \
   --git-token-path="$INVENTORY_TOKEN_PATH" \
   --label "$latest_tag" \
   --inventory-path "${DIRECTORY_NAME}"

코코아 인벤토리 가져오기-델타

인벤토리 리포지토리에서 커밋 간의 델타를 가져옵니다. 선택적으로 두 커밋 사이의 델타 내에서 피어 리뷰 커밋을 받습니다.

필수 환경 변수:

GHE_ORG=     # Github Organization (required if --org option is not specified).
GHE_REPO=    # Github Repository (required if --repo option is not specified).

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token(Optional if you are using --git-token-path)

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url
Git 에 대한 옵션
옵션 설명 값 유형 필수 또는 선택사항 사용 가능한 값 / 기본값 / 설명
from-sha 델타 계산을 위한 시작 커밋은 문자열 선택사항
라벨에서 델타 계산을 위한 시작 커밋으로 사용할 태그는 다음에서 문자열 선택사항
토샤 델타 계산을 위한 최종 커밋은 다음과 같습니다 문자열 선택사항
환경 환경 브랜치의 HEAD 커밋은 델타까지 계산하기 위한 문자열 선택사항
라벨 지정 델타까지 계산할 최종 커밋을 나타내는 태그입니다 문자열 선택사항
조직(org) 재고 저장소를 소유하는 GitHub 조직입니다. 문자열 GHE_ORG 환경 변수가 설정된 경우 선택 사항입니다
저장소 인벤토리 저장소의 이름. 문자열 GHE_REPO 환경 변수가 설정된 경우 선택 사항입니다
git-provider Git 버전 제어 서비스 제공자입니다. 문자열 선택사항 기본값 : "github"
사용 가능한 값 : ["github","gitlab"]
git-token-경로 시크릿을 읽을 Git 토큰 경로 문자열 GHE_TOKEN 환경 변수가 설정된 경우 선택 사항입니다 예: ' path/to/git-token
git-api-url Git API URL 문자열 선택사항 기본값: ' https://<region>.git.cloud.ibm.com/api/v4
델타 델타 계산 플래그 부울 선택사항 아니오
델타 삭제 델타 삭제를 계산하는 플래그 부울 선택사항 아니오
인벤토리 목록 전체 인벤토리 목록 계산을 위한 플래그 부울 선택사항 아니오
동료 검토 동료 리뷰 커밋을 계산하는 플래그 부울 선택사항 아니오
인벤토리-레포-경로 인벤토리 저장소의 선택적 경로입니다. 전달하면 명령 내에서 인벤토리 저장소가 복제되지 않습니다 문자열 선택사항
인벤토리-무시-파일-경로 인벤토리 무시 파일의 선택적 경로 문자열 선택사항
이전 인벤토리 무시 파일 경로 이전 배포 인벤토리 무시 파일에 대한 선택적 경로 문자열 선택사항

명령 실행:

$ cocoa inventory get-delta \
  --git-provider=github \
  --git-token-path=./git-token \
  --org=test-org \
  --repo=compliance-inventory-repo \
  --git-api-url=<git-api-url> \
  --to-sha 534ff2bbbf0291e10f3b1f6aa409d8de059bbe27 \
  --from-sha e54b5aa12ccb687020ac04b16d489b5a04f90399 \
  --inventory-ignore-file-path=/path/to/current/.inventoryignore \
  --previous-inventory-ignore-file-path=/path/to/previous/.inventoryignore \
  --delta \
  --delta-deletion \
  --inventory-list \
  --peer-review

코코아 재고 업데이트-위치

인벤토리 저장소에 항목/아티팩트 위치를 업데이트합니다.

필수 환경 변수:

GHE_ORG=     # Github Organization (required if --org option is not specified).
GHE_REPO=    # Github Repository (required if --repo option is not specified).

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token(Optional if you are using --git-token-path)

git의 옵션:

--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url
Git 에 대한 옵션
옵션 설명 값 유형 필수 또는 선택사항 사용 가능한 값 / 기본값 / 설명
이름 아티팩트가 속한 애플리케이션의 이름 문자열 필수
조직(org) 재고 저장소를 소유하는 GitHub 조직입니다. 문자열 GHE_ORG 환경 변수가 설정된 경우 선택 사항입니다
저장소 인벤토리 저장소의 이름. 문자열 GHE_REPO 환경 변수가 설정된 경우 선택 사항입니다
환경 항목이 추가되는 환경의 이름입니다. 문자열 선택사항 기본값: "마스터"
git-provider Git 버전 제어 서비스 제공자입니다. 문자열 선택사항 기본값 : "github"
사용 가능한 값 : ["github","gitlab"]
git-token-경로 시크릿을 읽을 Git 토큰 경로 문자열 GHE_TOKEN 환경 변수가 설정된 경우 선택 사항입니다 예: ' path/to/git-token
git-api-url Git API URL 문자열 선택사항 기본값: ' https://<region>.git.cloud.ibm.com/api/v4
위치 다른 레거시에서 아티팩트의 위치와 함께 sha256 문자열 선택사항 예: <environment>#<static_name>:<version>@sha256:<sha256_digest>.
이 플래그는 여러 번 지정할 수 있습니다.

명령 실행:

$ cocoa inventory update-locations \
  --name=hello-compliance-app \
  --git-token-path=./git-token \
  --org=test-org \
  --repo=compliance-inventory-repo \
  --location=stage#stage-us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0 \
  --location=prod#prod-us.icr.io/namespace/hello-compliance-app:20201217081811-master-b85e3d472e9cc35b429c39e8c3f9eb282738c20a@sha256:da36831d5154307ac9ca4b8d900df2da0c6c14754977c32479dc62994b5722d0

코코아 인시던트 명령

Cocoa 인시던트 프로세스

이 명령어는 제공된 스캔 결과를 처리하고, 각 취약점별로 지정된 저장소에 인시던트 이슈를 생성합니다. 주제-인시던트 쌍에 대한 문제가 이미 있는 경우 새 문제를 작성하지 않습니다.

--set-grace-period 가 설정되면 유예 기간 (grace period) 이 설정된 문제를 작성하거나 유예 기간 (grace period) 이 있도록 기존 문제를 업데이트합니다.

사용 가능한 경우 유예 기간은 15일로 설정됩니다. 인시던트 문제에 대해 면제 또는 유예 기간이 설정된 경우 검사에서 문제를 나열하지만 오류로 표시하지는 않습니다.

예외는 CR VA에서 구성되거나 면제 승인을 위해 인시던트 또는 CVE를 제출할 수 있습니다. 승인된 경우 인시던트 문제를 편집하고 ( Excempt: **true** 설정) 승인된 요청에 링크할 수 있습니다.

현재 지원되는 스캔 결과 파일:

  • Container Registry VA 스캔 (옵션 --type va)
  • CRA 취약성 스캔 (옵션 --type cra)
  • CRA CIS 스캔 (옵션 --type cra-cis)
  • Xray (옵션 --type xray)
  • OWASP ZAP (옵션 --type owasp-zap)
  • OWASP ZAP UI (옵션 --type owasp-zap-ui)
  • Twistlock (옵션 --type twistlock)
  • 컨테이너 이미지 멀티 스캐너(CIMS) 스캔 (옵션 --type cims)
  • 피어 검토 스캔 (옵션 --type peer-review)
  • GoLang 보안 스캔 (옵션 --type gosec)
  • SonarQube Scan (옵션 --type sonarqube)
  • Mend Scan (옵션 --type mend)
  • SAST 스캔 수정 ( --type mend-sast 옵션)
  • Checkov (옵션 --type checkov)
  • Terraform에 대한 CRA 취약성 스캔 (옵션 --type cra-tf)
  • Terraform 보안 스캔 (옵션 --type tfsec)
  • Fips 스캐너 (옵션 --type fips-scanner)
  • 시크릿 발견 (옵션 --type detect-secrets)
  • Sysdig (옵션 --type sysdig)
  • CycloneDX (옵션 --type cyclonedx)
  • Grype (옵션 --type grype)

Container Registry VA 및 결과 형식에 대한 자세한 내용은 Vulnerability Advisor for IBM Cloud Container Registry을 참조하세요. CRA 취약성 스캐너에 대한 자세한 정보는 코드 위험 분석기 구성문서를 참조하십시오.

사용법:

$ cocoa incident process \
  <options> \
  <path to result file>

옵션:

--type             # (Required) Scan type [choices: "cra", "va", "xray", "peer-review", "gosec","owasp-zap", "owasp-zap-ui", "sonarqube", "twistlock", "cims", "mend","mend-sast", "checkov", "cra-tf", "tfsec", "fips-scanner", "contrast-sast","detect-secrets", "sysdig", "cyclonedx", "grype", "cra-cis"]
--subject          # (Required) Subject of scans (repo, or image name)
--drilldown-url    # (Required) URL to the point where the incident was found (can be a pipeline run, a commit hash or an image URL with digest)
--set-grace-period # Should the created incidents have Grace period set
--git-provider     # Git service provider [github] Default is "github"
--org              # The incident issue repository org
--repo             # The incident issue repository name
--label            # Label(s) to add to the incident issue (optional) e.g: --label=foo --label=bar
--assignee         #(Optional) Assignee(s) for the incident issue (github username) e.g: --assignee=jane-doe --assignee=john-smith
--git-token-path   #(Optional) Github Token's path
--git-api-url      #(Optional) Github API url
--custom-exempt-label # (Optional) Defines the custom label with which the incident issue has been marked as exempted
--custom-comment   # (Optional) Additional text to be added to issue comments
--format           # (Optional) Format of the output ("list", "json", default: "list")

필수 환경 변수:

INCIDENT_REPO_ORG=        # Can be used instead of --org (either the option or the variable is required)
INCIDENT_REPO_NAME=       # Can be used instead of --repo (either the option or the variable is required)

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=                # Github Enterprise API Token (Optional if you are using --git-token-path)

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. 둘 다 제공되는 경우 --git-token-path--git-api-url 가 우선합니다.

리턴값:

  • 문제가 없거나 발견된 모든 문제에 면제 또는 유예 기간이 설정되어 있는 경우 명령은 0상태로 종료됩니다.
  • 발견된 문제에 면제 또는 유예 기간이 설정되지 않은 경우 0이 아닌 상태로 명령이 종료됩니다.
  • If format == list-명령은 결과 파일 및 주제에 따라 발견되거나 작성된 인시던트 문제 URL을 나열합니다.
  • If format == json-명령은 찾은 각 문제에 대한 찾은 결과 오브젝트의 배열 (추가 문제 정보) 을 포함하는 JSON을 인쇄합니다. 결과 파일 및 주제에 따라 작성되고 자동으로 닫힙니다.
  • 문제에 해당하는 찾은 결과 JSON 오브젝트의 구조:
{
 "id": string,
 "due_date": string,
 "severity": ("high", "medium", "low", "critical, "informational"),
 "first_found": "string" (optional),
 "url": string,
 "found_status": ("new", "existing", "autoclosed", "readonly"),
 "has_exempt": boolean
}

명령 실행:

$ cocoa incident process \
  --type va \
  --subject us.icr.io/service-image \
  --drilldown-url us.icr.io/service-image@sha256:digest \
  path/to/scan-result.json

Cocoa 인시던트 프로세스-레거시

이 명령은 스캔 파일을 사용할 수 없을 때 시나리오에 대해 제공된 저장소에서 인시던트 문제를 작성합니다. 일반적으로 이러한 시나리오는 단위 테스트 실패, 분기 보호 실패, 승인 테스트 실패 및 이미지 서명 실패와 같은 비취약성 관련 실패입니다. 이러한 장애는 취약성이 없지만 준수 상태에서 벗어나는 것입니다. 인시던트 주제 도구 조합에 대한 문제가 이미 있는 경우에는 명령이 새 문제를 작성하지 않습니다. 기본적으로 high 심각도 등급은 작성된 문제로 설정됩니다.

--set-due-date 가 설정되면 명령은 문제를 작성하거나 만기 날짜가 있는 기존 문제를 업데이트합니다. 만기 날짜는 심각도를 기반으로 안건의 유예 기간에서 계산됩니다.

--close-resolved-issues 플래그가 설정된 경우 명령은 현재 실행과 동일한 도구, 주제 및 인시던트 ID를 사용하여 열린 문제를 검색합니다. --current-statussuccess 로 전달되는 동안 발견된 문제가 있는 경우 명령은 해당 문제를 닫습니다.

--read-only 가 설정되면 명령은 새 문제를 작성하거나 기존 문제를 수정하지 않습니다. 결과가 처리되고 결과에 대한 기존 문제가 수집됩니다. 출력에는 읽기 전용 모드가 활성화되어 있지 않은 경우 이슈에서 추적해야 하는 이슈 URL 목록이 포함되어 있습니다.

사용법:

cocoa incident process-legacy \
  <options>

옵션:

--type             # (Required) Tool type
--subject          # (Required) Subject of scans (repo, or image name)
--drilldown-url    # (Required) URL to the point where the incident was found (can be a pipeline run, a commit hash or an image URL with digest)
--set-grace-period # Should the created incidents have Grace period set
--git-provider     # Git service provider [github] Default is "github"
--org              # The incident issue repository org
--repo             # The incident issue repository name
--label            # Label(s) to add to the incident issue (optional) e.g: --label=foo --label=bar
--assignee          #(Optional) Assignee(s) for the incident issue (github username) e.g: --assignee=jane-doe --assignee=john-smith
--git-token-path    #(Optional) Github Token's path
--git-api-url           #(Optional) Github API url
--close-resolved-issues # (Optional) Checking and closing resolved issues
--pipeline-run-url      # (Optional) The url to the pipeline run running the CLI command
--is-prod          # (Optional) Flag for whether or not the command was run in production environment. Default is false.
--read-only        # (Optional) Process result file in read-only mode (return found and existing issues, do not create new ones, set processed status to failure or success). Default is false
--custom-exempt-label # (Optional) Defines the custom label with which the incident has been marked as exempted
--incident-id         # (Required) Defines the incident ID to be used for creating legacy incident
--current-status      # (Required) Current status to be treated as success or failure [choices: "success", "failure"]
--custom-comment   # (Optional) Additional text to be added to issue comments
--format           # (Optional) Format of the output ("list", "json", default: "list")
--additional-comment  # (Optional) Additional comment for the issue on every run

환경 변수:

INCIDENT_REPO_ORG=    # Can be used instead of --org (either the option or the variable is required)
INCIDENT_REPO_NAME=   # Can be used instead of --repo (either the option or the variable is required)
# Required Environment Variables, if using GitHub:
GHE_TOKEN=    # Github Enterprise API Token (Optional if using --git-token-path)

github 을 사용하는 경우 --git-token-path 필드를 사용하여 GitHub 토큰을 설정하고 --git-api-url 필드를 사용하여 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL (기본값은 https://<region>.git.cloud.ibm.com/api/v4 )을 설정할 수 있습니다. GHE_TOKEN GH_URL--git-token-path --git-api-url 두 쌍이 모두 제공되는 경우 --git-token-path--git-api-url 가 우선합니다.

리턴값:

  • 이 명령은 --current-statusfailure 로 전달된 경우 발견되거나 작성된 인시던트 문제 URL을 나열합니다. 이 명령은 --current-statusfailure 로 전달된 경우 동일한 incident-tool-subject 조합과 일치하는 인시던트 문제 URL도닫습니다.
  • --read-only 모드에서 명령은 해당 인시던트에 대한 문제가 없는 경우 발견된 인시던트의 세부사항을 나열합니다.
  • 발견된 문제가 없거나 발견된 모든 문제에 면제 레이블이 설정되어 있는 경우, 명령은 0상태로 종료됩니다.
  • 발견된 문제에 면제 레이블이 설정되지 않은 경우 0이 아닌 상태로 명령이 종료됩니다.
  • --read-only 모드에서 문제가 없는 새 인시던트가 발견되면 0이 아닌 상태로 명령이 종료됩니다.
  • If format == list-이 명령은 --current-statusfailure 로 전달된 경우 발견되거나 작성된 인시던트 문제 URL을 나열합니다.
  • If format == json-명령은 찾은 각 문제에 대한 찾은 결과 오브젝트의 배열 (추가 문제 정보) 을 포함하는 JSON을 인쇄합니다. 결과 파일 및 주제에 따라 작성되고 자동으로 닫힙니다.
  • 문제에 해당하는 찾은 결과 JSON 오브젝트의 구조:
{
 "id": string,
 "due_date": string,
 "severity": ("high", "medium", "low", "critical, "informational"),
 "first_found": "string" (optional),
 "url": string,
 "found_status": ("new", "existing", "autoclosed", "readonly"),
 "has_exempt": boolean
}

명령 실행:

$ cocoa incident process-legacy \
   --type jest \
   --subject us.icr.io/service-image \
   --drilldown-url us.icr.io/service-image@sha256:digest \
   --incident-id com.ibm.unit_tests_master \
   --current-status success \
   --close-resolved-issues

코코아 사건 평가

due_date를 기반으로 문제의 상태를 평가하고 레이블을 면제하고 문제 찾은 결과를 출력합니다.

사용법:

$ cocoa incident evaluate \
  <options> \
  <filePath>

옵션:

--git-provider         # Git service provider [github] Default is "github"
--org                  # The incident issue repository org
--repo                 # The incident issue repository name
--filePath             # Path to the JSON file that contains issues to be evaluated
--git-token-path       # (Optional) Github Token's path
--git-api-url          # (Optional) Github API url
--custom-exempt-label  # (Optional) Defines the custom label with which the incident issue has been marked as exempted
--is-prod              # (Optional) Whether or not the command was run in prod environment
--format               # (Optional) Format of the output ("list", "json", default: "list")

필수 환경 변수:

INCIDENT_REPO_ORG=        # Can be used instead of --org (either the option or the variable is required)
INCIDENT_REPO_NAME=       # Can be used instead of --repo (either the option or the variable is required)

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=                # Github Enterprise API Token (Optional if you are using --git-token-path)

github 를 사용하는 경우 --git-token-path 필드에 GitHub 토큰을 설정하고 --git-api-url 필드에 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. 둘 다 제공되는 경우 --git-token-path--git-api-url 가 우선합니다.

리턴값:

  • 발견된 모든 문제에 면제 또는 유예 기간이 설정된 경우 명령은 0상태로 종료됩니다.
  • 발견된 문제에 면제 또는 유예 기간이 설정되지 않은 경우 0이 아닌 상태로 명령이 종료됩니다.
  • 찾은 결과의 JSON 배열입니다.
  • 문제에 해당하는 찾은 결과 JSON 오브젝트의 구조입니다.
json
{
  "id": string,
  "due_date": string,
  "severity": ("high", "medium", "low", "critical, "informational"),
  "first_found": "string" (optional),
  "url": string,
  "found_status": ("new", "existing", "autoclosed", "readonly"),
  "has_exempt": boolean
}

명령 실행:

$ cocoa incident evaluate \
  --org \
  --repo \
  --git-provider \
  --git-token-path \
  --filePath

코코아 인시던트 업데이트 상태

지정된 인시던트 이슈 URL 현재 상태에 따라 인시던트 이슈 상태를 open ot close 으로 업데이트합니다.

코드 스니펫:

$ cocoa incident update-state \
  <options>

옵션:

다음 선택적 변수와 값을 지정하여 쿠카 인시던트 문제에 대한 자세한 정보를 제공하세요.

--org             # The incident issue repo org
--repo            # The incident issue repo name
--git-provider    # Git service provider [github, gitlab] Default is "github"
--git-token-path  # (Optional) Github Token's path
--git-api-url     # (Optional) Github API url
--issue-url       # Issue URL whose state is to be updated
--to-state        # target state for the issue to be updated [choices: "open", "close"]
--comment         # (Optional) Comment to be added to the issue being updated
--update-exempt   # (Optional) Flag to update state of exempted issues, default: false

필수 환경 변수:

앞서 선택적 변수를 사용하지 않은 경우 다음 환경 변수와 해당 값을 제공해야 합니다(--org--repo 옵션 변수).

INCIDENT_REPO_ORG=        # Must be used if --org optional variable is not used.
INCIDENT_REPO_NAME=       # Must be used if ---repo optional variable is not used.

git-providergithub 인 경우 다음 필수 환경 변수를 사용하세요:

GHE_TOKEN=                # Github Enterprise API Token (Optional if you are using --git-token-path)
GH_URL=                   # Github API url (Optional if you are using --git-api-url)

선택적 변수 --git-token-path--git-api-url 를 사용하여 GitHub의 토큰 경로 및 API URL 값을 제공할 수도 있습니다. 선택적 변수가 둘 다 제공되면 --git-token-path--git-api-url 가 더 높은 우선순위를 갖습니다.

리턴값:

  • 이슈의 상태 업데이트가 성공하면 반환 코드 0 과 함께 명령이 종료됩니다.
  • 이슈의 상태 업데이트가 성공하지 못하면 반환 코드 1 과 함께 명령이 종료됩니다.

명령 실행:

$ cocoa incident update-state \
  --org \
  --repo \
  --git-provider \
  --git-token-path \
  --git-api-url \
  --issue-url \
  --comment \
  --to-state

코코아 라커 명령

증거 자료와 첨부 파일을 Cloud Object Storage 에 업로드하여 보관할 수도 있습니다. 다음 환경 변수가 있으면 자동으로 수행됩니다.

  • COS_ENDPOINT: Cloud Object Storage 버킷에 액세스할 수 있는 엔드포인트입니다.
  • COS_BUCKET_NAME: Cloud Object Storage 버킷의 이름입니다.
  • COS_API_KEY: Cloud Object Storage 버킷에 대한 쓰기 액세스 권한이 있는 IBM Cloud API키또는 서비스 ID API키입니다.
  • BACKUP_COS_ENDPOINT: Cloud Object Storage 버킷에 액세스할 수 있는 엔드포인트입니다.
  • BACKUP_COS_BUCKET_NAME BackupCloud Object Storage 버킷의 이름입니다.
  • BACKUP_COS_API_KEY: Cloud Object Storage 버킷에 대한 리더 액세스 권한이 있는 IBM Cloud API 키 또는 서비스 ID API 키입니다.
  • IBM_AUTH_ENDPOINT: API키를 사용하여 IAM 토큰(기본값은 https://iam.cloud.ibm.com/identity/token){: external}을 생성할 수 있는 엔드포인트입니다.

코코아 라커 자산 추가 < URI>

증거 로커에 자산을 추가합니다. 지정된 자산이 있는 경우 자산 정보를 표시합니다.

옵션:

--type             # Type of the asset ( All types are supported )
--version          # Show version number
--format           # Output format ("id", "json", default: "id")
--related          # The ID of a related asset (default: [])
--date             # Asset creation date
--details          # Additional asset details, as key=value pairs (default: [])
--origin           # Additional details about the origin of the asset, as key=value pairs (default: [])
--dry-run          # Shows what would be added to the locker (default: false)

사물함에 아무 것도 추가하지 않고 사물함에 무엇이 추가되는지 확인하려면 --dry-run 플래그를 사용하십시오.

자산의 유형은 --type 플래그를 사용하여 지정할 수 있습니다.

uri 매개변수는 임의의 유효한 URI일 수 있지만 몇 가지 형식이 특별히 처리됩니다.

  • uri scheme이 docker 인 경우 (즉, docker:// 로 시작함), 명령은 --type=image 플래그를 가정합니다.
  • uri 스키마가 git 이거나 경로가 .git 접미부로 끝나는 경우, 명령은 --type=commit 플래그를 가정합니다.

typeimage 또는 commit 인 경우 URI는 다음 패턴과 일치해야 합니다.

  • image 의 경우 URI에 이미지 요약 (예: docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777) 이 반드시 포함되어야 합니다.

typeimage 또는 commit 이외의 값인 경우 --type 플래그를 명시적으로 전달해야 합니다.

key=value 쌍을 허용하는 --details 플래그를 사용하여 자산에 추가 세부사항을 추가할 수 있습니다.

자산의 오리진에 대한 자세한 정보는 key=value 쌍을 허용하는 --origin 플래그를 사용하여 제공할 수 있습니다.

일부 환경 변수는 자산 오리진에 대한 세부사항을 추가하기 위해 자동으로 선택됩니다.

  • TOOLCHAIN_CRN 설정은 --origin toolchain_crn=$TOOLCHAIN_CRN 지정과 동일합니다.
  • PIPELINE_ID 설정은 --origin pipeline_id=$PIPELINE_ID 지정과 동일합니다.
  • PIPELINE_RUN_ID 설정은 --origin pipeline_run_id=$PIPELINE_RUN_ID 지정과 동일합니다.

--date 플래그를 사용하여 자산 작성 날짜 (기본값은 현재 시간) 를 대체할 수 있습니다. 이 플래그는 Date.parse 에서 허용하는 모든 문자열을 허용합니다.

관련 자산은 --related 플래그를 사용하여 추가할 수 있습니다 (여러 관련 자산의 경우 플래그를 여러 번 지정할 수 있음). 자산은 내부 ID 또는 URI를 사용하여 지정할 수 있습니다. 모든 관련 에셋 ID(첫 번째 에셋까지 전체 트리)가 에셋 json의 parents 필드에 추가됩니다.

기본적으로 id 형식 ( --format 플래그) 은 작성된 자산의 내부 ID를 인쇄합니다. json 형식을 사용하면 전체 자산이 JSON 오브젝트로 인쇄됩니다.

Git 커미트를 추가하는 명령 실행:

$ cocoa locker asset add 'https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee' \
                         --details tag=v1.2.3

출력 예:

b5bbbbb55555b5555b555b55b5555bb5b555b5b555bb5b55bbb5555fbbbbb

다음 명령을 실행하여 Docker 이미지를 추가하십시오.

$ cocoa locker asset add docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777 \
                         --origin "job_name=my job" \
                         --related https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee \
                         --format json

출력 예:

{
   "version": "1.1",
   "id": "0000000011111111222222223333333344444444555555556666666677777777",
   "uri": "docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777",
   "origin": {
    "job_name": "my job",
    "toolchain_crn": "crn:v1:bluemix:public:toolchain:au-syd:a/111111111111c2f2222222222b22a7a63:ac2a22a2-2a2a-2222-aaa2-222aa22a2a2a::",
    "pipeline_run_id": "f333b3bc-3333-3fea-3333-333d3a3b33b3",
    "pipeline_id": "444aaa4a-b4c4-4444-4f4b-aa4444a444a4"
   },
   "details": {
    "registry": "us.icr.io",
    "name": "foo/bar",
    "tag": "v1.2.3",
    "digest": "0000000011111111222222223333333344444444555555556666666677777777"
   },
   "date": "2021-07-15T14:26:06.301Z",
   "type": "image",
   "related": [
    "b5bbbbb55555b5555b555b55b5555bb5b555b5b555bb5b55bbb5555fbbbbb"
   ],
   "parents": [
    "b5bbbbb55555b5555b555b55b5555bb5b555b5b555bb5b55bbb5555fbbbbb"
   ]
}

다음 명령을 실행하여 릴리스를 추가하십시오.

$ cocoa locker asset add release:my-app@v1.2.3 \
                         --type generic \
                         --date 2021-06-01T12:00:00 \
                         --related docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777

출력 예:

36d8852458adf44ab236c99beb69d7070d461d39480bc6b8ef7c771bee93cb49%

코코아 라커 자산 가져오기 < URI>

증거 보관함에서 자산을 검색합니다.

옵션:

--type             # Type of the asset
--version          # Show version number
--format           # Output format ("id", "json", default: "id")

다음 명령을 실행하십시오.

 cocoa locker asset get release:my-app@v1.2.3 --format json

출력 예:

{
   "version": "1.1",
   "id": "36d8852458adf44ab236c99beb69d7070d461d39480bc6b8ef7c771bee93cb49",
   "uri": "release:my-app@v1.2.3",
   "origin": {
    "toolchain_crn": "crn:v1:bluemix:public:toolchain:au-syd:a/111111111111c2f2222222222b22a7a63:ac2a22a2-2a2a-2222-aaa2-222aa22a2a2a::",
    "pipeline_run_id": "f333b3bc-3333-3fea-3333-333d3a3b33b3",
    "pipeline_id": "444aaa4a-b4c4-4444-4f4b-aa4444a444a4"
   },
   "details": {
    "sha": "aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee",
    "repository": <repository-url>,
    "tag": "v1.2.3"
   },
   "date": "2021-07-15T14:26:06.301Z",
   "type": "image",
   "related": ["0000000011111111222222223333333344444444555555556666666677777777"],
   "parents": ["0000000011111111222222223333333344444444555555556666666677777777", "b5bbbbb55555b5555b555b55b5555bb5b555b5b555bb5b55bbb5555fbbbbb"]
}
 cocoa locker asset get docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777 --format json

출력 예:

{
   "version": "1.1",
   "id": "0000000011111111222222223333333344444444555555556666666677777777",
   "uri": "docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777",
   "origin": {
    "toolchain_crn": "crn:v1:bluemix:public:toolchain:au-syd:a/111111111111c2f2222222222b22a7a63:ac2a22a2-2a2a-2222-aaa2-222aa22a2a2a::",
    "pipeline_run_id": "f333b3bc-3333-3fea-3333-333d3a3b33b3",
    "pipeline_id": "444aaa4a-b4c4-4444-4f4b-aa4444a444a4"
   },
   "details": {
    "sha": "aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee",
    "repository": <repository-url>,
    "tag": "v1.2.3"
   },
   "date": "2021-07-15T14:26:06.301Z",
   "type": "image",
   "related": [],
   "parents": ["b5bbbbb55555b5555b555b55b5555bb5b555b5b555bb5b55bbb5555fbbbbb"]
}
 cocoa locker asset get https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee --format json

출력 예:

{
   "version": "1.1",
   "id": "0000000011111111222222223333333344444444555555556666666677777777",
   "uri": "docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777",
   "origin": {
    "toolchain_crn": "crn:v1:bluemix:public:toolchain:au-syd:a/111111111111c2f2222222222b22a7a63:ac2a22a2-2a2a-2222-aaa2-222aa22a2a2a::",
    "pipeline_run_id": "f333b3bc-3333-3fea-3333-333d3a3b33b3",
    "pipeline_id": "444aaa4a-b4c4-4444-4f4b-aa4444a444a4"
   },
   "details": {
    "sha": "aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee",
    "repository": <repository-url>,
    "tag": "v1.2.3"
   },
   "date": "2021-07-15T14:26:06.301Z",
   "type": "image",
   "related": [],
   "parents": []
}

코코아 라커 자산 요약 가져오기 < URI>

증거 보관함에서 지정된 자산에 대한 증거 요약을 수집합니다.

옵션:

--scope                   # (Required) Pipeline run ID of the CI piepline where the asset is built
--environment             # (Required) Name of the environment from which evidences are fetched, if the `service-environment` is `pre_prod`
                            This value must be the same as the `target-environment`. Or, if `service-environment` is `prod`, then this value must be the same as the `source-environment`
--service-environment     # Service environment of the asset get summary in deployed environment
                            (choices: 'pre_prod', 'dev', 'prod',  default: 'pre_prod')
--latest                  # Fetches the latest evidence summary of the asset for the `service-environment`.
                            The summary of the scope passed-in using `--scope` will be excluded. Currently supported for `dev` environment only.

다음 명령을 실행하십시오.

 cocoa locker asset summary get https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee \
  --scope 11a1aa11-1a11-11a1-aa11-a11a1a1111a1 \
  --environment prod \
  --service-environment prod

다음을 사용하여 전달된 범위를 제외한 최신 증거 요약을 가져오는 명령을 실행합니다.--scope:

 cocoa locker asset summary get https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee \
  --scope 11a1aa11-1a11-11a1-aa11-a11a1a1111a1 \
  --environment dev \
  --service-environment dev \
  --latest

코코아 라커 자산 목록 < URI>

증거 보관함에서 관련 자산을 나열합니다.

옵션:

--type             # Type of the asset
--version          # Show version number
--format           # Output format ("id", "json", default: "id")

다음 명령을 실행하십시오.

 cocoa locker asset list release:my-app@v1.2.3 --format id --type generic

출력 예:

1122211111122222111111111111111111111111111111666661111111111111
2222222222555552222222222222222333333222222222222222222222222222
3333333337777773333333333333333333333333333333344444433333333333

jq와 결합된 json 형식을 사용하여 명령 실행:

 cocoa locker asset list release:my-app@v1.2.3 --format json --type generic | jq -r '.[].uri'

출력 예:

release:my-app@v1.2.3
docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777
https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee

코코아 라커 증거 추가

증거 사물함에 증거를 추가합니다.

플래그를 사용하여 증거 로커를 지정할 수 있습니다. 자세한 정보는 코코아 라커 명령 을 참조하십시오.

다음 플래그를 사용하여 증거를 구성할 수 있습니다:

  • --evidence-type: 증거의 유형을 식별하는 문자열입니다 (예: com.ibm.unit_test).
  • --evidence-type-version: 증거 세부사항 스키마를 식별하는 문자열 (예: 1.0.0, v2 등)

일부 선택적 플래그도 지정할 수 있습니다.

  • --date: 증거 작성 날짜 (기본값은 현재 시간소인입니다.), Date.parse 로 구문 분석할 수 있는 문자열을 허용합니다.
  • --details: 증거 세부사항을 key=value 쌍으로 지정할 수 있으며 플래그를 여러 번 지정할 수 있습니다 (예: --details result=success --details foo=bar 등).
  • --origin: 증거의 기점에 대한 세부사항은 key=value 쌍 (예: --origin job_id=123 등) 을 사용하여 지정할 수 있습니다.
  • --asset: 증거와 관련된 자산 (해당 URI 또는 내부 ID별) 을 지정합니다. cocoa locker asset 명령을 참조하십시오. 플래그는 여러 번 지정할 수 있습니다. 자산이 이미 사물함에 있어야 합니다.
  • --attachment: 증거에 대한 파일 첨부를 지정합니다. 각 첨부 파일은 기존 파일을 가리켜야 하며 각 첨부 파일 이름은 고유해야 합니다 (즉, --attachment a/foo.json --attachment b/foo.json 은 허용되지 않음).
  • --attachment-url: 증거 보관함에 이미 저장된 첨부 파일의 URL을 지정합니다. 각 URL 고유한 첨부파일을 가리켜야 하며 중복되지 않도록 해야 합니다. 이 플래그는 여러 URL을 포함하도록 여러 번 지정할 수 있습니다.
  • --issue: 찾은 결과와 관련된 활동을 추적하는 데 사용할 수 있는 문제 URL의 목록입니다. 플래그는 여러 번 전달될 수 있습니다.
  • --findings-path: 인시던트 프로세스 명령의 출력인 JSON찾은 결과의 배열을 전달하려면 이 경로를 사용하십시오.
  • --scope: 여러 소스의 증거를 상관시키는 데 사용할 수 있는 고유 ID입니다.
  • --comment-on-issues: --issue 플래그를 사용하여 제공된 인시던트 문제에 작성된 증거에 대한 세부사항이 있는 주석을 추가합니다.
    • 문제가 github 에 있을 수 있으므로 제공자는 문제 URL에서 구문 분석됩니다.
    • 모든 문제는 동일한 저장소에서 발생해야 합니다.
    • 문제 URL은 다음 패턴과 일치해야 합니다.
      • https://<host>/<owner>/<name>/issues/<issue number>- github
    • 문제 저장소에 액세스하는 데 필요한 환경 변수:
      • URL이 github 문제를 가리키는 경우:
        • GH_URL: 선택사항. 기본값은 https://<region>.git.cloud.ibm.com/api/v4 입니다.
        • GHE_TOKEN

증거 JSON의 첨부 파일에 대한 레이블 정보:

증거 JSON의 각 첨부 파일 섹션에는 첨부 파일에 대한 메타데이터를 보유하는 레이블 특성이 있습니다. 기본값은 레이블에 지정되며 이 값은 첨부 입력이 파일 경로 또는 첨부 URL인지 여부에 따라 다릅니다. 첨부 경로 또는 첨부 URL끝에 ::label=<value> 를 추가하여 사용자 정의 레이블을 전달하십시오.

예:

  • --attachment path/to/attachment::label=label_name- path/to/attachment 의 파일을 사용하여 첨부를 작성하고 레이블 값을 label_name 로 설정합니다. 레이블이 전달되지 않으면 기본적으로 파일 이름이 레이블 값으로 사용됩니다.

  • --attachment-url url/of/attachment::label=label_name- attachment-url 에 지정된 첨부를 사용하고 레이블 값을 label_name 로 설정합니다. 레이블이 전달되지 않으면 레이블 값은 기본적으로 비어 있는 문자열입니다.

일부 환경 변수는 자산 오리진에 대한 세부사항을 추가하기 위해 자동으로 선택됩니다.

  • TOOLCHAIN_CRN 설정은 --origin toolchain_crn=$TOOLCHAIN_CRN 지정과 동일합니다.
  • PIPELINE_ID 설정은 --origin pipeline_id=$PIPELINE_ID 지정과 동일합니다.
  • PIPELINE_RUN_ID 설정은 --origin pipeline_run_id=$PIPELINE_RUN_ID 지정과 동일합니다.

명령의 작동은 다음 플래그를 사용하여 변경할 수 있습니다.

  • --dry-run: 사물함에 아무 것도 추가하지 않지만 추가되는 내용을 표시합니다.
  • --cache-mode: 드라이런과 유사합니다. 실제로 증거를 사물함에 추가하지 않고 첨부 파일 (있는 경우) 을 사물함에 추가합니다. 추가될 증거를 표시합니다.
  • --format: 출력 형식 id 또는 json (기본적으로 id ) 를 제어합니다.

다음 명령을 실행하여 detect-secrets의 결과를 저장하십시오.

$ cocoa locker evidence add --evidence-type com.ibm.detect_secrets \
                            --evidence-type-version 1.0.0 \
                            --details result=success \
                            --asset https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee

다음 명령을 실행하여 단위 테스트 결과를 저장하십시오.

$ cocoa locker evidence add --evidence-type com.ibm.unit_test \
                            --evidence-type-version 1.0.0 \
                            --details failure \
                            --asset https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
                            --attachment path/to/results/junit.xml \
                            --issue <issue-link> \
                            --findings-path <path/to/file>

증거 로커에 이미 있는 첨부 파일을 사용하여 새 증거를 작성하려면 다음 명령을 실행하십시오.

$ cocoa locker evidence add --evidence-type com.ibm.detect_secrets \
                            --evidence-type-version 1.0.0 \
                            --attachment-url https://github.com/foo/bar/blob/master/raw/attachments/5aa5555aa55aa55a555aa5a5aa555555aaaa5aa5aa5555a55a5aa5aa5a5aaaaa/content
                            --asset https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee

다음 명령을 실행하여 단위 테스트 결과를 저장하고 첨부 파일에 사용자 정의 레이블을 추가하십시오.

$ cocoa locker evidence add --evidence-type com.ibm.unit_test \
                            --evidence-type-version 1.0.0 \
                            --details success \
                            --asset https://github.com/foo/bar.git#aaaaaaaabbbbbbbbccccccccddddddddeeeeeeee
                            --issue <issue-link> \
                            --findings-path <path/to/file> \
                            --attachment path/to/results/junit.xml::label=unit-test

코코아 라커 증거 가져오기 < 증거-id >

사물함에서 증거를 검색합니다.

옵션:

--version          # Show version number
--format           # Output format ("json", default: "json")

다음 명령을 실행하십시오.

 cocoa locker evidence get 0000000011111111222222223333333344444444555555556666666677777777

출력 예:

{
   "id": "0000000011111111222222223333333344444444555555556666666677777777",
   "evidence_type_id": "com.ibm.unit_tests",
   "evidence_type_version": "1.0.0",
   "date": "2024-03-27T16:36:48.167Z",
   "origin": {
     "toolchain_crn": "crn:v1:bluemix:public:toolchain:us-south:a/40111714589c4f7099032529b26a7a63:f0ffdc07-616e-40fa-98d5-2f52d5e8ef4d::",
     "pipeline_id": "b313626a-a612-4c98-ae5c-408af7d7ce58",
     "pipeline_run_id": "cadb83be-f00d-44af-95d0-1b49deb8abb5",
     "pipeline_run_url": "https://cloud.ibm.com/devops/pipelines/tekton/b313626a-a612-4c98-ae5c-408af7d7ce58/runs/cadb83be-f00d-44af-95d0-1b49deb8abb5/code-unit-tests/run-stage/?env_id=ibm:yp:us-south",
     "scope": "82aef875749c6386381a3baff8430df6f5ac2e8434cc91e5287ce65bd71a3985"
   },
   "details": {
     "result": "pending",
     "tool": "jest"
   },
   "issues": [],
   "findings": [],
   "attachments": [
      {
       "hash": "9a841ef856a5de813dbe440b102b9bff3ca1831630292cff7323c557704f386b",
       "url": "https://s3.private.us-south.cloud-object-storage.appdomain.cloud/test/assets/9a841ef856a5de813dbe440b102b9bff3ca1831630292cff7323c557704f386b/index.json",
       "label": "unit-test"
     }
   ],
   "assets": [
     {
       "hash": "7d930918fbb8be80f3a5100f0313c5b2518eba22cc915194cf971d4daf5170be",
       "uri": <git-uri-to-asset>,
       "url": "https://s3.us-south.cloud-object-storage.appdomain.cloud/cocoa-development/assets/7d930918fbb8be80f3a5100f0313c5b2518eba22cc915194cf971d4daf5170be/index.json"
     }
   ]
}

코코아 라커 증거 요약 < asset-id >

하나 이상의 자산에 대한 증거 요약을 리턴합니다. 명령행에 자산이 지정되지 않은 경우 stdin 에서 자산을 읽습니다.

선택적 플래그:

  • --latest-only: 자산에 대해 새 증거를 사용할 수 있는 경우 증거를 버립니다 (기본적으로 true, 이 동작을 사용하지 않으려면 false 로 설정됨).
  • --scope: 지정된 범위만 있는 증거를 고려하며 ( evidence add --scope 참조) 여러 번 지정할 수 있습니다.
  • --linked-scope: 지정된 연결된 범위가 있는 증거를 범위로 간주합니다. 또한 반환된 증거 요약의 연결된 범위 속성에 추가합니다. 여러 번 지정할 수 있습니다.
  • --check-immutable-storage: 모든 증거가 Cloud Object Storage 버킷에도 있고 최소 365일의 보존 기간으로 보호되는지 확인합니다. com.ibm.immutable_storage 증거를 요약에 추가합니다.
    • Cloud Object Storage 버킷을 구성하는 방법은 cocoa locker 절을 참조하십시오.
  • --dry-run: --check-immutable-storage 와 결합할 때 효과가 있습니다. 사용되는 경우 com.ibm.immutable_storage 증거는 요약에만 추가되지만 증거 로커에 업로드되지 않습니다.
  • --clone-dir: 증거 저장소의 복제 경로를 결정하는 선택적 파라미터로, 기본적으로 저장소 /tmp 디렉터리를 복제합니다
  • --initialized: 증거 보관함이 제공된 위치에 이미 복제되어 있다고 가정하는 선택적 플래그 --clone-dir 또는 /tmp/ 입니다.
  • --evidences-path: 캐시에서 스트로드된 로컬 증거로부터 요약을 생성하려면 이 필드를 사용하여 배열에 있는 모든 증거가 있는 파일의 경로를 다시 제공해야 합니다.

다음 명령을 실행하십시오.

$ cocoa locker evidence summary \
    docker://us.icr.io/foo/bar@sha256:1234567812345678123456781234567812345678123456781234567812345678 \
    docker://us.icr.io/baz/quux@sha256:1234567812345678123456781234567812345678123456781234567812345678 \
    --scope 11a1aa11-1a11-11a1-aa11-a11a1a1111a1 \
    --scope 22a2aa22-2a22-22a2-aa22-a22a2a2222a2 \
    --linked-scope 33a3aa33-3a33-33a3-33a3-a33a3a3333a3 \
    --linked-scope 12bqab22-1a23-1a23-1a23-b22a3a2222a3

stdin에서 읽은 예:

$ cat <<EOF | cocoa locker evidence summary
docker://us.icr.io/foo/bar@sha256:1234567812345678123456781234567812345678123456781234567812345678
docker://us.icr.io/baz/quux@sha256:1234567812345678123456781234567812345678123456781234567812345678
EOF

코코아 로커 첨부 가져오기 < attachment-id >

cocoa locker evidence add 로 이전에 업로드된 첨부 파일을 검색합니다.

옵션:

--version          # Show version number

다음 명령을 실행하여 첨부 파일을 업로드하십시오.

$ cocoa locker evidence add --evidence-type-id com.ibm.unit_test \
                            --evidence-type-version 1.0 \
                            --details result=success \
                            --attachment path/to/junit.xml::label=unit-test

첨부 파일 업로드의 출력 예:

{
   ...
   "attachments": [
    {
      "hash": "9a841ef856a5de813dbe440b102b9bff3ca1831630292cff7323c557704f386b",
      "url": "https://s3.private.us-south.cloud-object-storage.appdomain.cloud/test/assets/9a841ef856a5de813dbe440b102b9bff3ca1831630292cff7323c557704f386b/index.json",
      "label": "unit-test"
    }
   ],
   ...
}

첨부 파일을 가져오려면 다음 명령어를 실행하세요:

 cocoa locker attachment get 5aa5555aa55aa55a555aa5a5aa555555aaaa5aa5aa5555a55a5aa5aa5a5aaaaa

코코아 라커 체크

사물함의 필수 구성 및 설정을 확인합니다.

현재 Cloud Object Storage 기반 로커에만 구성 요구사항이 있습니다.

  • 모든 증거는 최소 1년동안 보존되어야 하므로 Cloud Object Storage 버킷은 보존 정책에 의해 보호되어야 합니다. 기본 보존 기간은 365일이상이어야 합니다.

자세한 정보는 코코아 라커 명령 을 참조하십시오.

필수 환경 변수:

COS_API_KEY=        # Cloud Object Storage API Key
COS_BUCKET_NAME=    # Bucket Name where the evidence will be uploaded in the COS Instance
COS_ENDPOINT=       # The COS API Endpoint matching the region where the bucket is located

다음 명령을 실행하십시오.

 cocoa locker check --provider='cos'

코코아 보관함 증거 검사

구성 파일 cocoa locker evidence check 에 있는 검사를 기반으로 필수 증거의 유효성을 검증하십시오.

필수 환경 변수:

옵션:

--org              # (Required) Owner of the evidence locker repo, defaults to `EVIDENCE_LOCKER_REPO_OWNER`
--repo             # (Required) Name of the evidence locker repo, defaults to `EVIDENCE_LOCKER_REPO_NAME`
--git-provider     # Git service provider ("github")
--git-token-path   # Git token path to read the secret from
--git-api-url      # Github API URL
--config-path      # (required) use this path to read the config file of all the required evidence check
--summary-path     # (required) use this path to read the summary file of all the evidences
--pre-deployment   # If present, will check only pre deployment checks, defaults to false
--post-deployment  # If present, will check only post deployment checks, defaults to false
--source           # (Applies to config file version 2) If present, is tupple of branch:region information(with region as optional) which will be used to filter the rules against `source_environments` field.
--target           # (Applies to config file version 2) If present, is tupple of branch:region information(with region as optional) which will be used to filter the rules against `target_environments` field.
--pipeline-run-id  # (Applies to config file version 2) If present, is current pipeline_run_id will be used for checking evidences.
--output-config-path # optional path to create a more suitable file based on the current config file

다음 명령을 실행하십시오.

 cocoa locker evidence check --summary-path `<summary-path>` --config-path `<config-path>` --pre-deployment --post-deployment --source `<source_branch:region>` --target `<target_branch:region>` --pipeline-run-id `<current_pipeline-run-id>`

코코아 락커 증거 수집

증거를 수집하여 보관함에 보관하세요. 이 명령은 collect-evidence 셸 스크립트의 기본 구현입니다.

사용량

cocoa locker evidence collect [OPTIONS]

필수 매개변수

  • --tool-type <string> 도구 식별자(예: "sonarqube", "cra", "owasp-zap", "detect-secrets")

  • --evidence-type <string> 증거 유형(예: " com.ibm.static_scan ", " com.ibm.unit_tests ", " com.ibm.detect_secrets ")

  • --assets <key:type> "키:유형" 형식의 에셋 사양. 여러 자산에 대해 여러 번 지정할 수 있습니다. 예: --assets app-repo:repo 또는 --assets my-image:artifact

  • --status <string> 증거 상태 success | failure | pending

  • --pipeline-run-id <string> 파이프라인 실행 식별자

  • --pipeline-namespace <string> 파이프라인 네임스페이스: pr | ci | cd | cc

  • --incident-org <string> Git 인시던트 리포지토리 조직

  • --incident-repo <string> 인시던트 리포지토리 이름

텍톤 플랫폼에 필요한 매개변수입니다.
  • --pipeline-id <string> 파이프라인의 식별자

  • --task-name <string> 파이프라인 내 작업의 이름

  • --step-name <string> 작업 내 단계의 이름

선택적 매개변수

  • --attachment <path> 스캔 결과 등의 첨부 파일(여러 번 지정 가능)

  • --attachment-url <url> 미리 업로드한 첨부 파일의 URL(여러 번 지정 가능)

  • --meta <key=value> 메타데이터 키=값 쌍(여러 번 지정 가능)

  • --additional-comment <string> 인시던트 이슈에 포함할 추가 댓글

  • --show-table 증거의 세부 정보를 표 형식으로 표시합니다

  • --dry-run 라커에 저장하지 않고 미리 보기

  • --cache-mode 첨부 파일만 추가하고 증거 자체는 건너뛰기

  • --evidence-reuse 증거 재사용 기능 활성화

  • --evidence-per-asset 각 자산에 대한 증거를 개별적으로 생성

  • --upload-logs <boolean> 다른 첨부 파일이 없는 경우 로그를 첨부 파일로 업로드합니다(기본값: true)

  • --incident-git-provider <string> Git 제공처: github | gitlab (기본값: github)

  • --incident-git-token-path <path> 인증을 위한 Git 토큰 경로

  • --incident-git-api-url <url> 사용자 지정 Git API 기반 URL

  • --incident-labels <string> 인시던트 이슈에 적용할 레이블(여러 번 지정 가능)

  • --incident-assignees <string> GitHub/GitLab 인시던트에 할당할 사용자 이름(여러 번 지정 가능)

  • --comment-on-issues 인시던트 이슈에 추가된 증거 링크

  • --pr-issue-management 이슈 연결 및 관리를 위한 풀 리퀘스트 활성화

  • --opt-in-auto-close 인시던트가 해결되면 자동으로 종료되도록 설정하기

  • --custom-exempt-label <string> 규정 준수 요건 면제를 나타내는 라벨

  • --platform <string> 로그를 가져오는 데 사용되는 플랫폼입니다: tekton | github-actions (기본값: 텍톤)

  • --root-pipeline-run-id <string> 루트 파이프라인 실행의 식별자

  • --toolchain-crn <string> 툴체인의 클라우드 리소스 이름(CRN)

  • --deployment-prefix <string> 배포 접두사

  • --target-environment <string> 대상 환경(기본값: 프로덕션)

  • --target-environment-purpose <string> 대상 환경 목적

  • --collect-evidence-in-pr <string> PR 맥락에서 증거를 수집하세요: none | success | all

  • --pr-html-url <string> URL 를 관련 풀 리퀘스트에

  • --base-branch <string> 풀 리퀘스트를 위한 베이스 브랜치

  • --branch <string> 분기 이름

  • --gh-org <string> GitHub 파이프라인이 실행되는 조직(깃허브 액션 플랫폼에만 해당).

  • --gh-repo <string> GitHub 리포지토리에 파이프라인이 실행되는 리포지토리(github 액션 플랫폼에만 해당)를 저장합니다.

  • --gh-server-url <string> GitHub 액션: 서버: URL (깃허브 액션 플랫폼에만 해당).

  • --gh-repository-url <string> GitHub 액션: 전체 리포지토리: URL (깃허브 액션 플랫폼에만 해당).

  • --gh-run-attempt <string> GitHub 액션: 작업: 워크플로 실행 시도 번호(깃허브 작업 플랫폼에 따라 다름).

  • --run-id <string> 실행 ID

  • --xforce-api-key <string> IBM API 키 X-Force Exchange

  • --xforce-password <string> IBM 의 API 비밀번호 X-Force Exchange

  • --xforce-url <string> IBM X-Force Exchange API URL

cocoa locker evidence collect \
  --tool-type "sonarqube" \
  --evidence-type "com.ibm.static_scan" \
  --assets "app-repo:repo" \
  --status "success" \
  --attachment ./sonarqube-result.json \
  --pipeline-run-id "abc123" \
  --pipeline-namespace "ci" \
  --incident-org "my-org" \
  --incident-repo "compliance-issues" \
  --meta "environment=staging"

코코아 락커 증거물 재사용

주어진 자산에 대한 기존 증거를 찾아서 재사용하세요. 이 명령은 check-evidence-for-reuse 셸 스크립트의 기본 구현입니다.

사용량

cocoa locker evidence reuse [OPTIONS]

필수 매개변수

  • --tool-type <string> 도구 식별자(예: "sonarqube", "cra", "owasp-zap")

  • --evidence-type <string> 증거 유형(예: " com.ibm.static_scan ", " com.ibm.unit_tests ")

  • --assets <key:type> "키:유형" 형식의 자산 사양

  • --pipeline-run-id <string> 파이프라인 실행 식별자

  • --pipeline-namespace <string> 파이프라인 네임스페이스: pr | ci

  • --incident-org <string> Git 인시던트 리포지토리 조직

  • --incident-repo <string> 인시던트 리포지토리 이름

텍톤 플랫폼에 필요한 매개변수입니다.
  • --task-name <string> 파이프라인 내 작업의 이름

  • --step-name <string> 작업 내 단계의 이름\

  • --pipeline-id <string> 파이프라인의 식별자

선택적 매개변수

  • --meta <key=value> 재사용을 위해 발견된 증거에 대한 유효성 검사를 위한 메타데이터(여러 번 지정 가능)

  • --evidence-validity-period <number> 유효 기간(시간 단위)(기본값: 24시간, 최대: 720시간/30일)

  • --evidence-reuse-for-failure 실패한 증거의 재사용 사용(기본값: false)

  • --dry-run 증거를 실제로 재사용하지 않는 미리보기 모드

  • --show-table 증거의 세부 정보를 표 형식으로 표시합니다

  • --format <string> 출력 형식: json (기본값: json)

  • --incident-git-provider <string> Git 제공처: github | gitlab (기본값: github)

  • --incident-git-token-path <path> 인증을 위한 Git 토큰 경로

  • --incident-git-api-url <url> 사용자 지정 Git API 기반 URL

  • --incident-assignees <string> GitHub/GitLab 인시던트에 할당할 사용자 이름(여러 번 지정 가능)

  • --custom-exempt-label <string> 규정 준수 요건 면제를 나타내는 라벨

  • --deployment-prefix <string> 배포 접두사

  • --root-pipeline-run-id <string> 루트 파이프라인 실행의 식별자

  • --toolchain-crn <string> 툴체인의 클라우드 리소스 이름(CRN)

  • --platform <string> 로그를 가져오는 데 사용되는 플랫폼입니다: tekton | github-actions (기본값: 텍톤)

  • --gh-org <string> GitHub 파이프라인이 실행되는 조직(깃허브 액션 플랫폼에만 해당)

  • --gh-repo <string> GitHub 파이프라인이 실행되는 리포지토리(깃허브 액션 플랫폼에만 해당)

  • --run-id <string> 실행 ID

  • --environment <string> 환경(기본값: 개발)

  • --serviceEnvironment <string> 서비스 환경(기본값: 개발)

기본 사용법:

cocoa locker evidence reuse \
  --tool-type "sonarqube" \
  --evidence-type "com.ibm.static_scan" \
  --assets "app-repo:repo" \
  --pipeline-run-id "abc123" \
  --pipeline-namespace "ci" \
  --incident-org "my-org" \
  --incident-repo "compliance-issues" \
  --format "json"

사용자 지정 유효 기간 및 메타데이터 유효성 검사 기능을 제공합니다:

cocoa locker evidence reuse \
  --tool-type "cra" \
  --evidence-type "com.ibm.code_vulnerability_scan" \
  --assets "app-repo:repo" \
  --pipeline-run-id "xyz789" \
  --pipeline-namespace "ci" \
  --incident-org "my-org" \
  --incident-repo "compliance-issues" \
  --evidence-validity-period 48 \
  --meta "tool-version=1.2.3" \
  --meta "base-image=ubuntu:22.04" \
  --format "json"

실패한 증거를 재사용하세요:

cocoa locker evidence reuse \
  --tool-type "owasp-zap" \
  --evidence-type "com.ibm.dynamic_scan" \
  --assets "my-app:artifact" \
  --pipeline-run-id "xxx-001" \
  --pipeline-namespace "cd" \
  --incident-org "my-org" \
  --incident-repo "compliance-issues" \
  --evidence-reuse-for-failure \
  --format "json"

종료 코드

  • 0: 증거물 발견 및 재사용 성공
  • 1: 재사용 가능한 증거가 발견되지 않았거나 유효성 검사에 실패했습니다

Cocoa tekton 명령

cocoa tekton get-pipeline-logs

파이프라인 실행에서 모든 단계의 로그 파일을 작성하고 디렉토리에 저장합니다. 환경 변수 (PIPELINE_ID, PIPELINE_RUN_ID) 를 사용하거나 명시적 플래그 (--pipeline-id, --pipeline-run-id) 로 환경 변수를 대체하십시오. 로그 파일은 --task-name--step-name 플래그를 제공하여 태스크별 및 단계별 레벨에서도 검색할 수 있습니다.

--task-name 가 제공된 경우, 명령은 지정된 태스크 이름의 모든 단계에 대한 로그 파일을 가져오고 작성하려고 시도합니다.

--step-name--task-name 와 함께 제공되는 경우, 명령은 제공된 task-name. --step-name 에 대한 특정 단계의 로그 파일을 작성합니다. --task-name 가 없으면 올바르지 않은 명령 서명입니다.

옵션:

-o --output-dir       # (Required) Specifies the directory where the logs will be saved
   --pipeline-id      # ID of the pipeline
   --pipeline-run-id  # ID of the pipeline run
-u --use-task-ref     # (Optional) Can be used to override the default name of the pipeline task to the taskRef, when creating the directory
   --task-name       # (Optional) use task-name to fetch the logs for --task-name
   --step-name       # (Optional) use step-name in conjunction with task-name to fetch the log for --step-name

필수 환경 변수:

IBMCLOUD_API_KEY= # IBM Cloud API Token
TOOLCHAIN_REGION= # Region of the toolchain
PIPELINE_ID=      # Can be used instead of '--pipeline-id option
PIPELINE_RUN_ID=  # Can be used instead of '--pipeline-run-id option

명령 실행:

$ cocoa tekton get-pipeline-logs \
   --output-dir=<output-dir> \
   --pipeline-id=<pipeline-id> \
   --pipeline-run-id=<pipeline-run-id> \
   --use-task-ref

코코아 주석 명령

코코아 주석 추가

GitHub의 문제 또는 가져오기 요청에 주석을 추가합니다.

옵션:

--content           # (Required) The content to be added as comment to issue or pr
--id                # (Required) The issue number or pull request number
--type              # (Optional) The type (issue or pr), default is issue
--org               # The git repo org
--repo              # The git repo name
--git-provider      # (Optional) Git service provider [github]
--git-token-path    # (Optional) Github Token's path
--git-api-url       # (Optional) Github API URL

필수 환경 변수:

GHE_ORG=                    # Can be used instead of --org (either the option or the variable is required)
GHE_REPO=                   # Can be used instead of --repo (either the option or the variable is required)

필수 환경 변수(사용하는 경우)GitHub:

GHE_TOKEN=    # Github Enterprise API Token (Optional if you are using --git-token-path)

github 을 사용하는 경우 --git-token-path 필드를 사용하여 GitHub 토큰을 설정하고 --git-api-url 필드를 사용하여 GHE_TOKENGH_URL 환경 변수 대신 GitHub Enterprise API URL 설정합니다. 환경 특성 및 명령행 매개변수가 모두 제공되면 --git-token-path--git-api-url 가 우선합니다.

명령 실행:

$ cocoa comment add --id 1 \
                    --content "This is a test comment" \
                    --type pr \
                    --git-provider github \
                    --org <github-organization> \
	  				--repo <github-repo-name>

코코아 라벨 명령

코코아 라벨 추가

풀 리퀘스트에 하나 이상의 레이블을 추가하여 GitHub 또는 GitLab 추가합니다.

옵션:

--label           	# (Required) The label to be added to the pull request. This command be specified multiple times.
--id       	        # (Required) The pull request number. Can be specified multiple times.
--type             	# (Optional)The type of the item (issue or PR). The default type is PR.
--org               # The Git repository organization.
--repo              # The Git repository name.
--git-provider     	# (Optional) The Git service provider. The default git provider is Github.
--git-token-path    # (Optional) The path to the Git token.
--git-api-url       # (Optional) The URL of the Git API.

필수 환경 변수:

GHE_ORG=                    # The Git repository organization. Can be used instead of the --org option. Either the option or the variable is required.
GHE_REPO=                   # The Git repository name. Can be used instead of the --repo option. Either the option or the variable is required.

다음에 필요한 환경 변수: GitHub:

GHE_TOKEN=    # Github Enterprise API Token (Optional if you are using --git-token-path)

GitHub, 사용하는 경우 다음 환경 변수가 필요합니다:

GitHub 필요한 환경 변수
가변 설명
GHE_TOKEN GitHub Enterprise API 토큰. --git-token-path 옵션을 사용하는 경우 선택 사항입니다.

명령줄 옵션:

또는 다음 명령줄 옵션을 사용하여 인증할 수도 있습니다:

GitHub 명령줄 옵션
명령행 옵션 설명
--git-token-path GitHub 토큰을 설정하세요.
--git-api-url GitHub Enterprise API URL 설정합니다.

환경 속성과 명령줄 매개변수가 모두 제공된 경우 --git-token-pat h 및 --git-api-url 옵션이 우선합니다.

예시: 풀 리퀘스트에 레이블 추가하기

다음 명령을 실행하여 풀 리퀘스트에 레이블을 추가할 수 있습니다:

$ cocoa label add --id 1 \
                  --label "deployed" \
                  --type pr \
                  --git-provider github \
                  --org <github-organization> \
                  --repo <github-repo-name>