Skip to content

Commit

Permalink
Fixing M2K Kfunc
Browse files Browse the repository at this point in the history
Signed-off-by: gabriel-farache <[email protected]>
  • Loading branch information
gabriel-farache committed Oct 11, 2024
1 parent 48759c9 commit 15e68ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/m2k-func.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,14 @@ jobs:
PR_OR_COMMIT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
fi
git config --global user.email "${{ github.event.head_commit.author.email || '[email protected]' }}"
git config --global user.name ${{ github.event.head_commit.author.name || github.triggering_actor }}
gh repo clone $WF_CONFIG_REPO config-repo
cd config-repo
git switch -c m2k-kfunc-autopr-$RANDOM
./hack/bump_chart_version.sh move2kube --bump-tag-version
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} \
config-repo/charts/move2kube/values.yaml \
"yq --inplace '.kfunction.image=\"quay.io/orchestrator/serverless-workflow-m2k-kfunc:'\"${GITHUB_SHA}\"'\"' charts/move2kube/values.yaml" \
scripts/create_automated_m2k_kfunc_pr.sh \
${{ github.event.head_commit.author.email || '[email protected]' }} \
${{ github.event.head_commit.author.name || github.triggering_actor }} \
$WORKDIR \
${{ env.GH_TOKEN }} \
$WF_CONFIG_REPO
$WF_CONFIG_REPO \
${{ github.sha }}
6 changes: 6 additions & 0 deletions scripts/create_automated_m2k_kfunc_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ WORKFLOW_ID=$4
PR_OR_COMMIT_URL=$5
GH_TOKEN=$6
WF_CONFIG_REPO=$7
GITHUB_SHA=$8

TIMESTAMP=$(date +%s)
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-"${TIMESTAMP}"

./hack/bump_chart_version.sh "${WORKFLOW_ID}" --bump-tag-version
mkdir -p charts/"${WORKFLOW_ID}"/templates
cp "${WORKDIR}"/"${WORKFLOW_ID}"/manifests/* charts/"${WORKFLOW_ID}"/templates
yq --inplace '.kfunction.image="quay.io/orchestrator/serverless-workflow-m2k-kfunc:'"${GITHUB_SHA}"'"' charts/move2kube/values.yaml
git add -A

git commit -m "(m2k-kfunc) Automated PR"
Expand Down
6 changes: 4 additions & 2 deletions scripts/create_or_update_automated_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ USER_NAME=$7
WORKDIR=$8
GH_TOKEN=$9
WF_CONFIG_REPO=${10}
GITHUB_SHA=${11}

# Get all open PRs for the repository
prs=$(gh pr list --repo "${REPO}" --json number --jq '.[].number')
Expand Down Expand Up @@ -50,7 +51,7 @@ for pr in $prs; do
# Create the new file
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
eval "${INPUT_VALUES_FILEPATH}" || exit 1
fi
git add -A

Expand All @@ -72,4 +73,5 @@ sh "${CREATE_PR_SCRIPT}" "${USER_EMAIL}" \
"${WORKFLOW_ID}" \
"${PR_OR_COMMIT_URL}" \
"${GH_TOKEN}" \
"${WF_CONFIG_REPO}"
"${WF_CONFIG_REPO}" \
"${GITHUB_SHA}"

0 comments on commit 15e68ae

Please sign in to comment.