-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
image scan and publish cd enhance (#604)
Signed-off-by: chensuyue <suyue.chen@intel.com>
- Loading branch information
Showing
3 changed files
with
157 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Get Image List | ||
permissions: read-all | ||
on: | ||
workflow_call: | ||
inputs: | ||
services: | ||
default: "" | ||
required: false | ||
type: string | ||
images: | ||
default: "" | ||
required: false | ||
type: string | ||
mode: | ||
default: "CD" | ||
required: false | ||
type: string | ||
outputs: | ||
matrix: | ||
description: "Image List" | ||
value: ${{ jobs.get-image-list.outputs.matrix }} | ||
|
||
jobs: | ||
get-image-list: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.get-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout out Repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set Matrix | ||
id: get-matrix | ||
run: | | ||
image_list=[] | ||
if [[ ! -z "${{ inputs.services }}" ]]; then | ||
pip install yq | ||
services=($(echo ${{ inputs.services }} | tr ',' ' ')) | ||
for service in ${services[@]} | ||
do | ||
if [[ "${{ inputs.mode }}" == "CD" ]]; then | ||
docker_compose_yml=${{ github.workspace }}/.github/workflows/docker/compose/${service}-compose-cd.yaml | ||
else | ||
docker_compose_yml=${{ github.workspace }}/.github/workflows/docker/compose/${service}-compose.yaml | ||
fi | ||
if [ -f "$docker_compose_yml" ]; then | ||
images=$(cat $docker_compose_yml | yq -r '.[]' | jq 'keys' | jq -c '.') | ||
image_list=$(echo ${image_list} | jq -s '.[0] + .[1] | unique' - <(echo ${images})) | ||
fi | ||
done | ||
fi | ||
if [[ ! -z "${{ inputs.images }}" ]]; then | ||
images=($(echo ${{ inputs.images }} | tr ',' ' ')) | ||
input_image_list=$(printf '%s\n' "${images[@]}" | sort -u | jq -R '.' | jq -sc '.') | ||
image_list=$(echo ${image_list} | jq -s '.[0] + .[1] | unique' - <(echo ${input_image_list})) | ||
fi | ||
echo "print image list..." | ||
echo "$image_list" | jq . | jq -r '.[]' | ||
echo "end of image list..." | ||
echo "matrix=$(echo ${image_list} | jq -c '.')" >> $GITHUB_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Services publish docker image on manual event | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
services: | ||
default: "asr" | ||
description: "List of services to test [agent_langchain,asr,chathistory_mongo,dataprep_milvus,embeddings,guardrails,knowledgegraphs,llms,lvms,prompt_registry,ragas,reranks,retrievers,tts,vectorstores,web_retrievers]" | ||
required: false | ||
type: string | ||
images: | ||
default: "" | ||
description: "List of images to scan [dataprep-pgvector,dataprep-pinecone...]" | ||
required: false | ||
type: string | ||
tag: | ||
default: "v0.9" | ||
description: "Tag to publish" | ||
required: true | ||
type: string | ||
publish_tags: | ||
default: "latest,v0.9" | ||
description: "Tag list apply to publish images" | ||
required: false | ||
type: string | ||
|
||
permissions: read-all | ||
jobs: | ||
get-image-list: | ||
uses: ./.github/workflows/_get-image-list.yml | ||
with: | ||
services: ${{ inputs.services }} | ||
images: ${{ inputs.images }} | ||
mode: ${{ inputs.mode }} | ||
|
||
publish: | ||
needs: [get-image-list] | ||
strategy: | ||
matrix: | ||
image: ${{ fromJSON(needs.get-image-list.outputs.matrix) }} | ||
runs-on: "docker-build-gaudi" | ||
steps: | ||
- uses: docker/login-action@v3.2.0 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Image Publish | ||
uses: opea-project/validation/actions/image-publish@main | ||
with: | ||
local_image_ref: ${OPEA_IMAGE_REPO}opea/${{ matrix.image }}:${{ inputs.tag }} | ||
image_name: opea/${{ matrix.image }} | ||
publish_tags: ${{ inputs.publish_tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters