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 name: Read the issue comment
run: | run: |
ISSUE_COMMENT_STRING='${{ github.event.comment.body }}' ISSUE_COMMENT_STRING='${{ github.event.comment.body }}'
DOCKER_BASE=`echo $ISSUE_COMMENT_STRING | jq ".image"` TAG=`echo $ISSUE_COMMENT_STRING | jq ".tag"`
BUILD_ID=`echo $ISSUE_COMMENT_STRING | jq ".tag"` REPO=`echo $ISSUE_COMMENT_STRING | jq ".repo"`
echo "DOCKER_BASE=$DOCKER_BASE" >> "$GITHUB_OUTPUT"; SENDER=`echo $ISSUE_COMMENT_STRING | jq ".sender"`
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT"; 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 - name: Print IMAGE and TAG
run: | run: |
echo "BUILD_ID: ${{ steps.read-issue.outputs.BUILD_ID }}"; echo "TAG: ${{ steps.read-issue.outputs.TAG }}";
echo "DOCKER_BASE: ${{ steps.read-issue.outputs.DOCKER_BASE }}"; 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 - name: Checkout cs repo
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -56,13 +62,19 @@ jobs:
git config --global user.name 'bot-build' git config --global user.name 'bot-build'
git config --global user.email 'techbots+build@gmetri.com' git config --global user.email 'techbots+build@gmetri.com'
BUILD_ID=${{ steps.read-issue.outputs.BUILD_ID }} TAG=${{ steps.read-issue.outputs.TAG }}
DOCKER_BASE=${{ steps.read-issue.outputs.DOCKER_BASE }} REPO=${{ steps.read-issue.outputs.REPO }}
SENDER=${{ steps.read-issue.outputs.SENDER }}
DOCKER_REPO=${{ steps.read-issue.outputs.DOCKER_REPO }}
REPOLIST=./.github/repolist.txt REPOLIST=./.github/repolist.txt
pwd; ls -al; pwd; ls -al;
cd cs; 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 origin main;
git push --tags origin main; git push --tags origin main;

View File

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

View File

@ -77,4 +77,6 @@ jobs:
cd nm; cd nm;
CS_LIST=./.github/cslist.txt; CS_LIST=./.github/cslist.txt;
../deploy-tools/src/cs_to_nm.sh -c ${{ env.CS_REPO }} -v $VERSION -k $CS_LIST; ../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; git push origin main;

View File

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

View File

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