Skip to content

Upgrade Elasticsearch from 7.17.22 to 8.14 : #3242

Upgrade Elasticsearch from 7.17.22 to 8.14 :

Upgrade Elasticsearch from 7.17.22 to 8.14 : #3242

Workflow file for this run

name: Continuous integration
on: [push, pull_request]
jobs:
Test:
runs-on: ubuntu-latest
services:
redis:
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
# elasticsearch:
# image: elasticsearch:6.8.14
# options: >-
# --health-cmd "curl -f http://localhost:9200"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - 9200:9200
# - 9300:9300
# env:
# discovery.type: single-node
postgres:
image: postgis/postgis
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.1
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v4.0.2
with:
path: ~/.cache/pip # This path is specific to Ubuntu
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r dev-requirements.txt -r requirements.txt
- name: Lint
run: flake8 c2corg_api es_migration
- name: Configure postgres
run: |
echo "create user \"www-data\" with password 'www-data'" | psql
USER=github scripts/create_user_db_test.sh
env:
PGPASSWORD: postgres
PGUSER: postgres
PGHOST: localhost
PGPORT: 5432
- name: Create config from templates
run: make -f config/github-actions template
#- name: Install java 22 for elasticsearch
# uses: actions/setup-java@v4
# with:
# distribution: 'adopt'
# java-version: 22
- name: Install elasticsearch & plugin & 1st start
run: |
mkdir /tmp/elasticsearch
wget -O - https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.14.1-linux-x86_64.tar.gz | tar xz --directory=/tmp/elasticsearch --strip-components=1
/tmp/elasticsearch/bin/elasticsearch-plugin install analysis-icu
/tmp/elasticsearch/bin/elasticsearch --daemonize
sleep 30 # ElasticSearch takes few seconds to start, make sure it is available when the build script runs
- name: ElasticSearch settings update after auto configuration at 1st start & restart
run: |
sed -i 's/true/false/g' /tmp/elasticsearch/config/elasticsearch.yml
pgrep -f elasticsearch | xargs kill -9
/tmp/elasticsearch/bin/elasticsearch --daemonize
sleep 30 # Password change requires time
- name: Check elasticsearch
run: curl -v http://localhost:9200
- name: Run tests
run: pytest --cov-report term --cov-report xml --cov=c2corg_api
- name: Send coverage to codacy
# secrets are not available for PR from forks, and dependabot PRs
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
Docker:
# only publish if tests passed
needs: test
# secrets are not available for PR from forks, and dependabot PRs, we don't want to build them
if: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5.5.1
with:
images: ghcr.io/c2corg/v6_api
- name: Checkout repository
uses: actions/checkout@v4.1.1
- run: git archive --format=tar --output project.tar "$GITHUB_SHA"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Publish the docker image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
VERSION=${{ github.sha }}