Compare commits
No commits in common. "main" and "v1.1.15" have entirely different histories.
78
.github/unused/sh/trigger.sh
vendored
78
.github/unused/sh/trigger.sh
vendored
@ -1,78 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
curl -L \
|
|
||||||
-X POST \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-H "Authorization: Bearer <YOUR-TOKEN>"\
|
|
||||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
|
||||||
https://api.github.com/repos/OWNER/REPO/actions/workflows/WORKFLOW_ID/dispatches \
|
|
||||||
-d '{"ref":"main","inputs":{"image":"${{ inputs.image }}","tag":"${{ inputs.tag }}"}}';
|
|
||||||
|
|
||||||
repo2.hub.gmetri.io/dt-api
|
|
||||||
main-fda468af
|
|
||||||
|
|
||||||
Token (DUMMY): e139b1c73bfae1b7748961c9f9a381bd3cca0633
|
|
||||||
|
|
||||||
|
|
||||||
https://git.gmetri.io/gmetrivr/cs-dt/actions/run?workflow=update-repo-version.yml&actor=0&status=
|
|
||||||
|
|
||||||
curl -X 'POST' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-dt/issues' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token e139b1c73bfae1b7748961c9f9a381bd3cca0633' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d '{
|
|
||||||
"assignee": "bot-build",
|
|
||||||
"body": "{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-fda468af\"}",
|
|
||||||
"closed": false,
|
|
||||||
"title": "cs-dt package for repo2.hub.gmetri.io/dt-api:main-fda468af"
|
|
||||||
}'
|
|
||||||
|
|
||||||
curl -X 'POST' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-dt/issues/1/comments' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H 'Authorization: token e139b1c73bfae1b7748961c9f9a381bd3cca0633' \
|
|
||||||
-d '{
|
|
||||||
"body": "{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-fda468af\"}"
|
|
||||||
}'
|
|
||||||
|
|
||||||
curl -X 'POST' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-dt/issues/1/comments' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token e139b1c73bfae1b7748961c9f9a381bd3cca0633' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d '{
|
|
||||||
"body": "{\"image\":\"repo2.hub.gmetri.io\/dt-api\",\"tag\":\"main-255c2f30\"}"
|
|
||||||
}'
|
|
||||||
|
|
||||||
ISSUE_COMMENT_STRING=`echo '{ "image": "repo2.hub.gmetri.io/dt-api", "tag": "main-255c2f30" }' | jq tostring`
|
|
||||||
API_JSON_BODY=`echo '{"body": '$ISSUE_COMMENT_STRING' }' | jq -r tostring`
|
|
||||||
# {"body":"{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-255c2f30\"}"}
|
|
||||||
|
|
||||||
curl -X 'POST' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-dt/issues/1/comments' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token e139b1c73bfae1b7748961c9f9a381bd3cca0633' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d $API_JSON_BODY
|
|
||||||
|
|
||||||
curl -X 'POST' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-dt/issues/1/comments' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token e139b1c73bfae1b7748961c9f9a381bd3cca0633' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d '{"body":"{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-255c2f30\"}"}'
|
|
||||||
|
|
||||||
#Get the latest issue with label workflow
|
|
||||||
ISSUE_JSON=`curl -X 'GET' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-ui/issues?labels=workflow&page=1&limit=1' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token 20daafd0fb3dd3392738430bf438eb96023b5cb0'`
|
|
||||||
ISSUE_NUMBER=`echo $ISSUE_JSON | jq '.[0].number'`
|
|
||||||
curl -X 'POST' \
|
|
||||||
'https://git.gmetri.io/api/v1/repos/gmetrivr/cs-dt/issues/$ISSUE_NUMBER/comments' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token e139b1c73bfae1b7748961c9f9a381bd3cca0633' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d '{"body":"{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-255c2f30\"}"}'
|
|
||||||
45
.github/workflows/cs-update-push.yml
vendored
45
.github/workflows/cs-update-push.yml
vendored
@ -21,66 +21,43 @@ 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 }}'
|
||||||
TAG=`echo $ISSUE_COMMENT_STRING | jq -r ".tag"`
|
DOCKER_BASE=`echo $ISSUE_COMMENT_STRING | jq ".image"`
|
||||||
REPO=`echo $ISSUE_COMMENT_STRING | jq -r ".repo"`
|
BUILD_ID=`echo $ISSUE_COMMENT_STRING | jq ".tag"`
|
||||||
SENDER=`echo $ISSUE_COMMENT_STRING | jq -r ".sender"`
|
echo "DOCKER_BASE=$DOCKER_BASE" >> "$GITHUB_OUTPUT";
|
||||||
|
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
|
||||||
# Try to extract docker_repo from issue comment, fallback to default variable
|
|
||||||
DOCKER_REPO_FROM_COMMENT=`echo $ISSUE_COMMENT_STRING | jq -r ".docker_repo"`
|
|
||||||
if [ -n "$DOCKER_REPO_FROM_COMMENT" ] && [ "$DOCKER_REPO_FROM_COMMENT" != "null" ]; then
|
|
||||||
DOCKER_REPO=$DOCKER_REPO_FROM_COMMENT/$REPO
|
|
||||||
echo "Using docker_repo from issue comment: $DOCKER_REPO"
|
|
||||||
else
|
|
||||||
DOCKER_REPO=${{ vars.docker_repo2_registry }}/$REPO
|
|
||||||
echo "Using fallback docker_repo: $DOCKER_REPO"
|
|
||||||
fi
|
|
||||||
|
|
||||||
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 "TAG: ${{ steps.read-issue.outputs.TAG }}";
|
echo "BUILD_ID: ${{ steps.read-issue.outputs.BUILD_ID }}";
|
||||||
echo "REPO: ${{ steps.read-issue.outputs.REPO }}";
|
echo "DOCKER_BASE: ${{ steps.read-issue.outputs.DOCKER_BASE }}";
|
||||||
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
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.bot_build_repo_token }} #This is because we want to trigger a new build
|
|
||||||
path: cs
|
path: cs
|
||||||
#Temporary problem git#v2.48.0 - tags aren't fetched with --tags. https://github.com/actions/checkout/issues/2041
|
token: ${{ secrets.bot_build_repo_token }} #This is because we want to trigger a new build
|
||||||
#fetch-depth: 50 #To get the topmost git tags
|
|
||||||
#fetch-tags: true
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Checkout deploy-tools
|
- name: Checkout deploy-tools
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
github-server-url: ${{ github.server_url }}
|
github-server-url: ${{ github.server_url }}
|
||||||
repository: gmetribin/deploy-tools
|
repository: gmetribin/deploy-tools
|
||||||
ref: v1.1.42
|
ref: v1.1.15
|
||||||
path: deploy-tools
|
path: deploy-tools
|
||||||
# token: $\{{ github.token }} # DEFAULT / Any pushes with github.token don't trigger a chained build
|
# token: $\{{ github.token }} # DEFAULT / Any pushes with github.token don't trigger a chained build
|
||||||
|
|
||||||
#To fetch tags correctly: https://github.com/actions/checkout/issues/1471#issuecomment-1755560284
|
|
||||||
- name: Increment package version and push
|
- name: Increment package version and push
|
||||||
run: |
|
run: |
|
||||||
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'
|
||||||
|
|
||||||
TAG=${{ steps.read-issue.outputs.TAG }}
|
BUILD_ID=${{ steps.read-issue.outputs.BUILD_ID }}
|
||||||
export REPO=${{ steps.read-issue.outputs.REPO }}
|
DOCKER_BASE=${{ steps.read-issue.outputs.DOCKER_BASE }}
|
||||||
export 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_REPO -t $TAG -r $REPOLIST;
|
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_BASE -t $BUILD_ID -r $REPOLIST;
|
||||||
|
|
||||||
git push origin main;
|
git push origin main;
|
||||||
git push --tags origin main;
|
git push --tags origin main;
|
||||||
|
|||||||
37
.github/workflows/cs-update-trigger.yml
vendored
37
.github/workflows/cs-update-trigger.yml
vendored
@ -9,10 +9,9 @@ on:
|
|||||||
description: 'The cs repo that contains this image'
|
description: 'The cs repo that contains this image'
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
docker_repo:
|
|
||||||
description: 'The name of the action variable containing the docker repo value'
|
env:
|
||||||
required: false
|
CS_REPO: ${{ github.repository }}
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
trigger-cs-job:
|
trigger-cs-job:
|
||||||
@ -25,35 +24,33 @@ 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};
|
||||||
REPO=${{ github.repository }};
|
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 repo and tag
|
- name: Print build id and image name
|
||||||
run: |
|
run: |
|
||||||
echo "REPO: ${{ steps.get-id.outputs.REPO }}";
|
echo "BUILD_ID: ${{ steps.get-id.outputs.BUILD_ID }}";
|
||||||
echo "TAG: ${{ steps.get-id.outputs.TAG }}";
|
echo "DOCKER_BASE: ${{ steps.get-id.outputs.DOCKER_BASE }}";
|
||||||
|
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 issue#1
|
||||||
run: |
|
run: |
|
||||||
DOCKER_REPO_VALUE="${{ vars[inputs.docker_repo] }}"
|
ISSUE_COMMENT_STRING=`echo "{ \"image\": \"${{ steps.get-id.outputs.DOCKER_BASE }}\", \"tag\": \"${{ steps.get-id.outputs.BUILD_ID }}\" }" | jq tostring`
|
||||||
ISSUE_COMMENT_STRING=`echo "{ \"docker_repo\": \"$DOCKER_REPO_VALUE\", \"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`
|
||||||
echo API_JSON_BODY: $API_JSON_BODY
|
echo API_JSON_BODY: $API_JSON_BODY
|
||||||
# {"body":"{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-255c2f30\"}"}
|
# {"body":"{\"image\":\"repo2.hub.gmetri.io/dt-api\",\"tag\":\"main-255c2f30\"}"}
|
||||||
|
|
||||||
set -x
|
set +x
|
||||||
ISSUE_JSON=`curl -X 'GET' \
|
|
||||||
'${{ github.api_url }}/repos/${{ inputs.deploy_repo }}/issues?labels=workflow&page=1&limit=1' \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}'`
|
|
||||||
ISSUE_NUMBER=`echo $ISSUE_JSON | jq '.[0].number'`
|
|
||||||
curl -X 'POST' \
|
curl -X 'POST' \
|
||||||
'${{ github.api_url }}/repos/${{ inputs.deploy_repo }}/issues/'$ISSUE_NUMBER'/comments' \
|
'${{ github.api_url }}/repos/${{ inputs.deploy_repo }}/issues/1/comments' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}' \
|
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d $API_JSON_BODY
|
-d $API_JSON_BODY
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/nm-update.yml
vendored
4
.github/workflows/nm-update.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github-server-url: ${{ github.server_url }}
|
github-server-url: ${{ github.server_url }}
|
||||||
repository: gmetribin/deploy-tools
|
repository: gmetribin/deploy-tools
|
||||||
ref: v1.1.42
|
ref: v1.1.15
|
||||||
path: deploy-tools
|
path: deploy-tools
|
||||||
|
|
||||||
- name: Increment cs version in nm repo and push
|
- name: Increment cs version in nm repo and push
|
||||||
@ -77,6 +77,4 @@ 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;
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -129,4 +129,4 @@ dist
|
|||||||
.yarn/build-state.yml
|
.yarn/build-state.yml
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
.idea/
|
|
||||||
|
|||||||
@ -34,6 +34,8 @@ 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
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
echo "Script directory: $SCRIPT_DIR"
|
echo "Script directory: $SCRIPT_DIR"
|
||||||
|
|
||||||
@ -39,12 +40,8 @@ main()
|
|||||||
done <<< "$KUST_FILES_LINES"
|
done <<< "$KUST_FILES_LINES"
|
||||||
|
|
||||||
source $SCRIPT_DIR/repo_to_cs_basetag.sh;
|
source $SCRIPT_DIR/repo_to_cs_basetag.sh;
|
||||||
|
git commit -m "$NEW_TAG: $IMAGE updated to $IMAGE_TAG";
|
||||||
echo "NEW_TAG: $NEW_TAG"
|
git tag -a $NEW_VER -m "$NEW_VER: $IMAGE updated to $IMAGE_TAG"
|
||||||
COMMIT_MESSAGE="$NEW_TAG: $REPO to $IMAGE_TAG by $SENDER";
|
|
||||||
|
|
||||||
git commit -m "$COMMIT_MESSAGE"
|
|
||||||
git tag -a $NEW_TAG -m "$COMMIT_MESSAGE"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
### Starts here
|
### Starts here
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user