-
-
Notifications
You must be signed in to change notification settings - Fork 506
chore: update Elasticsearch stack to 9.5.0 #2437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,7 @@ jobs: | |
| timeout-minutes: 30 | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| elasticsearch_image_tag: ${{ steps.elasticsearch_image.outputs.tag }} | ||
| should_publish: ${{ (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'dev-preview')) && secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }} | ||
| is_prod_deploy: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' }} | ||
| is_dev_deploy: ${{ (github.event_name == 'repository_dispatch' && github.event.action == 'preview') || (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'dev-preview')) }} | ||
|
|
@@ -129,9 +130,52 @@ jobs: | |
| echo "version=$version" >> $GITHUB_OUTPUT | ||
| echo "### $version" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| - name: Resolve Elasticsearch image | ||
| id: elasticsearch_image | ||
| env: | ||
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| PUSH_BEFORE_SHA: ${{ github.event.before }} | ||
| run: | | ||
| version=$(sed -n 's/.*elasticsearch:\([^ ]*\).*/\1/p' build/docker/elasticsearch/9.x/Dockerfile) | ||
| tag=$version | ||
| image_changed=false | ||
|
|
||
| if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]] && | ||
| ! git diff --quiet "$PR_BASE_SHA"...HEAD -- build/docker/elasticsearch/9.x .github/workflows/elasticsearch-docker-9.yml; then | ||
| image_changed=true | ||
| elif [[ "$GITHUB_EVENT_NAME" == "push" && "$GITHUB_REF" == "refs/heads/main" ]] && | ||
| ! git diff --quiet "$PUSH_BEFORE_SHA"..HEAD -- build/docker/elasticsearch/9.x .github/workflows/elasticsearch-docker-9.yml; then | ||
| image_changed=true | ||
| fi | ||
|
|
||
| if [[ "$image_changed" == "true" ]]; then | ||
| image_sha=$(git ls-files -- build/docker/elasticsearch/9.x .github/workflows/elasticsearch-docker-9.yml | sort | xargs sha256sum | sha256sum | cut -d " " -f 1) | ||
| tag="$version-sha256-$image_sha" | ||
| image="exceptionless/elasticsearch:$tag" | ||
|
|
||
| for attempt in {1..150}; do | ||
| if docker manifest inspect "$image" > /dev/null 2>&1; then | ||
| break | ||
| fi | ||
|
|
||
| if [[ "$attempt" -eq 150 ]]; then | ||
| echo "::error::Timed out waiting for $image to be published." | ||
| exit 1 | ||
| fi | ||
|
|
||
| sleep 10 | ||
| done | ||
| fi | ||
|
|
||
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | ||
| echo "### Elasticsearch image: exceptionless/elasticsearch:$tag" >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| test-api: | ||
| needs: version | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| env: | ||
| Elasticsearch__ImageTag: ${{ needs.version.outputs.elasticsearch_image_tag }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -223,8 +267,11 @@ jobs: | |
| run: echo "npm run test:integration" | ||
|
|
||
| test-e2e: | ||
| needs: version | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 45 | ||
| env: | ||
| Elasticsearch__ImageTag: ${{ needs.version.outputs.elasticsearch_image_tag }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
|
|
@@ -558,27 +605,6 @@ jobs: | |
| sed -i "s/^appVersion:.*$/appVersion: '${VERSION}'/" ./k8s/exceptionless/Chart.yaml | ||
| helm upgrade --set "version=${VERSION}" --reuse-values --values ./k8s/ex-dev-values.yaml ex-dev --namespace $DEV_NAMESPACE ./k8s/exceptionless | ||
|
|
||
| - name: Run Development Migrations | ||
| if: ${{ needs.version.outputs.is_dev_deploy == 'true' }} | ||
| run: | | ||
| migration_job="ex-dev-jobs-migration-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" | ||
| kubectl create job --from=cronjob/ex-dev-jobs-migration "$migration_job" --namespace "$DEV_NAMESPACE" | ||
|
|
||
| migration_image=$(kubectl get job "$migration_job" --namespace "$DEV_NAMESPACE" \ | ||
| --output jsonpath='{.spec.template.spec.containers[0].image}') | ||
| if [[ "$migration_image" != *":${VERSION}" ]]; then | ||
| echo "::error::Migration job uses ${migration_image}; expected version ${VERSION}." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! kubectl wait --for=condition=complete --timeout=1200s "job/${migration_job}" --namespace "$DEV_NAMESPACE"; then | ||
| echo "::group::Migration job diagnostics" | ||
| kubectl describe job "$migration_job" --namespace "$DEV_NAMESPACE" | ||
| kubectl get pods --selector "job-name=${migration_job}" --namespace "$DEV_NAMESPACE" --output wide | ||
| echo "::endgroup::" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Ensure Development Workloads are Running | ||
| if: ${{ needs.version.outputs.is_dev_deploy == 'true' }} | ||
| run: | | ||
|
|
@@ -599,6 +625,7 @@ jobs: | |
| kubectl patch cronjob/ex-dev-jobs-cleanup-orphaned-data -p '{"spec":{"suspend": false}}' --namespace $DEV_NAMESPACE | ||
| kubectl patch cronjob/ex-dev-jobs-download-geoip-database -p '{"spec":{"suspend": false}}' --namespace $DEV_NAMESPACE | ||
| kubectl patch cronjob/ex-dev-jobs-maintain-indexes -p '{"spec":{"suspend": false}}' --namespace $DEV_NAMESPACE | ||
| kubectl patch cronjob/ex-dev-jobs-migration -p '{"spec":{"suspend": false}}' --namespace $DEV_NAMESPACE | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Replacing the explicit migration job with this patch does not run migrations: Useful? React with 👍 / 👎. |
||
|
|
||
| wait_for_versioned_pod() { | ||
| component="$1" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Elasticsearch 9.x Docker Image CI | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - "build/docker/elasticsearch/9.x/**" | ||
| - ".github/workflows/elasticsearch-docker-9.yml" | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/v') != true | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Setup .NET Core | ||
| uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: 10.0.301 | ||
| - name: Build Reason | ||
| env: | ||
| GITHUB_EVENT: ${{ toJson(github) }} | ||
| run: "echo ref: ${{github.ref}} event: ${{github.event_name}}" | ||
| - name: Build Version | ||
| run: | | ||
| dotnet tool install --global minver-cli --version 7.0.0 | ||
| version=$(minver --tag-prefix v) | ||
| echo "MINVERVERSIONOVERRIDE=$version" >> $GITHUB_ENV | ||
| echo "VERSION=$version" >> $GITHUB_ENV | ||
| echo "### Version: $version" >> $GITHUB_STEP_SUMMARY | ||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v4 | ||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v4 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
| with: | ||
| platforms: linux/amd64,linux/arm64 | ||
| - name: Build custom Elasticsearch 9.x docker image | ||
| env: | ||
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | ||
| run: | | ||
| VERSION=$(sed -n 's/.*elasticsearch:\([^ ]*\).*/\1/p' build/docker/elasticsearch/9.x/Dockerfile) | ||
| IMAGE_SHA=$(git ls-files -- build/docker/elasticsearch/9.x .github/workflows/elasticsearch-docker-9.yml | sort | xargs sha256sum | sha256sum | cut -d " " -f 1) | ||
| TAGS=(--tag "exceptionless/elasticsearch:$VERSION-sha256-$IMAGE_SHA") | ||
| if [[ "$GITHUB_REF" == "refs/heads/$DEFAULT_BRANCH" ]]; then | ||
| TAGS+=(--tag "exceptionless/elasticsearch:$VERSION" --tag "exceptionless/elasticsearch:latest") | ||
| fi | ||
| docker buildx build --platform linux/amd64,linux/arm64 --output "type=image,push=true" --file build/docker/elasticsearch/9.x/Dockerfile build/docker/elasticsearch/9.x "${TAGS[@]}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # https://www.docker.elastic.co/ | ||
| FROM docker.elastic.co/elasticsearch/elasticsearch:9.5.0 | ||
|
|
||
| RUN elasticsearch-plugin install -b mapper-size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a fork pull request changes either watched Elasticsearch path, this branch waits 25 minutes for a content-addressed image that cannot be published by the added
elasticsearch-docker-9.yml: that workflow only handlespushevents in its own repository, and GitHub also documents that “secrets are not passed to the runner when a workflow is triggered from a forked repository” (GitHub Actions secrets documentation). Sincetest-api,test-e2e, anddocker-buildall need this job, such external contributions deterministically time out instead of receiving CI; build the candidate in a trusted workflow or skip candidate-image resolution where publication is impossible.Useful? React with 👍 / 👎.