DevSecOps CLI
DevSecOps CLIは、 IBM Cloud® DevSecOps 参照実装の下でコンプライアンス・ソリューションを採用している。例えば、シフト・レフト・アプローチの参照パイプライン。 シフト・レフトのコンプライアンス・アーキテクチャーについて詳しくは、Continuous Delivery による DevSecOps を参照してください。
CLI インターフェース
CLI は、コマンド行でマルチパート構造を使用します。これは、以下の順序で指定する必要があります。
cocoa <command> <subcommand> [options]
-
この CLI の基本の呼び出し。
-
メインコマンド。通常、シフトレフトアーキテクチャで使用されるサービスやモジュールに対応するもので、例えば、変更リクエスト、インベントリ、またはテクトンなどがある。
-
実行する操作を指定するサブコマンド。
-
操作に必要な CLI オプション。 ステップ 1 から 3 に従うことを条件として、CLI オプションを任意の順序で指定できます。
一部のコマンドでは、APIキーを取得したり、コマンドラインで指定されなかったオプションの値を設定したりするために、環境変数が使用されます。 コマンドを実行する前に、これらの変数をエクスポートする必要があります。
コマンドラインオプションには、数値、文字列、ブール値、配列、JSONオブジェクトなど、さまざまな種類の入力値を指定できます。 オプションの種類は、指定したコマンドによって異なります。 cocoa <command> <subcommand> --help を実行して、オプションの種類を確認してください。
失敗した API 呼び出しの再試行
Cocoa CLI は、応答状況 5xx で失敗した API 呼び出しを 3 回再試行します。 この動作をオーバーライドするには、以下の環境変数を指定します。
MAX_RETRY_ATTEMPTS-Cocoa CLI が試行を中止するまでの再試行回数。 たとえば、MAX_RETRY_ATTEMPTS=5RETRY_STATUS_CODE-再試行が行われる応答状況コード。 例えば、RETRY_STATUS_CODE=409,422,500と指定すると、これら 3 つの状況コードで再試行します。
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.
再試行の間隔は指数関数的に長くなるため、再試行の間隔を大きくすると、再試行の間隔がさらに長くなります。
コマンド実行の経過時間
Cocoa 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 pull 要求コマンド
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_TOKEN と GH_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_TOKEN と GH_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-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 変更要求コマンド
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 に送ります。
次の 2 つの使用方法があります。
- 必要なすべての CR フィールドを CLI オプションから提供する。
オプション:
--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"
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、 --repo、および GHE_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>'
cocoa change-要求添付 get
変更要求の特定の「変更」アタッチメントを取得します。
オプション:
--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'
ココア証拠コマンド
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 プル要求コメントとしてフィードできるマークダウン形式にフォーマット設定します。
入力は未加工の要約で、以下の 2 つの形式のいずれかにすることができます。
- 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 コマンド
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 を使用している場合は、 GHE_TOKEN と GH_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 が優先されます。
次のコマンドを実行します。
$ 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>
backend および upload-path を除き、CLIオプションは環境変数からも設定可能です。
成果物の取得
Object Storage、 GitHub,、 DevOps Insights などのさまざまな証拠ロッカーから、cocoa artifact getコマンドを使用してアーティファクトを取得できます。 このコマンドを使用すると、異なるタイプのロッカーから成果物を取得できますが、それぞれに特定のパラメータが必要です。
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 を使用している場合は、 GHE_TOKEN と GH_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 が優先されます。
次のコマンドを実行します。
$ 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>
CLIオプションは、 backend と artifact-path / artifact-prefix を除く環境変数からも設定できます。
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 を使用している場合は、 GHE_TOKEN と GH_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 が優先されます。
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
| オプション | 説明 | 値のタイプ | 必須またはオプションです | 設定可能値 / 初期値 / 備考 |
|---|---|---|---|---|
| 成果物 (artifact) | アプリケーション用に作成されたアーティファクトの名前。 | ストリング | 必須 | アーティファクトの種類が画像の場合は、次の形式を使用してください: <static_name>:<version>@sha256:<sha256_digest> または <static_name>@sha256:<sha256_digest>。 エントリの種類が画像でない場合は、すべてのエントリの更新を通じて変わらない固定の名前を使用してください。 |
| バージョン | アプリケーションのバージョン。 | ストリング | 必須 |
|
| リポジトリー URL | アプリケーションのソースコードリポジトリを指す URL (githubまたはGRIT/gitlabレポジトリのいずれか) | ストリング | 必須 | これは有効なソースコードリポジトリ(github / gitlabなど)でなければならず、ドッカーリポジトリ(artifactoryなど)であってはならない |
| PIPELINE-RUN-ID | パイプラインの実行の ID。 | ストリング | 必須 | これは証拠の範囲に使用される。 パイプラインのランIDまたはuuidでなければならない。 (例:'f21321af-9084-4af3-80b8-4fb34143b7d9 |
| コミット-sha | アーティファクトのビルド元となるアプリケーションリポジトリのコミット。 | ストリング | 必須 | ロングフォーマットのコミットsha(40文字の小文字)であること |
| 名前 | 成果物が属しているアプリケーションの名前 | ストリング | 必須 | これはユニークな分野です。 name=subdir/foo のようにサブディレクトリを使用することで、インベントリ・リポジトリをより整理することができます。 |
| ビルド番号 | ビルド番号。 | number | 必須 | ビルド番号は、ビルドアーティファクトとデプロイアーティファクトの関連付けに使用される |
| 組織 (org) | インベントリー・リポジトリーを所有する GitHub 組織。 | ストリング | 環境変数GHE_ORGが設定されている場合はオプション |
|
| repo | インベントリリポジトリの名前。 | ストリング | 環境変数GHE_REPOが設定されている場合はオプション |
|
| app-成果物 | JSON 形式の任意のアプリケーション・コンテンツ | ストリング | オプション | 自動化/ワークフローで使用するための追加コンテンツは、ここに追加することができます |
| タイプ | アーティファクトの種類。 イメージの場合は "image"、デプロイメントファイルやヘルムチャートなどの一般的なタイプの場合は静的な値を指定できます。 | ストリング | 必須 | 使用可能な値:画像タイプのアーティファクトには「[「イメージ]、それ以外には「 、または「["helm-chart"、"deployment-file"]ような任意の値を使用することができます |
| sha256 | アーティファクトのsha256ハッシュ。 | ストリング | 必須 | sha256:<64 character hash> 形式でなければならない。 |
| プロビナンス | アーティファクト(例えば、ビルドされた画像)を指す URL。 | ストリング | 必須 | 画像」タイプのインベントリエントリーの場合、出所はアーティファクトフィールドと同じでなければならない |
| シグニチャー | 成果物の署名 | ストリング | 必須 |
|
| 環境 | 項目が追加される環境の名前です。 | ストリング | オプション | デフォルト:"マスター" |
| フロムファイル | インベントリエントリーの詳細を含むファイル名。 インベントリ・リポジトリに複数のインベントリ・エントリを1回のコミットでアップロードするには、このフラグを使用します。 | ストリング | オプション | 例 : 'path/to/file.json |
| ギットプロバイダー | Git バージョン管理サービス・プロバイダー。 | ストリング | オプション | デフォルト : "github" 取り得る値 :["github", "gitlab"] |
| gitトークンパス | シークレットの読み取り元の 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 オプションを使用すると、1回のコミットで複数のエントリーを追加することができる。 このオプションは、オブジェクトの配列を含む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 のどちらかを 1 つだけ使用してください。 --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 を使用している場合は、 GHE_TOKEN と GH_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 が優先されます。
デフォルトでは、呼び出しごとに CLI を使用することにより、 Git ロッカーの最新バージョンで作業することが保証されます。 この動作を無効にするには、 COCOA_USE_CACHE を 0、 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 のどちらかを 1 つだけ使用してください。
必要な環境変数(使用している場合)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 を使用している場合は、 GHE_TOKEN と GH_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 が優先されます。
次のコマンドを実行します。
# 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 を使用している場合は、 GHE_TOKEN と GH_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 が優先されます。
次のコマンドを実行します。
# 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 を使用している場合は、 GHE_TOKEN と GH_URL 環境変数の代わりに、 --git-token-path フィールドで GitHub トークンを、 --git-api-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フラグを使うと、ブランチを値として受け取り、その中のすべてのエントリーを検証する。--labelフラグを使って、タグを値として受け取り、その中のすべてのエントリーを検証する。--from-fileフラグを使用する - インベントリエントリーを含むJSONファイルのパスを取る(ハイフン形式)。
オプション:
- カスタムの inventoryignore ファイル名を使用する場合は、'
--inventory-ignore-file-nameフラグを使用してデフォルト値を上書きすることができます。 - クローンされたインベントリ・リポジトリがすでに存在し、コマンドに同じものを使用させたい場合は、'
--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}"
カカオ・インベントリー・ゲット・デルタ
インベントリリポジトリからコミット間の差分を取得します。 オプションで、2つのコミット間の差分内のピアレビューコミットを取得する。
必要な環境変数:
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
| オプション | 説明 | 値のタイプ | 必須またはオプションです | 設定可能値 / 初期値 / 備考 |
|---|---|---|---|---|
| フロムシャ | からのデルタを計算する開始コミット | ストリング | オプション |
|
| フロムラベル | からのデルタを計算するための開始コミットとして使用するタグ | ストリング | オプション |
|
| トーシャ | までのデルタを計算するエンドコミット | ストリング | オプション |
|
| 環境へ | までのデルタを計算するための環境ブランチのHEADコミット | ストリング | オプション |
|
| ラベル | までのデルタを計算するエンドコミットを示すタグ | ストリング | オプション |
|
| 組織 (org) | インベントリー・リポジトリーを所有する GitHub 組織。 | ストリング | 環境変数GHE_ORGが設定されている場合はオプション |
|
| repo | インベントリリポジトリの名前。 | ストリング | 環境変数GHE_REPOが設定されている場合はオプション |
|
| ギットプロバイダー | Git バージョン管理サービス・プロバイダー。 | ストリング | オプション | デフォルト : "github" 取り得る値 :["github", "gitlab"] |
| gitトークンパス | シークレットの読み取り元の Git トークン・パス | ストリング | 環境変数GHE_TOKENが設定されている場合はオプション | 例 : 'path/to/git-token |
| git-api-URL | Git API URL | ストリング | オプション | デフォルト : 'https://<region>.git.cloud.ibm.com/api/v4 |
| 差分 | デルタを計算するフラグ | ブール値 | オプション | false |
| デルタ削除 | デルタ削除を計算するフラグ | ブール値 | オプション | false |
| 在庫リスト | 在庫リスト全体を計算するフラグ | ブール値 | オプション | false |
| 査読 | 査読コミットを計算するフラグ | ブール値 | オプション | false |
| インベントリ・レポ・パス | インベントリ・リポジトリのパス(オプション)。 渡された場合、インベントリリポジトリはコマンド内でクローンされません | ストリング | オプション | |
| インベントリ・イグノア・ファイル・パス | インベントリ無視ファイルのオプションパス | ストリング | オプション | |
| previous-inventory-ignore-ファイルパス | 前回の配置インベントリ無視ファイルのオプションパス | ストリング | オプション |
次のコマンドを実行します。
$ 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
| オプション | 説明 | 値のタイプ | 必須またはオプションです | 設定可能値 / 初期値 / 備考 |
|---|---|---|---|---|
| 名前 | 成果物が属しているアプリケーションの名前 | ストリング | 必須 |
|
| 組織 (org) | インベントリー・リポジトリーを所有する GitHub 組織。 | ストリング | 環境変数GHE_ORGが設定されている場合はオプション |
|
| repo | インベントリリポジトリの名前。 | ストリング | 環境変数GHE_REPOが設定されている場合はオプション |
|
| 環境 | 項目が追加される環境の名前です。 | ストリング | オプション | デフォルト:"マスター" |
| ギットプロバイダー | Git バージョン管理サービス・プロバイダー。 | ストリング | オプション | デフォルト : "github" 取り得る値 :["github", "gitlab"] |
| gitトークンパス | シークレットの読み取り元の 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
ココア・インシデント・コマンド
ココア・インシデント・プロセス
このコマンドは提供されたスキャン結果を処理し、脆弱性ごとに指定されたリポジトリにインシデント課題を作成します。 サブジェクトとインシデントのペアの問題が既に存在する場合、新しい問題は作成されません。
--set-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 Scanner (オプション
--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 を使用している場合は、 GHE_TOKEN と GH_URL 環境変数の代わりに、 --git-token-path フィールドで GitHub トークンを、 --git-api-url フィールドで # GitHub Enterprise API URLを設定します。 両方が指定されている場合は、 --git-token-path と --git-api-url が優先されます。
戻り値:
- 問題が見つからない場合、または検出されたすべての問題に免除期間または猶予期間が設定されている場合、コマンドはゼロ状況で終了します。
- 検出された問題のいずれかに免除または猶予期間が設定されていない場合、コマンドはゼロ以外の状況で終了します。
- 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
ココア・インシデント・プロセス-レガシー
このコマンドは、スキャン・ファイルが使用できない場合に、シナリオ用に提供されたリポジトリーにインシデントの問題を作成します。 通常、このようなシナリオは、単体テストの失敗、ブランチ保護の失敗、受け入れテストの失敗、イメージ署名の失敗など、脆弱性に関連しない障害になります。 これらの失敗は脆弱性ではありませんが、コンプライアンス体制からの逸脱になります。 インシデント・サブジェクト・ツールの組み合わせに問題が既に存在する場合、コマンドは新しい問題を作成しません。 デフォルトでは、
high 重大度レーティングは、作成された問題に設定されています。
--set-due-date が設定されている場合、このコマンドは問題を作成するか、既存の問題を期限付きで更新します。 期限は、重大度に基づいて、問題の猶予期間から計算されます。
--close-resolved-issues フラグが設定されている場合、コマンドは、現在の実行と同じツール、サブジェクト、およびインシデント ID を使用して、未解決の問題を検索します。 --current-status が success として渡されているときに問題が検出された場合、コマンドはそれらの問題をクローズします。
--read-only が設定されている場合、このコマンドは新しい問題を作成したり、既存の問題を修正したりすることはありません。 結果が処理され、結果について既存の問題が収集されます。 出力には、読み取り専用モードが有効になっていない場合、issueで追跡されるはずのissue 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 GHE_TOKEN GH_URL を使っている場合は、 フィールドで --git-token-path GitHub トークンを設定し、 フィールドで --git-api-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-statusがfailureとして渡された場合に検出または作成されたインシデント問題の URL をリストします。 また、このコマンドは、--current-statusがfailureとして渡された場合に、同じインシデント・ツールとサブジェクトの組み合わせに一致するインシデントの問題の URL を閉じます。 --read-onlyモードでは、検出されたインシデントに問題が見つからない場合、そのインシデントの詳細がコマンドによってリストされます。- 問題が見つからない場合、または見つかったすべての問題に免除ラベルが設定されている場合、コマンドはゼロ状況で終了します。
- 検出された問題のいずれかに免除ラベルが設定されていない場合、コマンドはゼロ以外の状況で終了します。
--read-onlyモードでは、問題のない新規インシデントが検出された場合、コマンドはゼロ以外の状況で終了します。- If format == list-コマンドは、
--current-statusがfailureとして渡された場合に検出または作成されたインシデント問題の 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 を使用している場合は、 GHE_TOKEN と GH_URL 環境変数の代わりに、 --git-token-path フィールドで GitHub トークンを、 --git-api-url フィールドで # GitHub Enterprise API URLを設定します。 両方が指定されている場合は、 --git-token-path と --git-api-url が優先されます。
戻り値:
- 検出されたすべての問題に「免除」または「猶予」のいずれかの期間が設定されている場合、コマンドはゼロの状況で終了します。
- 検出された問題のいずれかに免除または猶予期間が設定されていない場合、コマンドはゼロ以外の状況で終了します。
- 検出結果の 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
ココア・インシデント・アップデート・ステート
指定されたインシデントissue URLの現在のステータスに基づいて、インシデントissueの状態を open ot close に更新します。
コード・スニペット
$ cocoa incident update-state \
<options>
オプション:
以下のオプションの変数と値を指定して、coocaインシデントの問題の詳細を提供してください。
--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-provider が github の場合は、以下の必須環境変数を使用します:
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)
オプション変数 URL--git-token-path と `` を使用して --git-api-url 、GitHub のトークンパスと API 値を提供することもできます。 オプショナル変数が両方ある場合は、--git-token-path と --git-api-url が優先されます。
戻り値:
- issueの状態更新が成功した場合、コマンドはリターンコード
0で終了します。 - issueの状態更新が成功しなかった場合、コマンドはリターンコード
1で終了します。
次のコマンドを実行します。
$ cocoa incident update-state \
--org \
--repo \
--git-provider \
--git-token-path \
--git-api-url \
--issue-url \
--comment \
--to-state
cocoa locker コマンド
証拠や添付ファイルを 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: IAM トークンを生成するために API キーを使用できるエンドポイント(デフォルトはhttps://iam.cloud.ibm.com/identity/token){: external}。
cocoa locker 資産の追加 < 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スキームがdocker(つまり、docker://で始まる) の場合、コマンドは--type=imageフラグを想定します。uriスキームがgitの場合、またはパスの末尾が.git接尾部の場合、コマンドは--type=commitフラグを想定します。
type が image または commit の場合、URI は以下のパターンで一致する必要があります。
imageの場合、URI にはイメージ・ダイジェストを含める 必要があります (例:docker://us.icr.io/foo/bar:v1.2.3@sha256:0000000011111111222222223333333344444444555555556666666677777777)。
type が image または commit 以外の場合は、 --type フラグを明示的に渡す必要があります。
--details フラグを使用して資産に詳細を追加できます。このフラグは key=value ペアを受け入れます。
資産の起点に関する詳細は、 --origin フラグを使用して提供できます。このフラグは、 key=value ペアを受け入れます。
アセット起点に関する詳細を追加するために、いくつかの環境変数が自動的に取得されます。
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%
cocoa locker asset get < 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": []
}
Cocoa locker asset summary get < 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
cocoa locker 資産リスト < 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
ココア・ロッカー・エビデンスの追加
エビデンス・ロッカーにエビデンスを追加します。
エビデンス・ロッカーは、フラグを使用して指定できます。 詳しくは、 cocoa locker commands を参照してください。
証拠は、以下のフラグを使用して設定できます:
--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/v4GHE_TOKEN
- URL が
- 問題は
エビデンス 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>
1 つ以上の資産のエビデンス要約を返します。 コマンド行に資産が指定されていない場合、資産は stdin から読み取られます。
オプション・フラグ:
--latest-only: 資産に対してより新しいエビデンスが使用可能な場合、エビデンスを破棄します (trueはデフォルトでfalseに設定されており、この動作を無効にします)--scope: 指定されたスコープのみを持つエビデンスを考慮します (evidence add --scopeを参照)。複数回指定できます。--linked-scope: 指定されたリンク スコープをスコープとして持つ証拠を考慮します。 さらに、返された証拠の概要の linked-scopes プロパティにそれらを追加します。 複数回指定できます。--check-immutable-storage: すべてのエビデンスが Cloud Object Storage バケットにも存在し、少なくとも 365 日の保存期間によって保護されているかどうかを検査します。 要約にcom.ibm.immutable_storageエビデンスを追加します。- Cloud Object Storage バケットの構成方法については、
cocoa lockerのセクションを参照してください。
- Cloud Object Storage バケットの構成方法については、
--dry-run:--check-immutable-storageと組み合わせると効果があります。 使用した場合、com.ibm.immutable_storageのエビデンスは要約にのみ付加されますが、エビデンス・ロッカーにはアップロードされません。--clone-dir:Evidence Repositoryのクローンパスを決定するオプションのパラメータで、デフォルトでは/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
標準入力からの読み取り例:
$ cat <<EOF | cocoa locker evidence summary
docker://us.icr.io/foo/bar@sha256:1234567812345678123456781234567812345678123456781234567812345678
docker://us.icr.io/baz/quux@sha256:1234567812345678123456781234567812345678123456781234567812345678
EOF
cocoa locker attachment get < 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 日以上でなければなりません。
詳しくは、 cocoa locker commands を参照してください。
必要な環境変数:
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>key:type "形式の資産仕様。 複数のアセットに対して複数回指定できる。 例:--assets app-repo:repo--assets my-image:artifact -
--status <string>エビデンスの状況success|failurepending -
--pipeline-run-id <string>パイプラインの実行識別子 -
--pipeline-namespace <string>パイプラインの名前空間pr|ci|cd|cc -
--incident-org <string>Git インシデントリポジトリの組織 -
--incident-repo <string>インシデントリポジトリ名
tektonプラットフォームに必要なパラメータ。
-
--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>インシデントissueに適用するラベル(複数指定可能) -
--incident-assignees <string>GitHub/GitLab インシデントに割り当てるユーザー名(複数指定可能) -
--comment-on-issuesインシデント問題に関して追加された証拠をリンクする -
--pr-issue-managementプルリクエストから課題へのリンクと管理を可能にする -
--opt-in-auto-closeインシデントが解決された場合、インシデントの自動閉鎖を可能にする -
--custom-exempt-label <string>遵守義務の免除を示すラベル -
--platform <string>ログの取得に使用するプラットフォーム:tekton|github-actions(デフォルト: tekton) -
--root-pipeline-run-id <string>ルートパイプラインランの識別子 -
--toolchain-crn <string>ツールチェーンのクラウドリソース名(CRN) -
--deployment-prefix <string>展開プレフィックス -
--target-environment <string>ターゲット環境 (デフォルト: prod) -
--target-environment-purpose <string>対象環境の目的 -
--collect-evidence-in-pr <string>PRの文脈で証拠を集めるnone|successall -
--pr-html-url <string>URL を関連するプルリクエストに追加します -
--base-branch <string>プルリクエストのベースブランチ -
--branch <string>ブランチ名 -
--gh-org <string>GitHub パイプラインが実行される組織 (github アクションプラットフォーム固有)。 -
--gh-repo <string>GitHub パイプラインが実行されるリポジトリ(github アクションプラットフォーム固有)。 -
--gh-server-url <string>GitHub アクションサーバー URL ( github アクションプラットフォーム専用 ). -
--gh-repository-url <string>GitHub アクション:完全なリポジトリ URL ( github アクションプラットフォーム固有 ). -
--gh-run-attempt <string>GitHub アクションワークフロー実行の試行回数(githubアクションプラットフォーム固有)。 -
--run-id <string>実行識別子 -
--xforce-api-key <string>IBM 用APIキー X-Force Exchange -
--xforce-password <string>APIパスワード IBM 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>"key:type "形式の資産仕様 -
--pipeline-run-id <string>パイプラインの実行識別子 -
--pipeline-namespace <string>パイプラインの名前空間:pr|ci -
--incident-org <string>Git インシデントリポジトリの組織 -
--incident-repo <string>インシデントリポジトリ名
tektonプラットフォームに必要なパラメータ。
-
--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(デフォルト: tekton) -
--gh-org <string>GitHub パイプラインが実行される組織(githubアクションプラットフォーム固有) -
--gh-repo <string>GitHub パイプラインが実行されるリポジトリ ( github アクションプラットフォームに固有 ) -
--run-id <string>実行識別子 -
--environment <string>環境(デフォルト:dev) -
--serviceEnvironment <string>サービス環境(デフォルト:dev)
例
基本的な使い方:
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
cocoa コメント・コマンド
ココア・コメント追加
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 フィールドで GitHub Enterprise API URL を設定します。 GHE_TOKEN および GH_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,を使用している場合は、以下の環境変数が必要です:
| 変数 | 説明 |
|---|---|
GHE_TOKEN |
GitHub Enterprise API トークン。 --git-token-path オプションを使用している場合はオプション。 |
コマンドラインオプション:
あるいは、以下のコマンドラインオプションを使って認証することもできる:
| コマンドラインオプション | 説明 |
|---|---|
--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>
ココア変更要求コメントリスト
特定の変更要求に対するすべてのコメントを一覧表示します。
オプション:
注:
--lastパラメータは、非負の数値でなければなりません。--before、--afterパラメーターは ISO 8601 フォーマットの日付を受け付ける。--beforeと--afterの両方を使用する場合、--beforeの日付は--afterの日付より大きくなければならない。--before,--after)、次に--last、結果を制限します。ServiceNow v3 プロバイダーを使用している場合の必須環境変数:
追加の環境変数 ( ServiceNow v3 プロバイダーを使用している場合):
GitLab プロバイダに必要な環境変数:
GitHub Enterprise プロバイダーに必要な環境変数:
次のコマンドを実行します。
# 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