Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d67ad21b7d | ||
|
|
4aec3cdb78 | ||
|
|
ddd5f59c18 | ||
|
|
98843f44f6 | ||
|
|
a24a7ce927 | ||
|
|
7cbbb82805 | ||
|
|
45b7982a4c | ||
|
|
ae65162eb4 | ||
|
|
58708425fd | ||
|
|
c214aac69d | ||
|
|
edeaa7f7c0 | ||
|
|
5d6a43a007 | ||
|
|
298c951b19 | ||
|
|
88ab0abceb | ||
|
|
7cc7edaee6 | ||
|
|
23a90586b2 | ||
|
|
2c91e942b2 | ||
|
|
776661b372 | ||
|
|
e1780938ad | ||
|
|
b74044d1f5 | ||
|
|
2e13dc6ba4 | ||
|
|
c8322be7a1 | ||
|
|
6ce9375618 | ||
|
|
a608f6b4d6 | ||
|
|
22c46d4e24 | ||
|
|
93fbb5c9f7 | ||
|
|
2696bd5f1d | ||
|
|
e1e8faa21e | ||
|
|
4c36c5ac34 |
47
.github/workflows/cs-update-push.yml
vendored
47
.github/workflows/cs-update-push.yml
vendored
@ -21,45 +21,66 @@ 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 -r ".tag"`
|
||||
REPO=`echo $ISSUE_COMMENT_STRING | jq -r ".repo"`
|
||||
SENDER=`echo $ISSUE_COMMENT_STRING | jq -r ".sender"`
|
||||
|
||||
# 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
|
||||
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
|
||||
with:
|
||||
path: cs
|
||||
fetch-depth: 50 #To get the topmost git tags
|
||||
fetch-tags: true
|
||||
token: ${{ secrets.bot_build_repo_token }} #This is because we want to trigger a new build
|
||||
path: cs
|
||||
#Temporary problem git#v2.48.0 - tags aren't fetched with --tags. https://github.com/actions/checkout/issues/2041
|
||||
#fetch-depth: 50 #To get the topmost git tags
|
||||
#fetch-tags: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout deploy-tools
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
github-server-url: ${{ github.server_url }}
|
||||
repository: gmetribin/deploy-tools
|
||||
ref: v1.1.18
|
||||
ref: v1.1.42
|
||||
path: deploy-tools
|
||||
# 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
|
||||
run: |
|
||||
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 }}
|
||||
export REPO=${{ steps.read-issue.outputs.REPO }}
|
||||
export 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;
|
||||
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_REPO -t $TAG -r $REPOLIST;
|
||||
|
||||
git push origin main;
|
||||
git push --tags origin main;
|
||||
|
||||
27
.github/workflows/cs-update-trigger.yml
vendored
27
.github/workflows/cs-update-trigger.yml
vendored
@ -9,9 +9,10 @@ on:
|
||||
description: 'The cs repo that contains this image'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
env:
|
||||
CS_REPO: ${{ github.repository }}
|
||||
docker_repo:
|
||||
description: 'The name of the action variable containing the docker repo value'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
trigger-cs-job:
|
||||
@ -24,21 +25,19 @@ 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";
|
||||
REPO=${{ github.repository }};
|
||||
echo "REPO=$REPO" >> "$GITHUB_OUTPUT";
|
||||
echo "TAG=$BUILD_ID" >> "$GITHUB_OUTPUT";
|
||||
|
||||
- name: Print build id and image name
|
||||
- name: Print repo and tag
|
||||
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`
|
||||
DOCKER_REPO_VALUE="${{ vars[inputs.docker_repo] }}"
|
||||
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
|
||||
|
||||
API_JSON_BODY=`echo '{"body": '$ISSUE_COMMENT_STRING' }' | jq -r tostring`
|
||||
@ -52,7 +51,7 @@ jobs:
|
||||
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}'`
|
||||
ISSUE_NUMBER=`echo $ISSUE_JSON | jq '.[0].number'`
|
||||
curl -X 'POST' \
|
||||
'${{ github.api_url }}/repos/${{ inputs.deploy_repo }}/issues/$ISSUE_NUMBER/comments' \
|
||||
'${{ github.api_url }}/repos/${{ inputs.deploy_repo }}/issues/'$ISSUE_NUMBER'/comments' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Authorization: token ${{ secrets.bot_build_issues_token }}' \
|
||||
-H 'Content-Type: application/json' \
|
||||
|
||||
4
.github/workflows/nm-update.yml
vendored
4
.github/workflows/nm-update.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
||||
with:
|
||||
github-server-url: ${{ github.server_url }}
|
||||
repository: gmetribin/deploy-tools
|
||||
ref: v1.1.19
|
||||
ref: v1.1.42
|
||||
path: deploy-tools
|
||||
|
||||
- name: Increment cs version in nm repo and push
|
||||
@ -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;
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -129,4 +129,4 @@ dist
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
.idea/
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
echo "Script directory: $SCRIPT_DIR"
|
||||
|
||||
@ -40,10 +39,12 @@ main()
|
||||
done <<< "$KUST_FILES_LINES"
|
||||
|
||||
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"
|
||||
|
||||
echo "NEW_TAG: $NEW_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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user