From 43485877c713fd3f3afd99715153f9b85aab9050 Mon Sep 17 00:00:00 2001 From: Remi Dettai Date: Thu, 18 Jan 2024 14:09:59 +0100 Subject: [PATCH] Fix lambda package name (#4419) * Fix lambda package name * Automatically infer last version * Use aws-beta- as tag name * Add instruction about virtualenv to tutorial * Fix release name --- .github/workflows/publish_lambda_packages.yml | 8 ++------ distribution/lambda/Makefile | 13 +++++++++---- distribution/lambda/README.md | 2 +- docs/get-started/tutorials/tutorial-aws-lambda.md | 10 +++++++--- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish_lambda_packages.yml b/.github/workflows/publish_lambda_packages.yml index 6b511183dac..9ab24fd7a90 100644 --- a/.github/workflows/publish_lambda_packages.yml +++ b/.github/workflows/publish_lambda_packages.yml @@ -3,7 +3,7 @@ name: Build and publish AWS Lambda packages on: push: tags: - - "lambda-beta-*" + - "aws-lambda-beta-*" jobs: build-lambdas: @@ -19,10 +19,6 @@ jobs: run: pip install ./distribution/lambda - name: Mypy lint run: mypy distribution/lambda/ - - - name: Extract asset version of release - run: echo "QW_LAMBDA_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - if: ${{ github.event_name == 'push' }} - name: Retrieve and export commit date, hash, and tags run: | echo "QW_COMMIT_DATE=$(TZ=UTC0 git log -1 --format=%cd --date=format-local:%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV @@ -49,4 +45,4 @@ jobs: file: ${{ env.SEARCHER_PACKAGE_LOCATION }};${{ env.INDEXER_PACKAGE_LOCATION }} overwrite: true draft: true - tag_name: aws-${{ env.QW_LAMBDA_VERSION }} + tag_name: ${{ github.ref_name }} diff --git a/distribution/lambda/Makefile b/distribution/lambda/Makefile index 4dfd1d1b076..39cd723271f 100644 --- a/distribution/lambda/Makefile +++ b/distribution/lambda/Makefile @@ -3,8 +3,8 @@ SHELL := bash .SHELLFLAGS := -eu -o pipefail -c -# Update this when cutting a new release -QW_LAMBDA_VERSION?=beta-01 +QW_LAMBDA_VERSION?=$(shell git tag --sort=committerdate | grep -E "aws-lambda-beta-" | tail -1 | cut -b 12-) +$(if $(QW_LAMBDA_VERSION),,$(error "Version tag not found, try 'git fetch --tags' or specify QW_LAMBDA_VERSION=beta-")) PACKAGE_BASE_URL=https://github.com/quickwit-oss/quickwit/releases/download/aws-lambda-$(QW_LAMBDA_VERSION)/ SEARCHER_PACKAGE_FILE=quickwit-lambda-searcher-$(QW_LAMBDA_VERSION)-x86_64.zip INDEXER_PACKAGE_FILE=quickwit-lambda-indexer-$(QW_LAMBDA_VERSION)-x86_64.zip @@ -65,10 +65,15 @@ deploy-hdfs: package check-env deploy-mock-data: package check-env cdk deploy -a cdk/app.py MockDataStack -destroy-hdfs: +# address https://github.com/aws/aws-cdk/issues/20060 +before-destroy: + touch $(INDEXER_PACKAGE_PATH) + touch $(SEARCHER_PACKAGE_PATH) + +destroy-hdfs: before-destroy cdk destroy -a cdk/app.py HdfsStack -destroy-mock-data: +destroy-mock-data: before-destroy cdk destroy -a cdk/app.py MockDataStack clean: diff --git a/distribution/lambda/README.md b/distribution/lambda/README.md index 6fd65615b78..15d5faad12c 100644 --- a/distribution/lambda/README.md +++ b/distribution/lambda/README.md @@ -4,7 +4,7 @@ ## Prerequisites - Install AWS CDK Toolkit (cdk command) - - `npm install -g aws-cdk ` + - `npm install -g aws-cdk` - Ensure `curl` and `make` are installed - To run the invocation example `make` commands, you will also need Python 3.10 or later and `pip` installed (see [Python venv](#python-venv) below). diff --git a/docs/get-started/tutorials/tutorial-aws-lambda.md b/docs/get-started/tutorials/tutorial-aws-lambda.md index 1584acdee33..30b593a8da1 100644 --- a/docs/get-started/tutorials/tutorial-aws-lambda.md +++ b/docs/get-started/tutorials/tutorial-aws-lambda.md @@ -83,9 +83,9 @@ Before running a system in the Cloud, it is always a good idea to get a rough es ### Prerequisites -We use [AWS CDK](https://aws.amazon.com/cdk/) for our infrastructure automation script. Install it using [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm): +We use [AWS CDK](https://aws.amazon.com/cdk/) for our infrastructure automation script. Install or upgrade it using [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm): ```bash -npm install -g aws-cdk +npm install -g aws-cdk@latest ``` We also use the `curl` and `make` commands. For instance on Debian based distributions: ```bash @@ -94,11 +94,15 @@ sudo apt update && sudo apt install curl make You also need AWS credentials to be properly configured in your shell. One way is using the [credentials file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html). -Finally, clone the Quickwit repository: +Finally, clone the Quickwit repository and install the Python dependencies (Python3.10 required) in a virtual environment: ```bash git clone https://github.com/quickwit-oss/quickwit.git cd quickwit/distribution/lambda +python3 -m venv .venv +source .venv/bin/activate +pip install . ``` + ### Deploy Configure the AWS region and [account id](https://docs.aws.amazon.com/IAM/latest/UserGuide/console_account-alias.html) where you want to deploy the example stack: ```bash