-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from KiraCore/feature/ci-cd-v2
feature/ci-cd-v2 -> release/v0.2.15
- Loading branch information
Showing
100 changed files
with
26,180 additions
and
1,250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Create version branch & PR <working>/* -> version | ||
|
||
on: | ||
push: | ||
branches: [ feature/*, bugfix/* ] | ||
|
||
jobs: | ||
auto-pr: | ||
name: Automated Master Branch PR | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
contents: write | ||
packages: write | ||
id-token: write | ||
pull-requests: write | ||
steps: | ||
# Work around https://github.com/actions/checkout/issues/760 | ||
- name: Add safe.directory | ||
run: | | ||
git config --global --add safe.directory /github/workspace | ||
git config --global --add safe.directory $PWD | ||
# ref.: https://github.com/actions/checkout, v3.0.0 | ||
- name: Checkout repository | ||
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 | ||
- name: Extract branch name on pull request | ||
shell: bash | ||
run: | | ||
set -x | ||
git branch -r -l | ||
echo "(current dir): $PWD" && ls -l ./ | ||
chmod -Rv 555 ./scripts | ||
RELEASE_VER=$(./scripts/version.sh) && echo "RELEASE_VER=$RELEASE_VER" >> $GITHUB_ENV | ||
RELEASE_BRANCH="release/$RELEASE_VER" && echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV | ||
REPOSITORY_NAME="${{ github.event.repository.name }}" && echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV | ||
echo "SOURCE_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | ||
echo "DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV | ||
echo "MASTER_REF=$(git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | head -1 | sed 's/HEAD//')" >> $GITHUB_ENV | ||
git ls-remote https://github.com/kiracore/$REPOSITORY_NAME | egrep -q "refs/tags/${RELEASE_VER}$" && echo "RELEASE_EXISTS=true" >> $GITHUB_ENV || echo "RELEASE_EXISTS=false" >> $GITHUB_ENV | ||
( git show-branch "origin/$RELEASE_BRANCH" || git show-branch "remotes/origin/$RELEASE_BRANCH" ) && echo "TARGET_BRANCH_EXISTS=true" >> $GITHUB_ENV || echo "TARGET_BRANCH_EXISTS=false" >> $GITHUB_ENV | ||
- name: Print debug data before publishing | ||
run: | | ||
echo "Repository name: ${{ env.REPOSITORY_NAME }}" | ||
echo " Source branch: ${{ env.SOURCE_BRANCH }}" | ||
echo " Default branch: ${{ env.DEFAULT_BRANCH }}" | ||
echo " Master refer.: ${{ env.MASTER_REF }}" | ||
echo "Release version: ${{ env.RELEASE_VER }}" | ||
echo " Release branch: ${{ env.RELEASE_BRANCH }}" | ||
echo " Release exists: ${{ env.RELEASE_EXISTS }}" | ||
echo " Event name: ${{ github.event_name }}" | ||
echo " Target Exists: ${{ env.TARGET_BRANCH_EXISTS }}" | ||
# ref.: https://github.com/peterjgrainger/action-create-branch, v2.2.0 | ||
- name: Create version branch from master | ||
uses: peterjgrainger/action-create-branch@c2800a3a9edbba2218da6861fa46496cf8f3195a | ||
if: | | ||
( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && | ||
( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && | ||
( startsWith(env.RELEASE_BRANCH, 'release/v') && contains(env.RELEASE_BRANCH, '.') ) | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: ${{ env.RELEASE_BRANCH }} | ||
sha: ${{ env.MASTER_REF }} | ||
- name: Create PR from feature to version branch | ||
# ref. repo-sync/pull-request is broken, using cea2aj/pull-request instead | ||
uses: cea2aj/pull-request@84eb0c3478f13651e5649367941b867ca02d7926 | ||
if: | | ||
( env.TARGET_BRANCH_EXISTS == false || env.TARGET_BRANCH_EXISTS == 'false' ) && | ||
( env.RELEASE_EXISTS == false || env.RELEASE_EXISTS == 'false' ) && | ||
( startsWith(env.RELEASE_BRANCH, 'release/v') && contains(env.RELEASE_BRANCH, '.') ) | ||
with: | ||
github_token: ${{ secrets.REPO_ACCESS }} | ||
source_branch: ${{ env.SOURCE_BRANCH }} | ||
destination_branch: ${{ env.RELEASE_BRANCH}} | ||
pr_title: "${{ env.SOURCE_BRANCH }} -> ${{ env.RELEASE_BRANCH }}" | ||
pr_label: "kira-automation" | ||
pr_allow_empty: true |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
bin/ | ||
*/bin | ||
nfpm_* | ||
*/nfpm_* | ||
*-tmp | ||
*/*-tmp | ||
*/.build | ||
*/dist | ||
*/spec | ||
*/__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# tools | ||
KIRA Tools | ||
|
||
## Dependencies | ||
|
||
``` | ||
VERSION="v0.0.8.0" && cd /tmp && rm -fv ./bash-utils.sh && \ | ||
CHECKSUM="1cfb806eec03956319668b0a4f02f2fcc956ed9800070cda1870decfe2e6206e" && \ | ||
wget https://github.com/KiraCore/tools/releases/download/$VERSION/bash-utils.sh -O ./bash-utils.sh && \ | ||
FILE_HASH=$(sha256sum ./bash-utils.sh | awk '{ print $1 }' | xargs || echo -n "") && \ | ||
[ "$FILE_HASH" == "$CHECKSUM" ] && chmod -v 555 ./bash-utils.sh && \ | ||
./bash-utils.sh bashUtilsSetup "/var/kiraglob" && . /etc/profile && \ | ||
bash-utils loadGlobEnvs && utils echoInfo "SUCCESS: bash-utils $(bash-utils bashUtilsVersion) were installed!" || \ | ||
echo "ERROR: Invalid checksum '$FILE_HASH' or bashUtilsSetup failed" | ||
``` | ||
|
||
## Build | ||
|
||
``` | ||
# set env variable to your local repos (will vary depending on the user) | ||
setGlobEnv TOOLS_REPO "/mnt/c/Users/asmodat/Desktop/KIRA/GITHUB/tools" | ||
cd $TOOLS_REPO | ||
make build | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.PHONY: test build publish | ||
|
||
test: | ||
./scripts/test.sh | ||
|
||
build: | ||
./scripts/build.sh | ||
|
||
publish: | ||
./scripts/publish.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
# tools | ||
KIRA Network - useful tools & scripts | ||
|
||
## Signatures | ||
|
||
All files in KIRA repositories are always signed with [cosign](https://github.com/sigstore/cosign/releases) | ||
|
||
Cosign requires simple initial setup of the signer keys described more precisely [here](https://dev.to/n3wt0n/sign-your-container-images-with-cosign-github-actions-and-github-container-registry-3mni) | ||
|
||
```bash | ||
# install cosign | ||
COSIGN_VERSION="v1.7.2" && \ | ||
if [[ "$(uname -m)" == *"ar"* ]] ; then ARCH="arm64"; else ARCH="amd64" ; fi && echo $ARCH && \ | ||
PLATFORM=$(uname) && FILE=$(echo "cosign-${PLATFORM}-${ARCH}" | tr '[:upper:]' '[:lower:]') && \ | ||
wget https://github.com/sigstore/cosign/releases/download/${COSIGN_VERSION}/$FILE && chmod +x -v ./$FILE && \ | ||
mv -fv ./$FILE /usr/local/bin/cosign && cosign version | ||
|
||
# save KIRA public cosign key | ||
cat > ./cosign.pub << EOL | ||
-----BEGIN PUBLIC KEY----- | ||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/IrzBQYeMwvKa44/DF/HB7XDpnE+ | ||
f+mU9F/Qbfq25bBWV2+NlYMJv3KvKHNtu3Jknt6yizZjUV4b8WGfKBzFYw== | ||
-----END PUBLIC KEY----- | ||
EOL | ||
|
||
# download desired files and the corresponding .sig file from: https://github.com/KiraCore/tools/releases | ||
|
||
# verify signature of downloaded files | ||
cosign verify-blob --key=./cosign.pub --signature=./<file>.sig ./<file> | ||
``` | ||
|
||
## bash-utils | ||
|
||
KIRA bash-utils is a general purpose tool for simplifying scripts & commands | ||
|
||
```bash | ||
# one line install | ||
TOOLS_VERSION="v0.2.7" && mkdir -p /usr/keys && FILE_NAME="bash-utils.sh" && \ | ||
if [ -z "$KIRA_COSIGN_PUB" ] ; then KIRA_COSIGN_PUB=/usr/keys/kira-cosign.pub ; fi && \ | ||
echo -e "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/IrzBQYeMwvKa44/DF/HB7XDpnE+\nf+mU9F/Qbfq25bBWV2+NlYMJv3KvKHNtu3Jknt6yizZjUV4b8WGfKBzFYw==\n-----END PUBLIC KEY-----" > $KIRA_COSIGN_PUB && \ | ||
wget "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/${FILE_NAME}" -O ./$FILE_NAME && \ | ||
wget "https://github.com/KiraCore/tools/releases/download/$TOOLS_VERSION/${FILE_NAME}.sig" -O ./${FILE_NAME}.sig && \ | ||
cosign verify-blob --key="$KIRA_COSIGN_PUB" --signature=./${FILE_NAME}.sig ./$FILE_NAME && \ | ||
chmod -v 555 ./$FILE_NAME && ./$FILE_NAME bashUtilsSetup "/var/kiraglob" && . /etc/profile && \ | ||
echoInfo "Installed bash-utils $(bashUtilsVersion)" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Features: | ||
* Added a range of `set by SubStr` functions to bash-utils | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.PHONY: test | ||
|
||
test: | ||
./scripts/test.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
# KIRA Bash Utils | ||
## KIRA Bash Utils | ||
|
||
The ultimate collection of various bash-shell function to make access to various system components fast and simple from the CLI level | ||
|
||
|
||
# Install | ||
### Local Setup | ||
``` | ||
cd /tmp && read -p "Input branch name: " BRANCH && \ | ||
wget https://raw.githubusercontent.com/KiraCore/tools/$BRANCH/bash-utils/install.sh -O ./i.sh && \ | ||
chmod 555 ./i.sh && ./i.sh "$BRANCH" "/var/kiraglob" && . /etc/profile || echo "ERROR: Failed kira bash-utils installation" | ||
./bash-utils.sh utilsSetup "/var/kiraglob" | ||
``` | ||
|
||
### Remote Setup | ||
``` | ||
cd /tmp && rm -fv ./bash-utils.sh && \ | ||
wget https://raw.githubusercontent.com/KiraCore/tools/latest/bash-utils/bash-utils.sh -O ./bash-utils.sh && \ | ||
chmod -v 555 ./bash-utils.sh && ./bash-utils.sh bashUtilsSetup "/var/kiraglob" | ||
``` |
Oops, something went wrong.