Skip to content

Commit

Permalink
Fix CI errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rdettai committed Nov 22, 2023
1 parent 799872b commit 26015e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 30 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/publish_lambda_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ubuntu packages
run: sudo apt-get -y install protobuf-compiler python3 python3-pip
- name: Install rustup
run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
- name: Install cargo lambda
run: pip3 install cargo-lambda

- name: Extract asset version of release
run: echo "ASSET_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
if: ${{ github.event_name == 'push' }}
Expand All @@ -28,39 +35,28 @@ jobs:
echo "ASSET_TARGET=x86_64" >> $GITHUB_ENV
echo "SEARCHER_ASSET_FULL_NAME=quickwit-lambda-searcher-${{ env.ASSET_VERSION }}-${{ env.ASSET_TARGET }}.zip" >> $GITHUB_ENV
echo "INDEXER_ASSET_FULL_NAME=quickwit-lambda-indexer-${{ env.ASSET_VERSION }}-${{ env.ASSET_TARGET }}.zip" >> $GITHUB_ENV
- name: Install rustup
run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -y
- 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
echo "QW_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "QW_COMMIT_TAGS=$(git tag --points-at HEAD | tr '\n' ',')" >> $GITHUB_ENV
- name: Build Quickwit Lambda
run: cargo lambda build -p quickwit-lambda --release
- name: Build Quickwit Lambdas
run: |
cargo lambda build -p quickwit-lambda --release --output-format zip
mv target/lambda/searcher/bootstrap.zip ${{ env.SEARCHER_ASSET_FULL_NAME }}
mv target/lambda/indexer/bootstrap.zip ${{ env.INDEXER_ASSET_FULL_NAME }}
env:
QW_COMMIT_DATE: ${{ env.QW_COMMIT_DATE }}
QW_COMMIT_HASH: ${{ env.QW_COMMIT_HASH }}
QW_COMMIT_TAGS: ${{ env.QW_COMMIT_TAGS }}
working-directory: ./quickwit
- name: Bundle archives
run: |
zip -FSrj ${{ env.SEARCHER_ASSET_FULL_NAME }} quickwit/target/lambda/searcher/
zip -FSrj ${{ env.INDEXER_ASSET_FULL_NAME }} quickwit/target/lambda/indexer/
- name: Upload searcher archive
uses: quickwit-inc/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ inputs.token }}
with:
file: ${{ env.SEARCHER_ASSET_FULL_NAME }}
overwrite: true
draft: ${{ env.ASSET_VERSION != env.PRERELEASE_VERSION_NAME }}
tag_name: ${{ env.ASSET_VERSION }}
- name: Upload indexer archive

- name: Upload Lambda archives
uses: quickwit-inc/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ inputs.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: ${{ env.INDEXER_ASSET_FULL_NAME }}
file: "${{ env.SEARCHER_ASSET_FULL_NAME }},${{ env.INDEXER_ASSET_FULL_NAME }}"
overwrite: true
draft: ${{ env.ASSET_VERSION != env.PRERELEASE_VERSION_NAME }}
tag_name: ${{ env.ASSET_VERSION }}
5 changes: 2 additions & 3 deletions quickwit/quickwit-lambda/src/indexer/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async fn indexer_handler(event: LambdaEvent<Value>) -> Result<Value, Error> {
))
.await;

let result = match ingest_res {
match ingest_res {
Ok(stats) => {
info!(stats=?stats, "Indexing succeeded");
Ok(serde_json::to_value(stats)?)
Expand All @@ -59,8 +59,7 @@ async fn indexer_handler(event: LambdaEvent<Value>) -> Result<Value, Error> {
error!(err=?e, "Indexing failed");
Err(anyhow::anyhow!("Indexing failed").into())
}
};
result
}
}

pub async fn handler(event: LambdaEvent<Value>) -> Result<Value, Error> {
Expand Down
13 changes: 6 additions & 7 deletions quickwit/quickwit-lambda/src/indexer/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async fn load_index_config(
resolver: &StorageResolver,
default_index_root_uri: &Uri,
) -> anyhow::Result<IndexConfig> {
let (dir, file) = dir_and_filename(&Path::new(&*INDEX_CONFIG_URI))?;
let (dir, file) = dir_and_filename(Path::new(&*INDEX_CONFIG_URI))?;
let index_config_storage = resolver.resolve(&dir).await?;
let bytes = index_config_storage.get_all(file).await?;
let mut index_config = load_index_config_from_user_config(
Expand Down Expand Up @@ -141,15 +141,14 @@ pub async fn ingest(args: IngestArgs) -> anyhow::Result<IndexingStatistics> {
let checklist_result = run_index_checklist(
&mut metastore,
&storage_resolver,
&*INDEX_ID,
&INDEX_ID,
Some(&source_config),
)
.await;
if let Err(e) = checklist_result {
let is_not_found = e.downcast_ref().is_some_and(|meta_error| match meta_error {
MetastoreError::NotFound(_) => true,
_ => false,
});
let is_not_found = e
.downcast_ref()
.is_some_and(|meta_error| matches!(meta_error, MetastoreError::NotFound(_)));
if !is_not_found {
bail!(e);
}
Expand Down Expand Up @@ -177,7 +176,7 @@ pub async fn ingest(args: IngestArgs) -> anyhow::Result<IndexingStatistics> {
"Overwrite enabled, clearing existing index",
);
let mut index_service = IndexService::new(metastore.clone(), storage_resolver.clone());
index_service.clear_index(&*INDEX_ID).await?;
index_service.clear_index(&INDEX_ID).await?;
}
// The indexing service needs to update its cluster chitchat state so that the control plane is
// aware of the running tasks. We thus create a fake cluster to instantiate the indexing service
Expand Down

0 comments on commit 26015e5

Please sign in to comment.