Skip to content

Commit

Permalink
Create release-7.x branch for Elastic 7.x series
Browse files Browse the repository at this point in the history
  • Loading branch information
antoineco committed Aug 7, 2023
1 parent c1f73f5 commit 361362b
Show file tree
Hide file tree
Showing 30 changed files with 160 additions and 339 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ELASTIC_VERSION=8.9.0
ELASTIC_VERSION=7.17.12

## Passwords for stack users
#
Expand Down
14 changes: 0 additions & 14 deletions .github/dependabot.yml

This file was deleted.

20 changes: 2 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [ main ]
branches: [ release-7.x ]
pull_request:
branches: [ main ]
branches: [ release-7.x ]

jobs:

Expand Down Expand Up @@ -147,27 +147,11 @@ jobs:

- name: Execute Enterprise Search test suite
run: |
# Set mandatory Elasticsearch settings
sed -i '$ a xpack.security.authc.api_key.enabled: true' elasticsearch/config/elasticsearch.yml
# Restart Elasticsearch for changes to take effect
docker compose restart elasticsearch
# Run Enterprise Search and execute tests
sed -i 's/\(secret_management.encryption_keys:\)/\1 [test-encrypt]/g' extensions/enterprise-search/config/enterprise-search.yml
docker compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml up --remove-orphans -d enterprise-search
.github/workflows/scripts/run-tests-enterprise-search.sh
# Revert changes to Elasticsearch configuration
sed -i '/xpack.security.authc.api_key.enabled: true/d' elasticsearch/config/elasticsearch.yml
docker compose restart elasticsearch
- name: Collect troubleshooting data
id: debug-data
if: failure()
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Documentation

on:
schedule:
- cron: '0 0 * * 0' # At 00:00 every Sunday
push:
branches: [ main ]
branches: [ release-7.x ]
pull_request:
branches: [ main ]
branches: [ release-7.x ]

jobs:

Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/scripts/elasticsearch-setup-passwords.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/expect -f

# List of expected users with dummy password
set user "(elastic|apm_system|kibana_system|logstash_system|beats_system|remote_monitoring_user)"
set password "testpasswd"

# Find elasticsearch container id
set cid [exec docker ps -q -f label=com.docker.compose.service=elasticsearch]

set cmd "docker exec -it $cid bin/elasticsearch-setup-passwords interactive -s -b -u http://localhost:9200"

spawn {*}$cmd

expect {
-re "(E|Ree)nter password for \\\[$user\\\]: " {
send "$password\r"
exp_continue
}
eof
}

lassign [wait] pid spawnid os_error_flag value
exit $value
23 changes: 21 additions & 2 deletions .github/workflows/scripts/run-tests-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ grouplog 'Wait for readiness of Kibana'
poll_ready "$cid_kb" "http://${ip_kb}:5601/api/status" -u 'kibana_system:testpasswd'
endgroup

log 'Creating Logstash index pattern in Kibana'
source .env
curl -X POST -D- "http://${ip_kb}:5601/api/saved_objects/index-pattern" \
-s -w '\n' \
-H 'Content-Type: application/json' \
-H "kbn-version: ${ELASTIC_VERSION}" \
-u elastic:testpasswd \
-d '{"attributes":{"title":"logstash-*","timeFieldName":"@timestamp"}}'

log 'Searching index pattern via Kibana API'
response="$(curl "http://${ip_kb}:5601/api/saved_objects/_find?type=index-pattern" -s -u elastic:testpasswd)"
echo "$response"
declare -i count
count="$(jq -rn --argjson data "${response}" '$data.total')"
if (( count != 1 )); then
echo "Expected 1 index pattern, got ${count}"
exit 1
fi

log 'Sending message to Logstash TCP input'

declare -i was_retried=0
Expand All @@ -50,7 +69,7 @@ fi
# need to be resilient here.
was_retried=0
declare -a refresh_args=( '-X' 'POST' '-s' '-w' '%{http_code}' '-u' 'elastic:testpasswd'
"http://${ip_es}:9200/logs-generic-default/_refresh"
"http://${ip_es}:9200/logstash-*/_refresh"
)

# retry for max 10s (10*1s)
Expand All @@ -75,7 +94,7 @@ log 'Searching message in Elasticsearch'
# we need to be resilient here too.
was_retried=0
declare -a search_args=( '-s' '-u' 'elastic:testpasswd'
"http://${ip_es}:9200/logs-generic-default/_search?q=message:dockerelk&pretty"
"http://${ip_es}:9200/logstash-*/_search?q=message:dockerelk&pretty"
)
declare -i count
declare response
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scripts/run-tests-logspout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ declare -i was_retried=0

# retry for max 60s (30*2s)
for _ in $(seq 1 30); do
response="$(curl "http://${ip_es}:9200/logs-generic-default/_search?q=docker.image:%22docker-elk-logspout%22%20AND%20message:%22logspout%20gliderlabs%22~3&pretty" -s -u elastic:testpasswd)"
response="$(curl "http://${ip_es}:9200/logstash-*/_search?q=docker.image:%22docker-elk-logspout%22%20AND%20message:%22logspout%20gliderlabs%22~3&pretty" -s -u elastic:testpasswd)"

set +u # prevent "unbound variable" if assigned value is not an integer
count="$(jq -rn --argjson data "${response}" '$data.hits.total.value')"
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/spam-issue-close.yml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/update-merge.yml

This file was deleted.

103 changes: 0 additions & 103 deletions .github/workflows/update.yml

This file was deleted.

Loading

0 comments on commit 361362b

Please sign in to comment.