build: git config before commit

currently git commit of the helm charts to
csi-chart repo is failing with below error
```
Author identity unknown

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.
```
this commit add git config for bot user.

Note:- used ceph.io in github secrets for the bot user
email and its not a valid email id and am also
looking for suggestion if anyone as.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-06-10 16:19:54 +05:30 committed by Niels de Vos
parent 2eebf6b6e0
commit 924a5ab949
2 changed files with 11 additions and 2 deletions

View File

@ -27,9 +27,14 @@ jobs:
if: github.ref == 'refs/heads/devel' if: github.ref == 'refs/heads/devel'
run: echo "BRANCH_NAME=devel" >> $GITHUB_ENV run: echo "BRANCH_NAME=devel" >> $GITHUB_ENV
- name: Set build environment variables
run: |
echo "GITHUB_USER=${{ secrets.CEPH_CSI_BOT_NAME }}" >> $GITHUB_ENV
echo "GITHUB_EMAIL=${{ secrets.CEPH_CSI_BOT_EMAIL }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.CEPH_CSI_BOT_TOKEN }}" >> $GITHUB_ENV
- name: publish artifacts - name: publish artifacts
# podman cannot pull images with both tag and digest # podman cannot pull images with both tag and digest
# https://github.com/containers/buildah/issues/1407 # https://github.com/containers/buildah/issues/1407
# use docker to build images # use docker to build images
# yamllint disable-line rule:line-length run: CONTAINER_CMD=docker ./deploy.sh
run: GITHUB_TOKEN=${{ secrets.CEPH_CSI_BOT_TOKEN }} CONTAINER_CMD=docker ./deploy.sh

View File

@ -9,6 +9,8 @@ source "$(dirname "${0}")/build.env"
BRANCH_NAME=${BRANCH_NAME:-""} BRANCH_NAME=${BRANCH_NAME:-""}
GITHUB_TOKEN=${GITHUB_TOKEN:-""} GITHUB_TOKEN=${GITHUB_TOKEN:-""}
GITHUB_USER=${GITHUB_USER:-"autobuild-bot"}
GITHUB_EMAIL=${GITHUB_EMAIL:-"ceph-csi-bot@users.noreply.github.com"}
# Build and push images. Steps as below: # Build and push images. Steps as below:
# 1. get base image from ./build.env (BASE_IMAGE=ceph/ceph:v14.2) # 1. get base image from ./build.env (BASE_IMAGE=ceph/ceph:v14.2)
@ -82,6 +84,8 @@ push_helm_charts() {
pushd "${CHARTDIR}/csi-charts/docs" >/dev/null pushd "${CHARTDIR}/csi-charts/docs" >/dev/null
helm repo index . helm repo index .
git config user.name "${GITHUB_USER}"
git config user.email "${GITHUB_EMAIL}"
git add --all :/ && git commit -m "Update for helm charts ${PACKAGE}-${VERSION}" git add --all :/ && git commit -m "Update for helm charts ${PACKAGE}-${VERSION}"
git push https://"${GITHUB_TOKEN}"@github.com/ceph/csi-charts git push https://"${GITHUB_TOKEN}"@github.com/ceph/csi-charts
popd >/dev/null popd >/dev/null