New commit messages

This commit is contained in:
Sahil Ahuja 2025-03-06 22:46:33 +05:30
parent 2c91e942b2
commit 23a90586b2
5 changed files with 32 additions and 24 deletions

View File

@ -21,15 +21,21 @@ jobs:
name: Read the issue comment
run: |
ISSUE_COMMENT_STRING='${{ github.event.comment.body }}'
DOCKER_BASE=`echo $ISSUE_COMMENT_STRING | jq ".image"`
BUILD_ID=`echo $ISSUE_COMMENT_STRING | jq ".tag"`
echo "DOCKER_BASE=$DOCKER_BASE" >> "$GITHUB_OUTPUT";
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
TAG=`echo $ISSUE_COMMENT_STRING | jq ".tag"`
REPO=`echo $ISSUE_COMMENT_STRING | jq ".repo"`
SENDER=`echo $ISSUE_COMMENT_STRING | jq ".sender"`
DOCKER_REPO=${{ vars.docker_repo2_registry }}/$REPO_NAME
echo "TAG=$TAG" >> "$GITHUB_OUTPUT";
echo "REPO=$REPO" >> "$GITHUB_OUTPUT";
echo "SENDER=$SENDER" >> "$GITHUB_OUTPUT";
echo "DOCKER_REPO=$DOCKER_REPO" >> "$GITHUB_OUTPUT";
- name: Print IMAGE and TAG
run: |
echo "BUILD_ID: ${{ steps.read-issue.outputs.BUILD_ID }}";
echo "DOCKER_BASE: ${{ steps.read-issue.outputs.DOCKER_BASE }}";
echo "TAG: ${{ steps.read-issue.outputs.TAG }}";
echo "REPO: ${{ steps.read-issue.outputs.REPO }}";
echo "SENDER: ${{ steps.read-issue.outputs.SENDER }}";
echo "DOCKER_REPO: ${{ steps.read-issue.outputs.DOCKER_REPO }}";
- name: Checkout cs repo
uses: actions/checkout@v4
@ -56,13 +62,19 @@ jobs:
git config --global user.name 'bot-build'
git config --global user.email 'techbots+build@gmetri.com'
BUILD_ID=${{ steps.read-issue.outputs.BUILD_ID }}
DOCKER_BASE=${{ steps.read-issue.outputs.DOCKER_BASE }}
TAG=${{ steps.read-issue.outputs.TAG }}
REPO=${{ steps.read-issue.outputs.REPO }}
SENDER=${{ steps.read-issue.outputs.SENDER }}
DOCKER_REPO=${{ steps.read-issue.outputs.DOCKER_REPO }}
REPOLIST=./.github/repolist.txt
pwd; ls -al;
cd cs;
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_BASE -t $BUILD_ID -r $REPOLIST;
source ../deploy-tools/src/repo_to_cs.sh -m $DOCKER_REPO -t $TAG -r $REPOLIST;
echo "NEW_TAG: $NEW_TAG"
COMMIT_MESSAGE="$NEW_TAG: $REPO to $TAG by $SENDER";
git commit -m "$COMMIT_MESSAGE"
git tag -a $NEW_TAG -m "$COMMIT_MESSAGE"
git push origin main;
git push --tags origin main;

View File

@ -11,7 +11,7 @@ on:
type: string
env:
CS_REPO: ${{ github.repository }}
REPO: ${{ github.repository }}
jobs:
trigger-cs-job:
@ -24,21 +24,17 @@ jobs:
run: |
SHA=${{ github.sha }}; BRANCH_NAME=${{ github.base_ref || github.ref_name }};
BUILD_ID=$BRANCH_NAME-${SHA:0:8};
DOCKER_BASE=${{ vars.docker_repo2_registry }}/$CS_REPO
DOCKER_IMAGE=$DOCKER_BASE:$BUILD_ID;
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
echo "DOCKER_BASE=$DOCKER_BASE" >> "$GITHUB_OUTPUT";
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> "$GITHUB_OUTPUT";
echo "REPO=$REPO >> $GITHUB_OUTPUT"
echo "TAG=$BUILD_ID" >> "$GITHUB_OUTPUT";
- name: Print build id and image name
- name: Print repo and build_id
run: |
echo "BUILD_ID: ${{ steps.get-id.outputs.BUILD_ID }}";
echo "DOCKER_BASE: ${{ steps.get-id.outputs.DOCKER_BASE }}";
echo "DOCKER_IMAGE: ${{ steps.get-id.outputs.DOCKER_IMAGE }}";
echo "REPO: ${{ steps.get-id.outputs.REPO }}";
echo "TAG: ${{ steps.get-id.outputs.TAG }}";
- name: Push image name and tag to cs repo's latest issue with label workflow
run: |
ISSUE_COMMENT_STRING=`echo "{ \"image\": \"${{ steps.get-id.outputs.DOCKER_BASE }}\", \"tag\": \"${{ steps.get-id.outputs.BUILD_ID }}\" }" | jq tostring`
ISSUE_COMMENT_STRING=`echo "{ \"repo\": \"${{ steps.get-id.outputs.REPO }}"\, \"tag\": \"${{ steps.get-id.outputs.TAG }}\", \"sender\": \"${{ github.event.sender.login }}\" }" | jq tostring`
echo ISSUE_COMMENT_STRING: $ISSUE_COMMENT_STRING
API_JSON_BODY=`echo '{"body": '$ISSUE_COMMENT_STRING' }' | jq -r tostring`

View File

@ -77,4 +77,6 @@ jobs:
cd nm;
CS_LIST=./.github/cslist.txt;
../deploy-tools/src/cs_to_nm.sh -c ${{ env.CS_REPO }} -v $VERSION -k $CS_LIST;
git commit -m "$CS_REPO_NAME to $VERSION by ${{ github.event.sender.login }}"
git push origin main;

View File

@ -34,8 +34,6 @@ main()
sed -i -e "s/${SEARCH_STRING}.*/${SEARCH_STRING}${VERSION}/" $KUST_PATH
git add $KUST_PATH
done <<< "$CSLIST"
git commit -m "$CS_REPO_NAME updated to $VERSION"
}
### Starts here

View File

@ -41,8 +41,8 @@ main()
source $SCRIPT_DIR/repo_to_cs_basetag.sh;
# cat $NEW_TAG > version; #To always allow a commit
# git add version;
git commit -m "$NEW_TAG: $IMAGE updated to $IMAGE_TAG";
git tag -a $NEW_TAG -m "$NEW_TAG: $IMAGE updated to $IMAGE_TAG"
# git commit -m "$NEW_TAG: $IMAGE updated to $IMAGE_TAG";
# git tag -a $NEW_TAG -m "$NEW_TAG: $IMAGE updated to $IMAGE_TAG"
}
### Starts here