From 48759c9fb57d9d64f33f9123018970a421c47c14 Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Fri, 11 Oct 2024 11:16:10 +0200 Subject: [PATCH] Fix templates files copied in CI script Signed-off-by: gabriel-farache --- .github/workflows/m2k-func.yaml | 10 ++-------- scripts/create_automated_m2k_kfunc_pr.sh | 7 ------- scripts/create_or_update_automated_pr.sh | 4 ++-- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/m2k-func.yaml b/.github/workflows/m2k-func.yaml index 8946784c..5f4c8d76 100644 --- a/.github/workflows/m2k-func.yaml +++ b/.github/workflows/m2k-func.yaml @@ -7,13 +7,6 @@ on: required: false type: boolean default: false - workflow_dispatch: - push: - branches: [ "main" ] - paths: - - 'move2kube/m2k-func/**' - - 'pipeline/**' - - .github/workflows/m2k-func.yaml env: WORKDIR: move2kube/m2k-func @@ -85,6 +78,7 @@ jobs: - name: Send PRs to config repo if: ${{ ! inputs.it_mode }} run: | + WORKDIR=${{ runner.temp }}/serverless-workflows # determine pr or commit url if [ ${{ fromJSON(steps.get_pr_data.outputs.result)}} != "" ]; then PR_OR_COMMIT_URL="${{ fromJSON(steps.get_pr_data.outputs.result).html_url }}" @@ -102,7 +96,7 @@ jobs: yq --inplace '.kfunction.image="quay.io/orchestrator/serverless-workflow-m2k-kfunc:${{ github.sha }}"' charts/move2kube/values.yaml cd .. - + echo "Running create_or_update_automated_pr script" sh scripts/create_or_update_automated_pr.sh $WF_CONFIG_REPO \ ${{ inputs.workflow_id }} \ ${PR_OR_COMMIT_URL} \ diff --git a/scripts/create_automated_m2k_kfunc_pr.sh b/scripts/create_automated_m2k_kfunc_pr.sh index 3f742e64..784cf3fe 100644 --- a/scripts/create_automated_m2k_kfunc_pr.sh +++ b/scripts/create_automated_m2k_kfunc_pr.sh @@ -6,17 +6,10 @@ WORKFLOW_ID=$4 PR_OR_COMMIT_URL=$5 GH_TOKEN=$6 WF_CONFIG_REPO=$7 -INPUT_VALUES_FILEPATH=$8 git config --global user.email "${USER_EMAIL}" git config --global user.name "${USER_NAME}" -gh repo clone "${WF_CONFIG_REPO}" config-repo cd config-repo || exit -git switch -c "${WORKFLOW_ID}"-autopr-"${RANDOM}" - -./../hack/bump_chart_version.sh "${WORKFLOW_ID}" --bump-tag-version - -cp "${INPUT_VALUES_FILEPATH}" charts/move2kube/values.yaml mkdir -p charts/"${WORKFLOW_ID}"/templates cp "${WORKDIR}"/"${WORKFLOW_ID}"/manifests/* charts/"${WORKFLOW_ID}"/templates diff --git a/scripts/create_or_update_automated_pr.sh b/scripts/create_or_update_automated_pr.sh index fd4d6407..1352f530 100644 --- a/scripts/create_or_update_automated_pr.sh +++ b/scripts/create_or_update_automated_pr.sh @@ -48,7 +48,7 @@ for pr in $prs; do git checkout "$pr_branch" # Create the new file - cp -r "${WORKDIR}/${WORKFLOW_ID}/manifests/" "charts/${WORKFLOW_ID}/templates/" || exit 1 + cp "${WORKDIR}"/"${WORKFLOW_ID}"/manifests/* charts/"${WORKFLOW_ID}"/templates || exit 1 if [ "${INPUT_VALUES_FILEPATH}" != "" ]; then cp "${INPUT_VALUES_FILEPATH}" "charts/${WORKFLOW_ID}/values.yaml" || exit 1 fi @@ -72,4 +72,4 @@ sh "${CREATE_PR_SCRIPT}" "${USER_EMAIL}" \ "${WORKFLOW_ID}" \ "${PR_OR_COMMIT_URL}" \ "${GH_TOKEN}" \ - "${WF_CONFIG_REPO}" + "${WF_CONFIG_REPO}"