From abed4599bb2994d7e686411ff87ad4a4fb421e59 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 11 Oct 2023 19:59:07 -0400 Subject: [PATCH 1/2] Onboard get-ci-image-tag in preparation for other repos Signed-off-by: Peter Zhu --- .github/workflows/get-ci-image-tag.yml | 44 ++++++++++++++++++++++++++ .github/workflows/python-tests.yml | 16 ++++++++-- 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/get-ci-image-tag.yml diff --git a/.github/workflows/get-ci-image-tag.yml b/.github/workflows/get-ci-image-tag.yml new file mode 100644 index 0000000000..0cc6a37367 --- /dev/null +++ b/.github/workflows/get-ci-image-tag.yml @@ -0,0 +1,44 @@ +name: Get CI Image Tag +on: + workflow_call: + inputs: + platform: + required: true + type: string + usage: + required: true + type: string + build_ref: + required: false + type: string + default: 'main' + outputs: + ci-image-version-linux: + description: The ci image version for linux build + value: ${{ jobs.Get-CI-Image-Tag.outputs.output-ci-image-version-linux }} + +jobs: + Get-CI-Image-Tag: + runs-on: ubuntu-latest + outputs: + output-ci-image-version-linux: ${{ steps.step-ci-image-version-linux.outputs.ci-image-version-linux }} + steps: + - name: Install crane + uses: iarekylew00t/crane-installer@v1 + with: + crane-release: v0.15.2 + - name: Checkout opensearch-build repository + uses: actions/checkout@v2 + with: + repository: 'opensearch-project/opensearch-build' + ref: ${{ inputs.build_ref }} + path: 'opensearch-build' + - name: Get ci image version from opensearch-build repository scripts + id: step-ci-image-version-linux + run: | + crane version + CI_IMAGE_VERSION=`opensearch-build/docker/ci/get-ci-images.sh -p ${{ inputs.platform }} -u ${{ inputs.usage }} -t build | head -1` + echo $CI_IMAGE_VERSION + echo "ci-image-version-linux=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT + + diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 7660f6ec45..c593f57c28 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -4,11 +4,16 @@ name: python-tests on: [push, pull_request] jobs: + Get-CI-Image-Tag: + uses: ./.github/workflows/get-ci-image-tag.yml + with: + platform: centos7 + usage: opensearch + python-tests: strategy: matrix: os: - - ubuntu-latest - macos-latest - windows-latest runs-on: ${{ matrix.os }} @@ -41,11 +46,16 @@ jobs: with: files: ./coverage.xml - python-tests-build-image: + python-tests-linux: + needs: Get-CI-Image-Tag runs-on: ubuntu-latest container: - image: public.ecr.aws/opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v3 + # using the same image which is used by opensearch-build team to build the OpenSearch Distribution + # this image tag is subject to change as more dependencies and updates will arrive over time + image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} + # need to switch to root so that github actions can install runner binary on container without permission issues. options: --user root + steps: - uses: actions/checkout@v3 - name: Install Pipenv and Dependencies From df8509bbb50b391adba3d64520ea78055e3fad91 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 11 Oct 2023 20:04:49 -0400 Subject: [PATCH 2/2] Improve yamllint Signed-off-by: Peter Zhu --- .github/workflows/get-ci-image-tag.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/get-ci-image-tag.yml b/.github/workflows/get-ci-image-tag.yml index 0cc6a37367..4868a5fcca 100644 --- a/.github/workflows/get-ci-image-tag.yml +++ b/.github/workflows/get-ci-image-tag.yml @@ -1,3 +1,4 @@ +--- name: Get CI Image Tag on: workflow_call: @@ -30,9 +31,9 @@ jobs: - name: Checkout opensearch-build repository uses: actions/checkout@v2 with: - repository: 'opensearch-project/opensearch-build' - ref: ${{ inputs.build_ref }} - path: 'opensearch-build' + repository: 'opensearch-project/opensearch-build' + ref: ${{ inputs.build_ref }} + path: 'opensearch-build' - name: Get ci image version from opensearch-build repository scripts id: step-ci-image-version-linux run: | @@ -40,5 +41,3 @@ jobs: CI_IMAGE_VERSION=`opensearch-build/docker/ci/get-ci-images.sh -p ${{ inputs.platform }} -u ${{ inputs.usage }} -t build | head -1` echo $CI_IMAGE_VERSION echo "ci-image-version-linux=$CI_IMAGE_VERSION" >> $GITHUB_OUTPUT - -