Featuer/gitops extra command (#47)
CI Main / Config load (push) Successful in 1m48s
CI Main / Latest versio (push) Successful in 1m38s
unit-tests Bats test report
CI Main / Bats tests (push) Successful in 2m15s
acc-tests Cucumber test report
CI Main / Cucumber tests (push) Successful in 2m46s
ci-docker-build-push Docker push 0.2.35
CI Main / Build & Push Docker (push) Successful in 40s
gitops/gitea-ci-library GitOps: 0.2.35
CI Main / GitOps (push) Successful in 1m34s
CI Main / Report Summary (push) Successful in 3s
CI Main / Move provider version tag (push) Successful in 11s
CI Main / Config load (push) Successful in 1m48s
CI Main / Latest versio (push) Successful in 1m38s
unit-tests Bats test report
CI Main / Bats tests (push) Successful in 2m15s
acc-tests Cucumber test report
CI Main / Cucumber tests (push) Successful in 2m46s
ci-docker-build-push Docker push 0.2.35
CI Main / Build & Push Docker (push) Successful in 40s
gitops/gitea-ci-library GitOps: 0.2.35
CI Main / GitOps (push) Successful in 1m34s
CI Main / Report Summary (push) Successful in 3s
CI Main / Move provider version tag (push) Successful in 11s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #47
This commit was merged in pull request #47.
This commit is contained in:
@@ -22,7 +22,10 @@ INPUTS=$(jq -nc \
|
||||
--arg source_repo "$GITOPS_SOURCE_REPO" \
|
||||
--arg source_commit "$GITOPS_SOURCE_COMMIT" \
|
||||
--arg git_tag_prefix "${GITOPS_TAG_PREFIX:-}" \
|
||||
'{file: $file, yq_tpl: $yq_tpl, version: $version, source_repo: $source_repo, source_commit: $source_commit, git_tag_prefix: $git_tag_prefix}')
|
||||
--arg extra_cmd "${GITOPS_EXTRA_CMD:-}" \
|
||||
--arg author_name "${GIT_USER_NAME:-}" \
|
||||
--arg author_email "${GIT_USER_EMAIL:-}" \
|
||||
'{file: $file, yq_tpl: $yq_tpl, version: $version, source_repo: $source_repo, source_commit: $source_commit, git_tag_prefix: $git_tag_prefix, extra_cmd: $extra_cmd, author_name: $author_name, author_email: $author_email}')
|
||||
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
echo "gitops-dispatch: dispatching to $GITOPS_REPO/$GITOPS_WORKFLOW..."
|
||||
|
||||
@@ -84,7 +84,12 @@ _gitops_update() {
|
||||
|
||||
cd "${CLONE_DIR}" || _gitops_fail "Failed to enter clone directory"
|
||||
yq eval -i "${YQ_EXPR}" "${INPUT_FILE}" || _gitops_fail "Failed to update ${INPUT_FILE}"
|
||||
git add "${INPUT_FILE}" || _gitops_fail "Failed to stage ${INPUT_FILE}"
|
||||
if [ -n "${GITOPS_EXTRA_CMD:-}" ]; then
|
||||
eval "${GITOPS_EXTRA_CMD}" || _gitops_fail "Extra command failed: ${GITOPS_EXTRA_CMD}"
|
||||
git add -A || _gitops_fail "Failed to stage all changes"
|
||||
else
|
||||
git add "${INPUT_FILE}" || _gitops_fail "Failed to stage ${INPUT_FILE}"
|
||||
fi
|
||||
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes — ${INPUT_FILE} already at ${VERSION}"
|
||||
@@ -93,8 +98,8 @@ _gitops_update() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git -c user.name="gitea-ci-bot" \
|
||||
-c user.email="ci@keskikuja.site" \
|
||||
git -c user.name="${GIT_USER_NAME:-gitea-ci-bot}" \
|
||||
-c user.email="${GIT_USER_EMAIL:-ci@keskikuja.site}" \
|
||||
commit -m "[skip ci] gitops: update version to ${VERSION}" || _gitops_fail "Failed to commit"
|
||||
GITOPS_SHA="$(git rev-parse HEAD)"
|
||||
git push || _gitops_fail "Failed to push"
|
||||
|
||||
Reference in New Issue
Block a user