Skip to content

Commit

Permalink
Merge branch 'main' into fix/olm-revisit_blocklist_list_labels-3237
Browse files Browse the repository at this point in the history
  • Loading branch information
dasansol92 committed Mar 31, 2022
2 parents 35b0b81 + f4f145d commit 581bcd7
Show file tree
Hide file tree
Showing 885 changed files with 33,835 additions and 8,049 deletions.
3 changes: 2 additions & 1 deletion .backportrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"repoName": "kibana",
"targetBranchChoices": [
"main",
"8.2",
"8.1",
"8.0",
"7.17",
Expand Down Expand Up @@ -38,7 +39,7 @@
"backport"
],
"branchLabelMapping": {
"^v8.2.0$": "main",
"^v8.3.0$": "main",
"^v(\\d+).(\\d+).\\d+$": "$1.$2"
},
"autoMerge": true,
Expand Down
12 changes: 10 additions & 2 deletions .buildkite/scripts/steps/artifacts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ set -euo pipefail

.buildkite/scripts/bootstrap.sh

if [[ "${RELEASE_BUILD:-}" == "true" ]]; then
VERSION="$(jq -r '.version' package.json)"
RELEASE_ARG="--release"
else
VERSION="$(jq -r '.version' package.json)-SNAPSHOT"
RELEASE_ARG=""
fi

echo "--- Build Kibana Distribution"
node scripts/build --all-platforms --debug --docker-cross-compile --skip-docker-cloud
node scripts/build "$RELEASE_ARG" --all-platforms --debug --docker-cross-compile --skip-docker-cloud

echo "--- Build dependencies report"
node scripts/licenses_csv_report --csv=target/dependencies_report.csv
node scripts/licenses_csv_report "--csv=target/dependencies-$VERSION.csv"
6 changes: 6 additions & 0 deletions .buildkite/scripts/steps/build_api_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ set -euo pipefail

.buildkite/scripts/bootstrap.sh

echo "--- Build TS Refs"
node scripts/build_ts_refs \
--clean \
--no-cache \
--force

echo "--- Build API Docs"
node --max-old-space-size=12000 scripts/build_api_docs
18 changes: 1 addition & 17 deletions .buildkite/scripts/steps/es_snapshots/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ echo "--- Build Elasticsearch"
:distribution:archives:darwin-aarch64-tar:assemble \
:distribution:archives:darwin-tar:assemble \
:distribution:docker:docker-export:assemble \
:distribution:docker:cloud-docker-export:assemble \
:distribution:archives:linux-aarch64-tar:assemble \
:distribution:archives:linux-tar:assemble \
:distribution:archives:windows-zip:assemble \
Expand All @@ -80,26 +79,11 @@ find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elas

ls -alh "$destination"

echo "--- Create docker default image archives"
echo "--- Create docker image archives"
docker images "docker.elastic.co/elasticsearch/elasticsearch"
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 echo 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 bash -c 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'

echo "--- Create kibana-ci docker cloud image archives"
ES_CLOUD_ID=$(docker images "docker.elastic.co/elasticsearch-ci/elasticsearch-cloud" --format "{{.ID}}")
ES_CLOUD_VERSION=$(docker images "docker.elastic.co/elasticsearch-ci/elasticsearch-cloud" --format "{{.Tag}}")
KIBANA_ES_CLOUD_VERSION="$ES_CLOUD_VERSION-$ELASTICSEARCH_GIT_COMMIT"
KIBANA_ES_CLOUD_IMAGE="docker.elastic.co/kibana-ci/elasticsearch-cloud:$KIBANA_ES_CLOUD_VERSION"

docker tag "$ES_CLOUD_ID" "$KIBANA_ES_CLOUD_IMAGE"

echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
trap 'docker logout docker.elastic.co' EXIT
docker image push "$KIBANA_ES_CLOUD_IMAGE"

export ELASTICSEARCH_CLOUD_IMAGE="$KIBANA_ES_CLOUD_IMAGE"
export ELASTICSEARCH_CLOUD_IMAGE_CHECKSUM="$(docker images "$KIBANA_ES_CLOUD_IMAGE" --format "{{.Digest}}")"

echo "--- Create checksums for snapshot files"
cd "$destination"
find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \;
Expand Down
13 changes: 0 additions & 13 deletions .buildkite/scripts/steps/es_snapshots/create_manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
const destination = process.argv[2] || __dirname + '/test';

const ES_BRANCH = process.env.ELASTICSEARCH_BRANCH;
const ES_CLOUD_IMAGE = process.env.ELASTICSEARCH_CLOUD_IMAGE;
const ES_CLOUD_IMAGE_CHECKSUM = process.env.ELASTICSEARCH_CLOUD_IMAGE_CHECKSUM;
const GIT_COMMIT = process.env.ELASTICSEARCH_GIT_COMMIT;
const GIT_COMMIT_SHORT = process.env.ELASTICSEARCH_GIT_COMMIT_SHORT;

Expand Down Expand Up @@ -61,17 +59,6 @@ const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
};
});

if (ES_CLOUD_IMAGE && ES_CLOUD_IMAGE_CHECKSUM) {
manifestEntries.push({
checksum: ES_CLOUD_IMAGE_CHECKSUM,
url: ES_CLOUD_IMAGE,
version: VERSION,
platform: 'docker',
architecture: 'image',
license: 'default',
});
}

const manifest = {
id: SNAPSHOT_ID,
bucket: `${BASE_BUCKET_DAILY}/${DESTINATION}`.toString(),
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/functional/synthetics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ echo "--- Uptime @elastic/synthetics Tests"
cd "$XPACK_DIR"

checks-reporter-with-killswitch "Uptime @elastic/synthetics Tests" \
node plugins/uptime/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --grep "MonitorManagement*"
node plugins/uptime/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --grep "MonitorManagement-monitor*"
1 change: 1 addition & 0 deletions .buildkite/scripts/steps/storybooks/build_and_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const STORYBOOKS = [
'canvas',
'ci_composite',
'cloud',
'controls',
'custom_integrations',
'dashboard_enhanced',
'dashboard',
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
/packages/kbn-utils/ @elastic/kibana-operations
/packages/kbn-cli-dev-mode/ @elastic/kibana-operations
/packages/kbn-generate/ @elastic/kibana-operations
/packages/kbn-plugin-discovery/ @elastic/kibana-operations
/src/cli/keystore/ @elastic/kibana-operations
/.ci/es-snapshots/ @elastic/kibana-operations
/.github/workflows/ @elastic/kibana-operations
Expand Down Expand Up @@ -353,6 +354,8 @@
#CC# /x-pack/plugins/stack_alerts @elastic/response-ops
/x-pack/plugins/cases/ @elastic/response-ops
/x-pack/test/cases_api_integration/ @elastic/response-ops
/x-pack/test/functional/services/cases/ @elastic/response-ops
/x-pack/test/functional_with_es_ssl/apps/cases/ @elastic/response-ops

# Enterprise Search
/x-pack/plugins/enterprise_search @elastic/enterprise-search-frontend
Expand Down
14 changes: 9 additions & 5 deletions docs/api/cases.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
You can create, manage, configure, and send cases to external systems with
these APIs:

* {security-guide}/cases-api-add-comment.html[Add comment]
* <<cases-api-add-comment>>
* <<cases-api-create>>
* <<cases-api-delete-cases>>
* <<cases-api-delete-comments>>
Expand All @@ -13,19 +13,20 @@ these APIs:
* {security-guide}/cases-api-find-cases-by-alert.html[Find cases by alert]
* <<cases-api-find-connectors>>
* {security-guide}/cases-api-get-case-activity.html[Get all case activity]
* {security-guide}/cases-api-get-all-case-comments.html[Get all case comments]
* <<cases-api-get-case>>
* {security-guide}/cases-api-get-comment.html[Get comment]
* <<cases-api-get-status>>
* <<cases-api-get-comments>>
* {security-guide}/cases-get-connector.html[Get current connector]
* {security-guide}/cases-api-get-reporters.html[Get reporters]
* {security-guide}/cases-api-get-status.html[Get status]
* {security-guide}/cases-api-get-tag.html[Get tags]
* {security-guide}/cases-api-push.html[Push case]
* {security-guide}/assign-connector.html[Set default Elastic Security UI connector]
* {security-guide}/case-api-update-connector.html[Update case configurations]
* <<cases-api-update>>
* {security-guide}/cases-api-update-comment.html[Update comment]
* <<cases-api-update-comment>>

//ADD
include::cases/cases-api-add-comment.asciidoc[leveloffset=+1]
//CREATE
include::cases/cases-api-create.asciidoc[leveloffset=+1]
//DELETE
Expand All @@ -36,5 +37,8 @@ include::cases/cases-api-find-cases.asciidoc[leveloffset=+1]
include::cases/cases-api-find-connectors.asciidoc[leveloffset=+1]
//GET
include::cases/cases-api-get-case.asciidoc[leveloffset=+1]
include::cases/cases-api-get-status.asciidoc[leveloffset=+1]
include::cases/cases-api-get-comments.asciidoc[leveloffset=+1]
//UPDATE
include::cases/cases-api-update.asciidoc[leveloffset=+1]
include::cases/cases-api-update-comment.asciidoc[leveloffset=+1]
164 changes: 164 additions & 0 deletions docs/api/cases/cases-api-add-comment.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
[[cases-api-add-comment]]
== Add comment to case API
++++
<titleabbrev>Add comment</titleabbrev>
++++

Adds a comment to a case.

=== Request

`POST <kibana host>:<port>/api/cases/<case_id>/comments`

`POST <kibana host>:<port>/s/<space_id>/api/cases/<case_id>/comments`

=== Prerequisite

You must have `all` privileges for the *Cases* feature in the *Management*,
*{observability}*, or *Security* section of the
<<kibana-feature-privileges,{kib} feature privileges>>, depending on the
`owner` of the case you're updating.


=== Path parameters

`<case_id>`::
(Required,string) The identifier for the case. To retrieve case IDs, use
<<cases-api-find-cases>>.

`<space_id>`::
(Optional, string) An identifier for the space. If it is not specified, the
default space is used.

=== Request body

`alertId`::
(Required*, string) The alert identifier. It is required only when `type` is
`alert`. preview:[]

`comment`::
(Required*, string) The new comment. It is required only when `type` is `user`.

`index`::
(Required*, string) The alert index. It is required only when `type` is `alert`.
preview:[]

`owner`::
(Required, string) The application that owns the case. Valid values are:
`cases`, `observability`, or `securitySolution`.

`rule`::
(Required*, object) The rule that is associated with the alert. It is required
only when `type` is `alert`. preview:[]
+
.Properties of `rule`
[%collapsible%open]
====
`id`::
(Required, string) The rule identifier. preview:[]
`name`::
(Required, string) The rule name. preview:[]
====

`type`::
(Required, string) The comment type, which must be `user` or `alert`.

=== Response code

`200`::
Indicates a successful call.

=== Example

Add a comment to case ID `293f1bc0-74f6-11ea-b83a-553aecdb28b6`:

[source,sh]
--------------------------------------------------
POST api/cases/293f1bc0-74f6-11ea-b83a-553aecdb28b6/comments
{
"type": "user",
"comment": "That is nothing - Ethan Hunt answered a targeted social media campaign promoting phishy pension schemes to IMF operatives.",
"owner": "cases"
}
--------------------------------------------------
// KIBANA

The API returns details about the case and its comments. For example:

[source,json]
--------------------------------------------------
{
"comments":[
{
"id": "8af6ac20-74f6-11ea-b83a-553aecdb28b6",
"version": "WzIwNDMxLDFd",
"type":"user",
"owner":"cases",
"comment":"That is nothing - Ethan Hunt answered a targeted social media campaign promoting phishy pension schemes to IMF operatives.",
"created_at":"2022-03-24T00:49:47.716Z",
"created_by": {
"email": "moneypenny@hms.gov.uk",
"full_name": "Ms Moneypenny",
"username": "moneypenny"
},
"pushed_at":null,
"pushed_by":null,
"updated_at":null,
"updated_by":null
}
],
"totalAlerts":0,
"id":"293f1bc0-74f6-11ea-b83a-553aecdb28b6",
"version":"WzIzMzgsMV0=",
"totalComment":1,
"title": "This case will self-destruct in 5 seconds",
"tags": ["phishing","social engineering"],
"description": "James Bond clicked on a highly suspicious email banner advertising cheap holidays for underpaid civil servants.",
"settings": {
"syncAlerts":false
},
"owner": "cases",
"closed_at": null,
"closed_by": null,
"created_at": "2022-03-24T00:37:03.906Z",
"created_by": {
"email": "ahunley@imf.usa.gov",
"full_name": "Alan Hunley",
"username": "ahunley"
},
"status": "open",
"updated_at": "2022-03-24T00:49:47.716Z",
"updated_by": {
"email": "moneypenny@hms.gov.uk",
"full_name": "Ms Moneypenny",
"username": "moneypenny"
},
"connector": {
"id": "none",
"name": "none",
"type": ".none",
"fields": null
},
"external_service": null
}
--------------------------------------------------

Add an alert to the case:

[source,sh]
--------------------------------------------------
POST api/cases/293f1bc0-74f6-11ea-b83a-553aecdb28b6/comments
{
"alertId": "6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42",
"index": ".internal.alerts-security.alerts-default-000001",
"type": "alert",
"owner": "cases",
"rule": {
"id":"94d80550-aaf4-11ec-985f-97e55adae8b9",
"name":"security_rule"
}
}
--------------------------------------------------
// KIBANA
6 changes: 3 additions & 3 deletions docs/api/cases/cases-api-delete-comments.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ You must have `all` privileges for the *Cases* feature in the *Management*,
<<cases-api-find-cases>>.

`<comment_id>`::
(Optional, string) The identifier for the comment.
//To retrieve comment IDs, use <<cases-api-get-all-case-comments>>.
If it is not specified, all comments are deleted.
(Optional, string) The identifier for the comment. To retrieve comment IDs, use
<<cases-api-get-case>> or <<cases-api-find-cases>>. If it is not specified, all
comments are deleted.

<space_id>::
(Optional, string) An identifier for the space. If it is not specified, the
Expand Down
Loading

0 comments on commit 581bcd7

Please sign in to comment.