diff --git a/.github/workflows/manual-freeze-tag.yaml b/.github/workflows/manual-freeze-tag.yaml index 2f2c23fc1..6ed69c853 100644 --- a/.github/workflows/manual-freeze-tag.yaml +++ b/.github/workflows/manual-freeze-tag.yaml @@ -7,20 +7,22 @@ on: workflow_dispatch: inputs: oldversion: - default: "0.9.0" + default: "1.1-dev" description: "Old helm version to be replaced" required: true type: string newversion: - default: "1.0.0" + default: "1.1.0" description: "New helm version to replace" required: true type: string imageversion: - default: "v1.0" + default: "1.1" description: "New image version to replace" required: true type: string + branches-ignore: + - main jobs: freeze-tag: @@ -43,9 +45,9 @@ jobs: env: NEWTAG: ${{ inputs.imageversion }} run: | - find helm-charts/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${imageversion}\"#g" {} \; + find helm-charts/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${{ inputs.imageversion }}\"#g" {} \; find helm-charts/ -name 'Chart.yaml' -type f -exec sed -i "s#version: ${{ inputs.oldversion }}#version: ${{ inputs.newversion }}#g" {} \; - find microservices-connector/helm/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${imageversion}\"#g" {} \; + find microservices-connector/helm/ -name '*values.yaml' -type f -exec sed -i "s#tag: \"latest\"#tag: \"${{ inputs.imageversion }}\"#g" {} \; find microservices-connector/helm/ -name 'Chart.yaml' -type f -exec sed -i "s#version: ${{ inputs.oldversion }}#version: ${{ inputs.newversion }}#g" {} \; sed -i "s|opea/gmcrouter:latest|opea/gmcrouter:$NEWTAG|g" microservices-connector/config/gmcrouter/gmc-router.yaml sed -i "s|opea/gmcmanager:latest|opea/gmcmanager:$NEWTAG|g" microservices-connector/config/manager/gmc-manager.yaml @@ -54,5 +56,5 @@ jobs: - name: Commit changes run: | git add . - git commit -s -m "Freeze Helm charts versions" + git commit -s -m "Freeze Helm charts versions for release ${{ inputs.imageversion }}" git push diff --git a/.github/workflows/manual-helm-cd-workflow.yaml b/.github/workflows/manual-helm-cd-workflow.yaml index dcd1a3820..f428ac8c3 100644 --- a/.github/workflows/manual-helm-cd-workflow.yaml +++ b/.github/workflows/manual-helm-cd-workflow.yaml @@ -42,32 +42,32 @@ jobs: set -x run_matrix="{\"include\":[" if [[ -z "${{ inputs.workloads }}" ]]; then - find "$CHARTS_DIR" -mindepth 1 -maxdepth 1 -type d ! -name "common" -exec basename {} \; | while read -r subfolder; do - for file in "$CHARTS_DIR/$subfolder"/*values.yaml; do + for chart in ${CHARTS_DIR}/*; do + if [[ "$chart" == *"common" ]] || [[ -f $chart ]]; then + continue + fi + for file in "$chart"/ci-*values.yaml; do if [ -f "$file" ]; then - if [[ "$file" == *"nv-values.yaml" ]] || [[ "$file" == *"hpa-values.yaml" ]]; then - continue - fi filename=$(basename "$file" .yaml) if [[ "$filename" == *"gaudi"* ]]; then - run_matrix="${run_matrix}{\"example\":\"${subfolder}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"}," + run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"}," else - run_matrix="${run_matrix}{\"example\":\"${subfolder}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"}," + run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"}," fi fi done done - find "$CHARTS_DIR/common" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | while read -r subfolder; do - for file in "$CHARTS_DIR/common/$subfolder"/*values.yaml; do + for chart in ${CHARTS_DIR}/common/*; do + if [[ -f $chart ]]; then + continue + fi + for file in "$chart"/ci-*values.yaml; do if [ -f "$file" ]; then - if [[ "$file" == *"nv-values.yaml" ]] || [[ "$file" == *"hpa-values.yaml" ]]; then - continue - fi filename=$(basename "$file" .yaml) if [[ "$filename" == *"gaudi"* ]]; then - run_matrix="${run_matrix}{\"example\":\"common/${subfolder}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"}," + run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\",\"directory\":\"common\"}," else - run_matrix="${run_matrix}{\"example\":\"common/${subfolder}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\"}," + run_matrix="${run_matrix}{\"example\":\"$(basename "${chart}\",\"hardware\":\"xeon\", \"valuefile\":\"${filename}\",\"directory\":\"common\"}," fi fi done @@ -75,11 +75,8 @@ jobs: else service_list=($(echo ${{ github.event.inputs.workloads }} | tr ',' ' ')) for service in $service_list; do - for file in "$CHARTS_DIR/$service"/*values.yaml; do + for file in "$CHARTS_DIR/$service"/ci-*values.yaml; do if [ -f "$file" ]; then - if [ "$file" == *"nv-values.yaml" ] || [ "$file" == *"hpa-values.yaml" ]; then - continue - fi filename=$(basename "$file" .yaml) if [[ "$filename" == *"gaudi"* ]]; then run_matrix="${run_matrix}{\"example\":\"$service\",\"hardware\":\"gaudi\", \"valuefile\":\"${filename}\"}," diff --git a/.github/workflows/manual-release-charts.yaml b/.github/workflows/manual-release-charts.yaml new file mode 100644 index 000000000..5f8435847 --- /dev/null +++ b/.github/workflows/manual-release-charts.yaml @@ -0,0 +1,90 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Manual event to release helm chart to public site on release branch + +on: + workflow_dispatch: + inputs: + version: + default: "1.1.0" + description: "Release Version" + required: true + type: string + # artifacthub: + # default: false + # description: "Release to ArtifactHub repo" + # required: true + # type: bool + ghcr: + default: true + description: "Release to ghcr" + required: true + type: bool + +jobs: + release-charts: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + + - name: Prepare helm packages + env: + SRC_DIR: helm-charts + DEST_DIR: charts + run: | + if grep -r '^version: ' `find helm-charts/ -name "Chart.yaml"` | grep -v "${{ inputs.version }}"; then + echo "Version check failed" + exit 1 + fi + mkdir -p ${DEST_DIR} + # git clone --branch charts-release https://github.com/opea-project/GenAIInfra.git charts + # update components + for chart in ${SRC_DIR}/common/* + do + echo "Packaging chart $chart..." + helm dependency update ${chart} + helm package $chart --destination ${DEST_DIR} + done + # update E2E Applications + for chart in ${SRC_DIR}/* + do + if [ -f $chart ]; then continue; fi + if [[ $chart =~ "common" ]]; then continue; fi + echo "Packaging chart $chart..." + helm dependency update ${chart} + helm package $chart --destination ${DEST_DIR} + done + + - name: Publish helm charts + run: | + set -x + cd charts + # if [ "${{ inputs.artifacthub }}" = "true" ]; then + # echo "Push ${{ inputs.version }} charts to charts-release branch" + # helm repo index . + # # Insert copyright to avoid warnings + # sed -i '1s/^/# Copyright (C) 2024 Intel Corporation\n# SPDX-License-Identifier: Apache-2.0\n\n/' index.yaml + + # 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/GenAIInfra.git + + # git status + # git add . + # git commit -s -m "Add release ${{ inputs.version }} helm charts" + # git push + # fi + if [ "${{ inputs.ghcr }}" = "true" ]; then + echo "Publish charts version ${{ inputs.version }}to ghcr" + echo "${{ secrets.ACTION_TOKEN }}" | helm registry login ghcr.io -u test --password-stdin + for chart in *-${{ inputs.version }}.tgz; do + echo "Publishing ${chart}\n" + helm push ${chart} oci://ghcr.io/opea-project/charts + done + fi