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 Sep 14, 2024
1 parent fbf3041 commit 7a4d5e3
Show file tree
Hide file tree
Showing 31 changed files with 171 additions and 393 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.15.1
ELASTIC_VERSION=7.17.23

## 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 @@ -124,27 +124,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://kibana:5601/api/status' --resolve "kibana:5601:${ip_kb}" -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://elasticsearch:9200/logs-generic-default/_refresh'
"http://elasticsearch:9200/logstash-*/_refresh"
'--resolve' "elasticsearch:9200:${ip_es}"
)

Expand All @@ -76,7 +95,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://elasticsearch:9200/logs-generic-default/_search?q=message:dockerelk&pretty'
"http://elasticsearch:9200/logstash-*/_search?q=message:dockerelk&pretty"
'--resolve' "elasticsearch:9200:${ip_es}"
)
declare -i count
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/scripts/run-tests-fleet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,44 +70,3 @@ if (( count == 0 )); then
echo 'Expected at least 1 document'
exit 1
fi

# We expect to find log entries for the 'elasticsearch' Compose service using
# the following query:
#
# agent.name:"fleet-server"
# AND agent.type:"filebeat"
# AND container.name:"docker-elk-elasticsearch-1"
#
log 'Searching a container document generated by Fleet Server'

response=
count=0

was_retried=0

# retry for max 60s (30*2s)
for _ in $(seq 1 30); do
response="$(curl 'http://elasticsearch:9200/logs-docker.container_logs-default/_search?q=agent.name:%22fleet-server%22%20AND%20agent.type:%22filebeat%22%20AND%20container.name:%22docker-elk-elasticsearch-1%22&pretty' -s --resolve "elasticsearch:9200:${ip_es}" -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')"
set -u

if (( count > 0 )); then
break
fi

was_retried=1
echo -n 'x' >&2
sleep 2
done
if ((was_retried)); then
# flush stderr, important in non-interactive environments (CI)
echo >&2
fi

echo "$response"
if (( count == 0 )); then
echo 'Expected at least 1 document'
exit 1
fi
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 7a4d5e3

Please sign in to comment.