-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update Dockerfile to use LANGCHAIN_VERSION argument Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com> * Revert "Update Dockerfile to use LANGCHAIN_VERSION argument" This reverts commit 1bff239. * chore: Add manual freeze images workflow Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * split jobs Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com> --------- Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
040d2b7
commit c9f9aca
Showing
3 changed files
with
123 additions
and
0 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,38 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Freeze-images | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
freeze-images: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name "NeuralChatBot" | ||
git config --global user.email "grp_neural_chat_bot@intel.com" | ||
git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git | ||
- name: Run script | ||
run: | | ||
bash .github/workflows/scripts/freeze_images.sh | ||
- name: Commit changes | ||
run: | | ||
git add . | ||
git commit -s -m "Freeze images tag" | ||
git push |
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,44 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Freeze-tag | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
default: "latest" | ||
description: "Tag to apply to images" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
freeze-tag: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.ref }} | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name "NeuralChatBot" | ||
git config --global user.email "grp_neural_chat_bot@intel.com" | ||
git remote set-url origin https://NeuralChatBot:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIExamples.git | ||
- name: Run script | ||
run: | | ||
find . -name "*.md" | xargs sed -i "s|^docker\ compose|TAG=${{ github.event.inputs.tag }}\ docker\ compose|g" | ||
- name: Commit changes | ||
run: | | ||
git add . | ||
git commit -s -m "Freeze images tag" | ||
git push |
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,41 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
function get_latest_version() { | ||
repo_image=$1 | ||
versions=$(curl -s "https://registry.hub.docker.com/v2/repositories/$repo_image/tags/" | jq '."results"[]["name"]' | tr -d '"') | ||
echo "version list: $versions" | ||
latest_version=$(printf "%s\n" "${versions[@]}" | grep -v "latest" | sort -V | tail -n 1) | ||
echo "latest version: $latest_version" | ||
replace_image_version $repo_image $latest_version | ||
} | ||
|
||
function replace_image_version() { | ||
repo_image=$1 | ||
version=$2 | ||
find . -name "Dockerfile" | xargs sed -i "s|$repo_image:latest|$repo_image:$version|g" | ||
} | ||
|
||
function check_branch_name() { | ||
if [[ "$GITHUB_REF_NAME" == "main" ]]; then | ||
echo "$GITHUB_REF_NAME is protected branch" | ||
exit 0 | ||
else | ||
echo "branch name is $GITHUB_REF_NAME" | ||
fi | ||
} | ||
|
||
function main() { | ||
check_branch_name | ||
repo_image_list="langchain/langchain" | ||
for repo_image in $repo_image_list; do | ||
echo "::group::check $repo_image" | ||
get_latest_version $repo_image | ||
echo "::endgroup::" | ||
done | ||
freeze_tag_in_markdown | ||
} | ||
|
||
main |