Skip to content

Commit

Permalink
Merge branch 'main' into eui/v97.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Oct 11, 2024
2 parents 79eb6ed + 3493be4 commit 15f625f
Show file tree
Hide file tree
Showing 121 changed files with 2,221 additions and 573 deletions.
3 changes: 2 additions & 1 deletion .buildkite/pull_requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"^\\.backportrc\\.json$",
"^nav-kibana-dev\\.docnav\\.json$",
"^src/dev/prs/kibana_qa_pr_list\\.json$",
"^\\.buildkite/pull_requests\\.json$"
"^\\.buildkite/pull_requests\\.json$",
"^\\.devcontainer/"
],
"always_require_ci_on_changed": [
"^docs/developer/plugin-list.asciidoc$",
Expand Down
2 changes: 2 additions & 0 deletions .github/updatecli/values.d/ironbank.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config:
- path: src/dev/build/tasks/os_packages/docker_generator/templates/ironbank
11 changes: 11 additions & 0 deletions .github/updatecli/values.d/scm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
scm:
enabled: true
owner: elastic
repository: kibana
branch: main
commitusingapi: true
# begin updatecli-compose policy values
user: kibanamachine
email: [email protected]
# end updatecli-compose policy values

3 changes: 3 additions & 0 deletions .github/updatecli/values.d/updatecli-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spec:
files:
- "updatecli-compose.yaml"
38 changes: 38 additions & 0 deletions .github/workflows/updatecli-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: updatecli-compose

on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'

permissions:
contents: read

jobs:
compose:
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental compose diff
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental compose apply
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 31 additions & 14 deletions docs/maps/connect-to-ems.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:ems: Elastic Maps Service
:ems-docker-repo: docker.elastic.co/elastic-maps-service/elastic-maps-server
:ems-docker-image: {ems-docker-repo}:{version}-amd64
:ems-docker-image: {ems-docker-repo}:{version}
:ems-headers-url: https://deployment-host

[[maps-connect-to-ems]]
Expand Down Expand Up @@ -81,34 +81,53 @@ If you cannot connect to {ems} from the {kib} server or browser clients, and you

{hosted-ems} is a self-managed version of {ems} offered as a Docker image that provides both the EMS basemaps and EMS boundaries. The image is bundled with basemaps up to zoom level 8. After connecting it to your {es} cluster for license validation, you have the option to download and configure a more detailed basemaps database.

You can use +docker pull+ to download the {hosted-ems} image from the Elastic Docker registry.

. Pull the {hosted-ems} Docker image.
+
ifeval::["{release-state}"=="unreleased"]
Version {version} of {hosted-ems} has not yet been released, so no Docker image is currently available for this version.
WARNING: Version {version} of {hosted-ems} has not yet been released.
No Docker image is currently available for this version.
endif::[]

ifeval::["{release-state}"!="unreleased"]

+
["source","bash",subs="attributes"]
----------------------------------
docker pull {ems-docker-image}
----------------------------------

Start {hosted-ems} and expose the default port `8080`:
. Optional: Install
https://docs.sigstore.dev/system_config/installation/[Cosign] for your
environment. Then use Cosign to verify the {es} image's signature.
+
[source,sh,subs="attributes"]
----
wget https://artifacts.elastic.co/cosign.pub
cosign verify --key cosign.pub {ems-docker-image}
----
+
The `cosign` command prints the check results and the signature payload in JSON format:
+
[source,sh,subs="attributes"]
--------------------------------------------
Verification for {ems-docker-image} --
The following checks were performed on each of these signatures:
- The cosign claims were validated
- Existence of the claims in the transparency log was verified offline
- The signatures were verified against the specified public key
--------------------------------------------


. Start {hosted-ems} and expose the default port `8080`:
+
["source","bash",subs="attributes"]
----------------------------------
docker run --rm --init --publish 8080:8080 \
{ems-docker-image}
----------------------------------

+
Once {hosted-ems} is running, follow instructions from the webpage at `localhost:8080` to define a configuration file and optionally download a more detailed basemaps database.

+
[role="screenshot"]
image::images/elastic-maps-server-instructions.png[Set-up instructions]

endif::[]

[float]
[[elastic-maps-server-configuration]]
==== Configuration
Expand Down Expand Up @@ -193,7 +212,6 @@ One way to configure {hosted-ems} is to provide `elastic-maps-server.yml` via bi

["source","yaml",subs="attributes"]
--------------------------------------------
version: '2'
services:
ems-server:
image: {ems-docker-image}
Expand All @@ -212,7 +230,6 @@ These variables can be set with +docker-compose+ like this:

["source","yaml",subs="attributes"]
----------------------------------------------------------
version: '2'
services:
ems-server:
image: {ems-docker-image}
Expand Down
Binary file modified docs/maps/images/elastic-maps-server-instructions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,85 @@ ROW (asdf + asdf)::string, 1.2::string, "1234"::integer, (12321342134 + 23412341
- "aaaaaaaaaaa")::boolean`);
});
});

describe('list literals', () => {
describe('numeric', () => {
test('wraps long list literals one line', () => {
const query =
'ROW [1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890]';
const text = reprint(query).text;

expect('\n' + text).toBe(`
ROW
[1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890]`);
});

test('wraps long list literals to multiple lines one line', () => {
const query = `ROW [1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890]`;
const text = reprint(query).text;

expect('\n' + text).toBe(`
ROW
[1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890, 1234567890, 1234567890, 1234567890,
1234567890, 1234567890, 1234567890]`);
});

test('breaks very long values one-per-line', () => {
const query = `ROW fn1(fn2(fn3(fn4(fn5(fn6(fn7(fn8([1234567890, 1234567890, 1234567890, 1234567890, 1234567890]))))))))`;
const text = reprint(query, { wrap: 40 }).text;

expect('\n' + text).toBe(`
ROW
FN1(
FN2(
FN3(
FN4(
FN5(
FN6(
FN7(
FN8(
[
1234567890,
1234567890,
1234567890,
1234567890,
1234567890]))))))))`);
});
});

describe('string', () => {
test('wraps long list literals one line', () => {
const query =
'ROW ["some text", "another text", "one more text literal", "and another one", "and one more", "and one more", "and one more", "and one more", "and one more"]';
const text = reprint(query).text;

expect('\n' + text).toBe(`
ROW
["some text", "another text", "one more text literal", "and another one",
"and one more", "and one more", "and one more", "and one more",
"and one more"]`);
});

test('can break very long strings per line', () => {
const query =
'ROW ["..............................................", "..............................................", ".............................................."]';
const text = reprint(query).text;

expect('\n' + text).toBe(`
ROW
[
"..............................................",
"..............................................",
".............................................."]`);
});
});
});
});

test.todo('Idempotence on multiple times pretty printing');
23 changes: 13 additions & 10 deletions packages/kbn-esql-ast/src/pretty_print/wrapping_pretty_printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import {
CommandVisitorContext,
ExpressionVisitorContext,
FunctionCallExpressionVisitorContext,
ListLiteralExpressionVisitorContext,
Visitor,
} from '../visitor';
import { singleItems } from '../visitor/utils';
import { children, singleItems } from '../visitor/utils';
import { BasicPrettyPrinter, BasicPrettyPrinterOptions } from './basic_pretty_printer';
import { getPrettyPrintStats } from './helpers';
import { LeafPrinter } from './leaf_printer';
Expand Down Expand Up @@ -235,7 +236,11 @@ export class WrappingPrettyPrinter {
}

private printArguments(
ctx: CommandVisitorContext | CommandOptionVisitorContext | FunctionCallExpressionVisitorContext,
ctx:
| CommandVisitorContext
| CommandOptionVisitorContext
| FunctionCallExpressionVisitorContext
| ListLiteralExpressionVisitorContext,
inp: Input
) {
let txt = '';
Expand All @@ -247,7 +252,7 @@ export class WrappingPrettyPrinter {
let remainingCurrentLine = inp.remaining;
let oneArgumentPerLine = false;

for (const child of singleItems(ctx.node.args)) {
for (const child of children(ctx.node)) {
if (getPrettyPrintStats(child).hasLineBreakingDecorations) {
oneArgumentPerLine = true;
break;
Expand Down Expand Up @@ -489,13 +494,11 @@ export class WrappingPrettyPrinter {
})

.on('visitListLiteralExpression', (ctx, inp: Input): Output => {
let elements = '';

for (const out of ctx.visitElements(inp)) {
elements += (elements ? ', ' : '') + out.txt;
}

const formatted = `[${elements}]${inp.suffix ?? ''}`;
const args = this.printArguments(ctx, {
indent: inp.indent,
remaining: inp.remaining - 1,
});
const formatted = `[${args.txt}]${inp.suffix ?? ''}`;
const { txt, indented } = this.decorateWithComments(inp.indent, ctx.node, formatted);

return { txt, indented };
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-esql-ast/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type ESQLAstField = ESQLFunction | ESQLColumn;
export type ESQLAstItem = ESQLSingleAstItem | ESQLAstItem[];

export type ESQLAstNodeWithArgs = ESQLCommand | ESQLCommandOption | ESQLFunction;
export type ESQLAstNodeWithChildren = ESQLAstNodeWithArgs | ESQLList;

/**
* *Proper* are nodes which are objects with `type` property, once we get rid
Expand Down
12 changes: 9 additions & 3 deletions packages/kbn-esql-ast/src/visitor/contexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
// and makes it harder to understand the code structure.

import { type GlobalVisitorContext, SharedData } from './global_visitor_context';
import { firstItem, singleItems } from './utils';
import { children, firstItem, singleItems } from './utils';
import type {
ESQLAstCommand,
ESQLAstItem,
ESQLAstNodeWithArgs,
ESQLAstNodeWithChildren,
ESQLAstRenameExpression,
ESQLColumn,
ESQLCommandOption,
Expand Down Expand Up @@ -47,6 +48,11 @@ import { Builder } from '../builder';
const isNodeWithArgs = (x: unknown): x is ESQLAstNodeWithArgs =>
!!x && typeof x === 'object' && Array.isArray((x as any).args);

const isNodeWithChildren = (x: unknown): x is ESQLAstNodeWithChildren =>
!!x &&
typeof x === 'object' &&
(Array.isArray((x as any).args) || Array.isArray((x as any).values));

export class VisitorContext<
Methods extends VisitorMethods = VisitorMethods,
Data extends SharedData = SharedData,
Expand Down Expand Up @@ -99,13 +105,13 @@ export class VisitorContext<
public arguments(): ESQLAstExpressionNode[] {
const node = this.node;

if (!isNodeWithArgs(node)) {
if (!isNodeWithChildren(node)) {
return [];
}

const args: ESQLAstExpressionNode[] = [];

for (const arg of singleItems(node.args)) {
for (const arg of children(node)) {
args.push(arg);
}

Expand Down
31 changes: 30 additions & 1 deletion packages/kbn-esql-ast/src/visitor/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { ESQLAstItem, ESQLSingleAstItem } from '../types';
import { ESQLAstItem, ESQLProperNode, ESQLSingleAstItem } from '../types';

/**
* Normalizes AST "item" list to only contain *single* items.
Expand Down Expand Up @@ -48,3 +48,32 @@ export const lastItem = (items: ESQLAstItem[]): ESQLSingleAstItem | undefined =>
if (Array.isArray(last)) return lastItem(last as ESQLAstItem[]);
return last as ESQLSingleAstItem;
};

export function* children(node: ESQLProperNode): Iterable<ESQLSingleAstItem> {
switch (node.type) {
case 'function':
case 'command':
case 'option': {
for (const arg of singleItems(node.args)) {
yield arg;
}
break;
}
case 'list': {
for (const item of singleItems(node.values)) {
yield item;
}
break;
}
case 'inlineCast': {
if (Array.isArray(node.value)) {
for (const item of singleItems(node.value)) {
yield item;
}
} else {
yield node.value;
}
break;
}
}
}
3 changes: 3 additions & 0 deletions src/dev/precommit_hook/casing_check_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export const IGNORE_FILE_GLOBS = [

// Support for including http-client.env.json configurations
'**/http-client.env.json',

// updatecli configuration for driving the UBI/Ironbank image updates
'updatecli-compose.yaml',
];

/**
Expand Down
Loading

0 comments on commit 15f625f

Please sign in to comment.