Compare commits
52 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 | ||
|
|
8ad08afcf4 | ||
|
|
76e3873f79 | ||
|
|
68e604c41a | ||
|
|
011b6fecc4 | ||
|
|
6f12bd895b | ||
|
|
ef9622e749 | ||
|
|
d0c7a8f855 | ||
|
|
27635d5be0 | ||
|
|
8a615ceb52 | ||
|
|
3e5a503770 | ||
|
|
4205d67f5b | ||
|
|
ea758d77aa | ||
|
|
d9c90c5e98 | ||
|
|
a9c6b10351 | ||
|
|
45cdb46d40 | ||
|
|
7cd1f4460f | ||
|
|
ee6d667b0e | ||
|
|
c5304fb209 | ||
|
|
f88253b60c | ||
|
|
ec70398266 | ||
|
|
12122870c3 | ||
|
|
2bd93d6298 | ||
|
|
f10f396251 |
43
.github/unused/actions-base.Dockerfile
vendored
43
.github/unused/actions-base.Dockerfile
vendored
@ -1,43 +0,0 @@
|
|||||||
FROM node:22-bookworm-slim
|
|
||||||
|
|
||||||
#Use an entrypoint that simply lists out all commands sent to it
|
|
||||||
COPY entryPoint.sh /src/fab/entryPoint.sh
|
|
||||||
ENTRYPOINT ["/src/fab/entryPoint.sh"]
|
|
||||||
|
|
||||||
#node:18 image already has a user node with uid:gid 1000:1000
|
|
||||||
#We add it to sudo list
|
|
||||||
RUN export DEBIAN_FRONTEND="noninteractive" \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y \
|
|
||||||
# sudo \
|
|
||||||
less \
|
|
||||||
#Neededd for git commits during builds
|
|
||||||
# git \
|
|
||||||
#Needed for triggering next step of builds
|
|
||||||
# curl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
# && usermod -aG sudo node \
|
|
||||||
# && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
|
|
||||||
#Creating a few base folders that child dockers may need
|
|
||||||
&& mkdir -p /src && chown node /src \
|
|
||||||
&& mkdir -p /cloud && chown node /cloud \
|
|
||||||
&& mkdir -p /build && chown node /build \
|
|
||||||
# && npm install -g npm@10.8.2 \
|
|
||||||
&& npm install -g pnpm
|
|
||||||
|
|
||||||
USER node
|
|
||||||
|
|
||||||
# upgrade pnpm to latest version
|
|
||||||
#&& source ~/.bashrc \ #doesn't work
|
|
||||||
#Also, "pnpm add -g pnpm" needs be in "~" to work - it doesn't work from "/" dir (not sure why).
|
|
||||||
RUN SHELL=bash pnpm setup \
|
|
||||||
&& export PNPM_HOME="~/.local/share/pnpm" && export PATH="$PNPM_HOME:$PATH" \
|
|
||||||
&& cd ~ && pnpm add -g pnpm
|
|
||||||
|
|
||||||
RUN echo '\nalias p="pnpm"' >> ~/.bashrc
|
|
||||||
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
#Allow image to be used standalone without any commands:
|
|
||||||
CMD ["tail", "-f", "/dev/null"]
|
|
||||||
#CMD ["sleep", "inf"]
|
|
||||||
43
.github/unused/build-base-image.yml
vendored
43
.github/unused/build-base-image.yml
vendored
@ -1,43 +0,0 @@
|
|||||||
name: Build the docker base image weekly
|
|
||||||
# on: [push]
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
# branches:
|
|
||||||
# - main
|
|
||||||
schedule:
|
|
||||||
- cron: "0 6 * * 5" #Every Friday@11:30 AM IST (6:00 GMT)
|
|
||||||
# Cron: Minute(0-59) Hour(0-23) DayOfMonth(1-31) MonthOfYear(1-12) DayOfWeek(0-6)
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_REGISTRY: ${{ vars.docker_repo2_registry }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
DOCKER_IMAGE: ${{ vars.docker_repo2_registry }}/${{ github.repository }}:base-v2
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
docker-build-and-push:
|
|
||||||
runs-on: ubuntu-22.04 #ubuntu-latest
|
|
||||||
# if: ${{ github.event_name == 'push' }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to Docker Container Registry
|
|
||||||
# if: ${{ github.event_name == 'push' }}
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.docker_repo2_registry }}
|
|
||||||
username: ${{ vars.docker_repo2_username }}
|
|
||||||
password: ${{ vars.docker_repo2_password }}
|
|
||||||
|
|
||||||
- name: Build the Base Docker image
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--file fab/d/actions-base.Dockerfile \
|
|
||||||
--tag $DOCKER_IMAGE \
|
|
||||||
./fab/context/;
|
|
||||||
|
|
||||||
- name: Push the Docker image
|
|
||||||
# if: ${{ github.event_name == 'push' }}
|
|
||||||
run: |
|
|
||||||
docker push $DOCKER_IMAGE
|
|
||||||
32
.github/unused/demo.yml
vendored
32
.github/unused/demo.yml
vendored
@ -1,32 +0,0 @@
|
|||||||
name: Gitea Actions Demo
|
|
||||||
run-name: ${{ github.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Explore-Gitea-Actions:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
|
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
||||||
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
|
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ github.workspace }}
|
|
||||||
echo "var.DOCKER_REPO2_REGISTRY" repo2.hub.gmetri.io
|
|
||||||
echo "github.repository" ${{ github.repository }}
|
|
||||||
echo "github.ref_name" ${{ github.ref_name }}
|
|
||||||
|
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
|
||||||
|
|
||||||
# Gitea action runners
|
|
||||||
|
|
||||||
# - "ubuntu-latest:docker://repo2.hub.gmetri.io/gitea/runner-images:ubuntu-latest"
|
|
||||||
# - "ubuntu-22.04:docker://repo2.hub.gmetri.io/gitea/runner-images:ubuntu-22.04"
|
|
||||||
# - "ubuntu-20.04:docker://repo2.hub.gmetri.io/gitea/runner-images:ubuntu-20.04"
|
|
||||||
# - "ubuntu-latest-slim:docker://repo2.hub.gmetri.io/gitea/runner-images:ubuntu-latest-slim"
|
|
||||||
# - "ubuntu-22.04-slim:docker://repo2.hub.gmetri.io/gitea/runner-images:ubuntu-22.04-slim"
|
|
||||||
# - "ubuntu-20.04-slim:docker://repo2.hub.gmetri.io/gitea/runner-images:ubuntu-20.04-slim"
|
|
||||||
91
.github/unused/docker-publish.yml
vendored
91
.github/unused/docker-publish.yml
vendored
@ -1,91 +0,0 @@
|
|||||||
name: Docker
|
|
||||||
|
|
||||||
# This workflow uses actions that are not certified by GitHub.
|
|
||||||
# They are provided by a third-party and are governed by
|
|
||||||
# separate terms of service, privacy policy, and support
|
|
||||||
# documentation.
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: $cron-daily
|
|
||||||
push:
|
|
||||||
branches: [ $default-branch ]
|
|
||||||
# Publish semver tags as releases.
|
|
||||||
tags: [ 'v*.*.*' ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ $default-branch ]
|
|
||||||
|
|
||||||
env:
|
|
||||||
# Use docker.io for Docker Hub if empty
|
|
||||||
REGISTRY: ${{ vars.docker_repo2_registry }}
|
|
||||||
# github.repository as <account>/<repo>
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
# Install the cosign tool except on PR
|
|
||||||
# https://github.com/sigstore/cosign-installer
|
|
||||||
- name: Install cosign
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
|
||||||
with:
|
|
||||||
cosign-release: 'v2.2.4'
|
|
||||||
|
|
||||||
# Set up BuildKit Docker container builder to be able to build
|
|
||||||
# multi-platform images and export cache
|
|
||||||
# https://github.com/docker/setup-buildx-action
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
|
||||||
|
|
||||||
# Login against a Docker registry except on PR
|
|
||||||
# https://github.com/docker/login-action
|
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ secrets.docker_repo2_username }}
|
|
||||||
password: ${{ secrets.docker_repo2_password }}
|
|
||||||
|
|
||||||
# Extract metadata (tags, labels) for Docker
|
|
||||||
# https://github.com/docker/metadata-action
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
|
|
||||||
# Build and push Docker image with Buildx (don't push on PR)
|
|
||||||
# https://github.com/docker/build-push-action
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: build-and-push
|
|
||||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
# Sign the resulting Docker image digest except on PRs.
|
|
||||||
# This will only write to the public Rekor transparency log when the Docker
|
|
||||||
# repository is public to avoid leaking data. If you would like to publish
|
|
||||||
# transparency data even for private images, pass --force to cosign below.
|
|
||||||
# https://github.com/sigstore/cosign
|
|
||||||
- name: Sign the published Docker image
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
env:
|
|
||||||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
|
||||||
DIGEST: ${{ steps.build-and-push.outputs.digest }}
|
|
||||||
# This step uses the identity token to provision an ephemeral certificate
|
|
||||||
# against the sigstore community Fulcio instance.
|
|
||||||
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
|
|
||||||
54
.github/unused/docker-push.yml
vendored
54
.github/unused/docker-push.yml
vendored
@ -1,54 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
on: [push]
|
|
||||||
|
|
||||||
# on:
|
|
||||||
# push:
|
|
||||||
# branches: [ $default-branch ]
|
|
||||||
# pull_request:
|
|
||||||
# branches: [ $default-branch ]
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: repo2.hub.gmetri.io/${{ github.repository }}:${{ github.ref_name }}-v9
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
docker-build-and-push:
|
|
||||||
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Debug
|
|
||||||
run: |
|
|
||||||
ls ${{ github.workspace }}
|
|
||||||
echo "VARS"
|
|
||||||
echo "vars.docker_repo2_username" ${{vars.docker_repo2_username}}
|
|
||||||
echo "SECRETS"
|
|
||||||
echo "secrets.docker_repo2_password2" ${{ secrets.docker_repo2_password2 }}
|
|
||||||
echo "CONTEXT"
|
|
||||||
echo "github.repository" ${{ github.repository }}
|
|
||||||
echo "github.ref_name" ${{ github.ref_name }}
|
|
||||||
|
|
||||||
- uses: docker/login-action@v3
|
|
||||||
name: Login to GitHub Container Registry
|
|
||||||
with:
|
|
||||||
registry: repo2.hub.gmetri.io
|
|
||||||
username: ${{ vars.docker_repo2_username }}
|
|
||||||
password: ${{ secrets.docker_repo2_password }}
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: List files in the repository
|
|
||||||
run: |
|
|
||||||
ls ${{ github.workspace }} && \
|
|
||||||
echo "VARS"
|
|
||||||
echo "var.DOCKER_REPO2_REGISTRY" ${{ vars.DOCKER_REPO2_REGISTRY }}
|
|
||||||
echo "CONTEXT"
|
|
||||||
echo "github.repository" ${{ github.repository }}
|
|
||||||
echo "github.ref_name" ${{ github.ref_name }}
|
|
||||||
|
|
||||||
- name: Build the Docker image
|
|
||||||
run: |
|
|
||||||
docker build ./context --file context/Dockerfile --tag $IMAGE_NAME && \
|
|
||||||
docker push $IMAGE_NAME
|
|
||||||
|
|
||||||
# my-image-name:$(date +%s)
|
|
||||||
# ${DRONE_BRANCH//\//-}-v8
|
|
||||||
58
.github/unused/nm-update-push.yml
vendored
Normal file
58
.github/unused/nm-update-push.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
name: Update Repo Version Workflow
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
push-cs-update:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||||
|
# added or changed files to the repository.
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- id: read-issue
|
||||||
|
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";
|
||||||
|
|
||||||
|
- name: Print IMAGE and TAG
|
||||||
|
run: |
|
||||||
|
echo "BUILD_ID: ${{ steps.read-issue.outputs.BUILD_ID }}";
|
||||||
|
echo "DOCKER_BASE: ${{ steps.read-issue.outputs.DOCKER_BASE }}";
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: cs
|
||||||
|
- name: Checkout deploy-tools
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: gmetribin/deploy-tools
|
||||||
|
ref: main
|
||||||
|
path: deploy-tools
|
||||||
|
token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Increment package version and push
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
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 }}
|
||||||
|
REPOLIST=./.github/repolist.txt
|
||||||
|
pwd; ls -al;
|
||||||
|
|
||||||
|
cd cs;
|
||||||
|
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_BASE -t $BUILD_ID -r $REPOLIST
|
||||||
|
|
||||||
|
git push origin main
|
||||||
|
git push --tags origin main
|
||||||
99
.github/unused/nm-update-push_2.yml
vendored
Normal file
99
.github/unused/nm-update-push_2.yml
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
name: Deployed Dev
|
||||||
|
run-name: Deploying ${{ github.ref_name }} to ${{ github.event.inputs.env || 'dev' }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
# workflow_run: Doesn't work in gitea
|
||||||
|
# workflows: [Update Repo Version]
|
||||||
|
# types:
|
||||||
|
# - completed
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v[0-9]+.[0-9]+.[0-9]+' # Push events to every tag
|
||||||
|
workflow_dispatch:
|
||||||
|
# inputs:
|
||||||
|
# version:
|
||||||
|
# type: string
|
||||||
|
# description: Version of cs-repo to deploy
|
||||||
|
# required: false
|
||||||
|
# nm-dev:
|
||||||
|
# type: boolean
|
||||||
|
# description: Deploy to dev?
|
||||||
|
# default: true
|
||||||
|
# nm-rc:
|
||||||
|
# type: boolean
|
||||||
|
# description: Deploy to rc?
|
||||||
|
# nm-prod:
|
||||||
|
# type: boolean
|
||||||
|
# description: Deploy to prod?
|
||||||
|
# env:
|
||||||
|
# description: "Env to deploy to"
|
||||||
|
# required: true
|
||||||
|
# default: "dev"
|
||||||
|
# type: choice
|
||||||
|
# options:
|
||||||
|
# - dev
|
||||||
|
# - rc
|
||||||
|
# - prod
|
||||||
|
|
||||||
|
env:
|
||||||
|
NM_ENV: nm-dev
|
||||||
|
CS_REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push-cs-update:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||||
|
# added or changed files to the repository.
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- id: read-inputs
|
||||||
|
name: Read the inputs in dispatch
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
TAG_NAME=${{ github.ref_name }}
|
||||||
|
REF_NAME=${{ github.event.ref }}
|
||||||
|
NM_ENV=${{ env.NM_ENV }}
|
||||||
|
|
||||||
|
- name: Checkout cs repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: cs
|
||||||
|
token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Checkout nm repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ env.NM_ENV }}
|
||||||
|
ref: main
|
||||||
|
path: nm
|
||||||
|
token: ${{ github.token }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Checkout deploy-tools
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: gmetribin/deploy-tools
|
||||||
|
ref: main
|
||||||
|
path: deploy-tools
|
||||||
|
token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Increment cs version in nm repo and push
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'bot-build'
|
||||||
|
git config --global user.email 'techbots+build@gmetri.com'
|
||||||
|
|
||||||
|
cd cs;
|
||||||
|
VERSION=`git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*"`;
|
||||||
|
cd ../nm;
|
||||||
|
CS_LIST=./.github/cslist.txt
|
||||||
|
|
||||||
|
pwd; ls -al;
|
||||||
|
|
||||||
|
cd nm;
|
||||||
|
../deploy-tools/src/cs_to_nm.sh -c ${{ env.CS_REPO }} -v $VERSION -k $CS_LIST;
|
||||||
|
|
||||||
|
git push origin main;
|
||||||
78
.github/unused/sh/trigger.sh
vendored
Normal file
78
.github/unused/sh/trigger.sh
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#!/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\"}"}'
|
||||||
42
.github/unused/update-repo-version.yml
vendored
42
.github/unused/update-repo-version.yml
vendored
@ -1,42 +0,0 @@
|
|||||||
name: Update Repo Version Workflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
branch:
|
|
||||||
description: "Branch getting released. (branch 'release' might update a different image)"
|
|
||||||
default: main
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
image:
|
|
||||||
description: "Name of the image"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
tag:
|
|
||||||
description: "Tag of the image"
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
|
|
||||||
env:
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
npm-push:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
permissions:
|
|
||||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
|
||||||
# added or changed files to the repository.
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Increment package version and push
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
pwd; ls -al;
|
|
||||||
echo ./drone/repo_to_cs.sh -m ${{ inputs.image }} -t ${{ inputs.tag }} -b ${{ inputs.branch }}
|
|
||||||
# git push origin main
|
|
||||||
# git push --tags origin main
|
|
||||||
149
.github/unused/v1-lint-and-build.yml
vendored
149
.github/unused/v1-lint-and-build.yml
vendored
@ -1,149 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
# on: [push]
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
DOCKER_REGISTRY: ${{ vars.docker_repo2_registry }}
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
image-vulnerability-scan:
|
|
||||||
runs-on: ubuntu-22.04 #ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- id: get-id
|
|
||||||
name: Get a unique tag for this build
|
|
||||||
run: |
|
|
||||||
SHA=${{github.sha}};
|
|
||||||
ID=${SHA:0:8};
|
|
||||||
echo "ID=$ID" >> "$GITHUB_OUTPUT";
|
|
||||||
echo "DOCKER_IMAGE=$DOCKER_REGISTRY/$REPO:temp-$ID" >> "$GITHUB_OUTPUT";
|
|
||||||
|
|
||||||
- name: Print build id and image name
|
|
||||||
run: |
|
|
||||||
echo "${{ steps.get-id.outputs.ID }}";
|
|
||||||
echo "${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to Docker Container Registry
|
|
||||||
# if: ${{ github.event_name == 'push' }}
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.docker_repo2_registry }}
|
|
||||||
username: ${{ vars.docker_repo2_username }}
|
|
||||||
password: ${{ vars.docker_repo2_password }}
|
|
||||||
|
|
||||||
- name: Build the Docker image
|
|
||||||
# Commenting this from docker build for speed: --build-arg PUBLIC_BUILD_VERSION=${{ steps.get-id.outputs.ID }} \
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--file fab/d/actions-build.Dockerfile \
|
|
||||||
--tag ${{ steps.get-id.outputs.DOCKER_IMAGE }} \
|
|
||||||
.;
|
|
||||||
|
|
||||||
- name: Scan Docker Image for vulnerabilities with Grype
|
|
||||||
uses: anchore/scan-action@v6
|
|
||||||
with:
|
|
||||||
image: ${{ steps.get-id.outputs.DOCKER_IMAGE }}
|
|
||||||
cache-db: true #Cache Grype DB in Github Actions
|
|
||||||
output-format: table
|
|
||||||
only-fixed: true
|
|
||||||
severity-cutoff: critical
|
|
||||||
fail-build: true
|
|
||||||
|
|
||||||
npm-push:
|
|
||||||
runs-on: ubuntu-22.04 #ubuntu-latest
|
|
||||||
if: ${{ github.event_name == 'push' }}
|
|
||||||
permissions:
|
|
||||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
|
||||||
# added or changed files to the repository.
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
registry-url: ${{ vars.NPM_REGISTRY }}
|
|
||||||
token: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
|
||||||
- name: Install NPM Dependencies
|
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Lint & Check
|
|
||||||
run: |
|
|
||||||
pnpm lint
|
|
||||||
pnpm check
|
|
||||||
|
|
||||||
- run: pnpm build
|
|
||||||
|
|
||||||
#If this is a merge of a pull request, GITHUB_BASE_REF will contain main.
|
|
||||||
#But if this is a direct commit on the main branch, then GITHUB_REF_NAME will contain main
|
|
||||||
- name: Increment package version and push
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
# BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'bot-build'
|
|
||||||
git config --global user.email 'techbots+build@gmetri.com'
|
|
||||||
|
|
||||||
export N=`node -p require\(\'./package.json\'\).name` && echo $N
|
|
||||||
pnpm version patch --message "v%s: $N [CI SKIP]"
|
|
||||||
|
|
||||||
git push origin
|
|
||||||
git push --tags origin
|
|
||||||
|
|
||||||
docker-build-and-push:
|
|
||||||
runs-on: ubuntu-22.04 #ubuntu-latest
|
|
||||||
# if: ${{ github.event_name == 'push' }}
|
|
||||||
steps:
|
|
||||||
- id: get-id
|
|
||||||
name: Get a unique tag for this build
|
|
||||||
run: |
|
|
||||||
SHA=${{github.sha}};
|
|
||||||
ID=${SHA:0:8};
|
|
||||||
echo "ID=$ID" >> "$GITHUB_OUTPUT";
|
|
||||||
echo "DOCKER_IMAGE=$DOCKER_REGISTRY/$REPO:$ID" >> "$GITHUB_OUTPUT";
|
|
||||||
|
|
||||||
- name: Print build id and image name
|
|
||||||
run: |
|
|
||||||
echo "${{ steps.get-id.outputs.ID }}";
|
|
||||||
echo "${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to Docker Container Registry
|
|
||||||
# if: ${{ github.event_name == 'push' }}
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.docker_repo2_registry }}
|
|
||||||
username: ${{ vars.docker_repo2_username }}
|
|
||||||
password: ${{ vars.docker_repo2_password }}
|
|
||||||
|
|
||||||
- name: Build the Docker image
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--build-arg PUBLIC_BUILD_VERSION=${{ steps.get-id.outputs.ID }} \
|
|
||||||
--file fab/d/actions-build.Dockerfile \
|
|
||||||
--tag ${{ steps.get-id.outputs.DOCKER_IMAGE }} \
|
|
||||||
.;
|
|
||||||
IMAGE_SIZE=`docker inspect -f "{{ .Size }}" ${{ steps.get-id.outputs.DOCKER_IMAGE }} | numfmt --to=si`;
|
|
||||||
echo "Image size $IMAGE_SIZE";
|
|
||||||
|
|
||||||
- name: Push the Docker image
|
|
||||||
if: ${{ github.event_name == 'push' }}
|
|
||||||
run: |
|
|
||||||
docker push ${{ steps.get-id.outputs.DOCKER_IMAGE }};
|
|
||||||
IMAGE_SIZE=`docker inspect -f "{{ .Size }}" ${{ steps.get-id.outputs.DOCKER_IMAGE }} | numfmt --to=si`;
|
|
||||||
echo "Pushed $IMAGE_SIZE image ${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
80
.github/unused/v2-pr-workflow.yml
vendored
80
.github/unused/v2-pr-workflow.yml
vendored
@ -1,80 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
REPO: ${{ github.repository }}/temp #Add /temp for PR workflow
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
lint-and-compile:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
registry-url: ${{ vars.NPM_REGISTRY }}
|
|
||||||
token: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
|
||||||
- name: Install npm dependencies
|
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- run: pnpm lint
|
|
||||||
- run: pnpm check
|
|
||||||
|
|
||||||
image-vulnerability-scan:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- id: get-id
|
|
||||||
name: Get a unique tag for this build
|
|
||||||
run: |
|
|
||||||
SHA=${{ github.sha }}; BRANCH_NAME=${{ github.base_ref || github.ref_name }};
|
|
||||||
BUILD_ID=$BRANCH_NAME-${SHA:0:8};
|
|
||||||
DOCKER_IMAGE=${{ vars.docker_repo2_registry }}/$REPO:$BUILD_ID;
|
|
||||||
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
|
|
||||||
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> "$GITHUB_OUTPUT";
|
|
||||||
|
|
||||||
- name: Print build id and image name
|
|
||||||
run: |
|
|
||||||
echo "BUILD_ID: ${{ steps.get-id.outputs.BUILD_ID }}";
|
|
||||||
echo "DOCKER_IMAGE: ${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to docker container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.docker_repo2_registry }}
|
|
||||||
username: ${{ vars.docker_repo2_username }}
|
|
||||||
password: ${{ vars.docker_repo2_password }}
|
|
||||||
|
|
||||||
- name: Build the container image (quick, without PUBLIC_BUILD_VERSION)
|
|
||||||
# Commenting this from docker build for speed: --build-arg PUBLIC_BUILD_VERSION=${{ steps.get-id.outputs.BUILD_ID }} \
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--file fab/d/actions-build.Dockerfile \
|
|
||||||
--tag ${{ steps.get-id.outputs.DOCKER_IMAGE }} \
|
|
||||||
.;
|
|
||||||
|
|
||||||
- name: Container details
|
|
||||||
run: |
|
|
||||||
IMAGE_SIZE=`docker inspect -f "{{ .Size }}" ${{ steps.get-id.outputs.DOCKER_IMAGE }} | numfmt --to=si`;
|
|
||||||
echo "$IMAGE_SIZE container ${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
|
|
||||||
- name: Scan container image for vulnerabilities with grype
|
|
||||||
uses: anchore/scan-action@v6
|
|
||||||
with:
|
|
||||||
image: ${{ steps.get-id.outputs.DOCKER_IMAGE }}
|
|
||||||
cache-db: true #Cache Grype DB in Github Actions
|
|
||||||
output-format: table
|
|
||||||
only-fixed: true
|
|
||||||
severity-cutoff: critical
|
|
||||||
fail-build: true
|
|
||||||
91
.github/unused/v2-push-workflow.yml
vendored
91
.github/unused/v2-push-workflow.yml
vendored
@ -1,91 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
env:
|
|
||||||
REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
npm-push:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
permissions:
|
|
||||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
|
||||||
# added or changed files to the repository.
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
registry-url: ${{ vars.NPM_REGISTRY }}
|
|
||||||
token: ${{ secrets.NPM_TOKEN }}
|
|
||||||
|
|
||||||
- name: Install npm dependencies
|
|
||||||
run: |
|
|
||||||
npm install -g pnpm
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- run: pnpm build
|
|
||||||
|
|
||||||
- name: Increment package version and push
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
git config --global user.name 'bot-build'
|
|
||||||
git config --global user.email 'techbots+build@gmetri.com'
|
|
||||||
|
|
||||||
export N=`node -p require\(\'./package.json\'\).name` && echo $N
|
|
||||||
pnpm version patch --message "v%s: $N [CI SKIP]"
|
|
||||||
|
|
||||||
npm publish
|
|
||||||
|
|
||||||
git push origin
|
|
||||||
git push --tags origin
|
|
||||||
|
|
||||||
container-push:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- id: get-id
|
|
||||||
name: Get a unique tag for this build
|
|
||||||
run: |
|
|
||||||
SHA=${{ github.sha }}; BRANCH_NAME=${{ github.base_ref || github.ref_name }};
|
|
||||||
BUILD_ID=$BRANCH_NAME-${SHA:0:8};
|
|
||||||
DOCKER_IMAGE=${{ vars.docker_repo2_registry }}/$REPO:$BUILD_ID;
|
|
||||||
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
|
|
||||||
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> "$GITHUB_OUTPUT";
|
|
||||||
|
|
||||||
- name: Print build id and image name
|
|
||||||
run: |
|
|
||||||
echo "BUILD_ID: ${{ steps.get-id.outputs.BUILD_ID }}";
|
|
||||||
echo "DOCKER_IMAGE: ${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to docker container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.docker_repo2_registry }}
|
|
||||||
username: ${{ vars.docker_repo2_username }}
|
|
||||||
password: ${{ vars.docker_repo2_password }}
|
|
||||||
|
|
||||||
- name: Build the container image
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--build-arg PUBLIC_BUILD_VERSION=${{ steps.get-id.outputs.BUILD_ID }} \
|
|
||||||
--file fab/d/actions-build.Dockerfile \
|
|
||||||
--tag ${{ steps.get-id.outputs.DOCKER_IMAGE }} \
|
|
||||||
.;
|
|
||||||
|
|
||||||
- name: Container details
|
|
||||||
run: |
|
|
||||||
IMAGE_SIZE=`docker inspect -f "{{ .Size }}" ${{ steps.get-id.outputs.DOCKER_IMAGE }} | numfmt --to=si`;
|
|
||||||
echo "$IMAGE_SIZE container ${{ steps.get-id.outputs.DOCKER_IMAGE }}";
|
|
||||||
|
|
||||||
- name: Push the container image
|
|
||||||
run: docker push ${{ steps.get-id.outputs.DOCKER_IMAGE }}
|
|
||||||
38
.github/unused/workflow_inputs.yml
vendored
38
.github/unused/workflow_inputs.yml
vendored
@ -1,38 +0,0 @@
|
|||||||
# Inputs with workflow_call (triggering from another workflow):
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
username:
|
|
||||||
description: 'A username passed from the caller workflow'
|
|
||||||
default: 'john-doe'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
print-username:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Print the input name to STDOUT
|
|
||||||
run: echo The username is ${{ inputs.username }}
|
|
||||||
|
|
||||||
|
|
||||||
# Inputs with workflow_dispatch (manual trigger):
|
|
||||||
name: Update Repo Version Workflow
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
name:
|
|
||||||
type: choice
|
|
||||||
description: Who to greet
|
|
||||||
options:
|
|
||||||
- monalisa
|
|
||||||
- cschleiden
|
|
||||||
message:
|
|
||||||
required: true
|
|
||||||
use-emoji:
|
|
||||||
type: boolean
|
|
||||||
description: Include 🎉🤣 emojis
|
|
||||||
environment:
|
|
||||||
type: environment
|
|
||||||
62
.github/workflows/cs-update-push.yml
vendored
62
.github/workflows/cs-update-push.yml
vendored
@ -2,10 +2,13 @@ name: Update Repo Version Workflow
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
secrets:
|
||||||
|
bot_build_repo_token:
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
push-cs-update:
|
cs-update-push:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
permissions:
|
permissions:
|
||||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||||
@ -18,41 +21,66 @@ 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 -r ".tag"`
|
||||||
BUILD_ID=`echo $ISSUE_COMMENT_STRING | jq ".tag"`
|
REPO=`echo $ISSUE_COMMENT_STRING | jq -r ".repo"`
|
||||||
echo "DOCKER_BASE=$DOCKER_BASE" >> "$GITHUB_OUTPUT";
|
SENDER=`echo $ISSUE_COMMENT_STRING | jq -r ".sender"`
|
||||||
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 "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 }}";
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout cs repo
|
||||||
|
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
|
||||||
|
#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 }}
|
||||||
repository: gmetribin/deploy-tools
|
repository: gmetribin/deploy-tools
|
||||||
ref: main
|
ref: v1.1.42
|
||||||
path: deploy-tools
|
path: deploy-tools
|
||||||
token: ${{ github.token }}
|
# 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
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
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'
|
||||||
|
|
||||||
BUILD_ID=${{ steps.read-issue.outputs.BUILD_ID }}
|
TAG=${{ steps.read-issue.outputs.TAG }}
|
||||||
DOCKER_BASE=${{ steps.read-issue.outputs.DOCKER_BASE }}
|
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
|
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
|
../deploy-tools/src/repo_to_cs.sh -m $DOCKER_REPO -t $TAG -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,9 +9,10 @@ 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:
|
||||||
env:
|
description: 'The name of the action variable containing the docker repo value'
|
||||||
REPO: ${{ github.repository }}
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
trigger-cs-job:
|
trigger-cs-job:
|
||||||
@ -24,33 +25,35 @@ 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 }}/$REPO
|
REPO=${{ github.repository }};
|
||||||
DOCKER_IMAGE=$DOCKER_BASE:$BUILD_ID;
|
echo "REPO=$REPO" >> "$GITHUB_OUTPUT";
|
||||||
echo "BUILD_ID=$BUILD_ID" >> "$GITHUB_OUTPUT";
|
echo "TAG=$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 tag
|
||||||
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 issue#1
|
- 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`
|
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
|
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/1/comments' \
|
'${{ github.api_url }}/repos/${{ inputs.deploy_repo }}/issues/'$ISSUE_NUMBER'/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
|
||||||
|
|
||||||
|
|||||||
82
.github/workflows/nm-update.yml
vendored
Normal file
82
.github/workflows/nm-update.yml
vendored
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
name: Deploy to an environment
|
||||||
|
run-name: Deploying ${{ github.ref_name }} to ${{ github.event.inputs.env || 'dev' }}
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
secrets:
|
||||||
|
bot_build_repo_token:
|
||||||
|
required: true
|
||||||
|
inputs:
|
||||||
|
nm_repo:
|
||||||
|
description: 'The nm repo to be deployed'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
# workflow_run: Doesn't work in gitea
|
||||||
|
# workflows: [Update Repo Version]
|
||||||
|
# types:
|
||||||
|
# - completed
|
||||||
|
# push:
|
||||||
|
# tags:
|
||||||
|
# - 'v[0-9]+.[0-9]+.[0-9]+' # Push events on every tag
|
||||||
|
# workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
CS_REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
nm-update:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
|
permissions:
|
||||||
|
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||||
|
# added or changed files to the repository.
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- id: read-inputs
|
||||||
|
name: Read the inputs in dispatch
|
||||||
|
run: |
|
||||||
|
set -x
|
||||||
|
TAG_NAME=${{ github.ref_name }}
|
||||||
|
REF_NAME=${{ github.event.ref }}
|
||||||
|
nm_repo=${{ inputs.nm_repo }}
|
||||||
|
|
||||||
|
- name: Checkout cs repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
path: cs
|
||||||
|
|
||||||
|
- name: Checkout nm repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
github-server-url: ${{ github.server_url }}
|
||||||
|
repository: ${{ inputs.nm_repo }}
|
||||||
|
ref: main
|
||||||
|
path: nm
|
||||||
|
token: ${{ secrets.bot_build_repo_token }} #This is because we want to trigger a new build
|
||||||
|
# token: $\{{ github.token }} # DEFAULT / Any pushes with github.token don't trigger a chained build
|
||||||
|
|
||||||
|
- name: Checkout deploy-tools
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
github-server-url: ${{ github.server_url }}
|
||||||
|
repository: gmetribin/deploy-tools
|
||||||
|
ref: v1.1.42
|
||||||
|
path: deploy-tools
|
||||||
|
|
||||||
|
- name: Increment cs version in nm repo and push
|
||||||
|
run: |
|
||||||
|
git config --global user.name 'bot-build'
|
||||||
|
git config --global user.email 'techbots+build@gmetri.com'
|
||||||
|
|
||||||
|
pwd; ls -al;
|
||||||
|
cd cs;
|
||||||
|
VERSION=`git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*"`;
|
||||||
|
cd ..;
|
||||||
|
|
||||||
|
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/build-state.yml
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
.idea/
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
# deploy-tools
|
# deploy-tools
|
||||||
|
|
||||||
Tools to deploy images
|
Tools to deploy images
|
||||||
|
|||||||
14
basetag.sh
14
basetag.sh
@ -1,20 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
## Creating new releases
|
# #For a fresh repo / Creating new releases
|
||||||
|
|
||||||
# git add -A;
|
# git add -A;
|
||||||
# git commit -m "<commit msg>"
|
# git commit -m "<commit msg>"
|
||||||
# #Minor version
|
# #Setting a tag
|
||||||
# git tag -a -m "<tag msg>" v1.0.1
|
# git tag -a -m "<tag msg>" v1.0.0
|
||||||
# git push --follow-tags
|
# git push --follow-tags
|
||||||
# #Moving major version
|
# #Moving a tag (eg: for major version retagging)
|
||||||
# git tag -fa v1
|
# git tag -fa v1
|
||||||
# git push --tags -f
|
# git push --tags -f
|
||||||
|
|
||||||
# https://gist.github.com/CSTDev/08c127680e3b5fae38c051da3e489351
|
# Based on https://gist.github.com/CSTDev/08c127680e3b5fae38c051da3e489351
|
||||||
|
# Commit with a log containing #minor or #major to increment the respective version number
|
||||||
|
|
||||||
#get highest tag number containing at least 2 dots
|
#get highest tag number containing at least 2 dots
|
||||||
VERSION=`git describe --abbrev=0 --tags --match="v[0-9]*\.*\.*"`
|
VERSION=`git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*"`
|
||||||
|
|
||||||
#replace . with space so can split into an array
|
#replace . with space so can split into an array
|
||||||
VERSION_BITS=(${VERSION//./ })
|
VERSION_BITS=(${VERSION//./ })
|
||||||
|
|||||||
67
src/cs_to_nm.sh
Executable file
67
src/cs_to_nm.sh
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Updates the nm repo's cs version
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "usage: $0 [-c cs-repo -v version -k kustomization_list] | [-h]"
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
local CS_REPO_NAME=$1
|
||||||
|
local VERSION=$2
|
||||||
|
local CSLIST_PATH=$3 #"./.github/cslist.txt"
|
||||||
|
|
||||||
|
#Get list of repos from cslist.txt
|
||||||
|
# Example lines in file:
|
||||||
|
#cs-brx mat81-dev/brx/brx-2jitsi/kustomization.yaml cs-brx.git\/\/brx\/brx-2jitsi?ref=
|
||||||
|
#cs-brx mat81-dev/brx/brx-3main/kustomization.yaml cs-brx.git\/\/brx\/brx-3main?ref=
|
||||||
|
|
||||||
|
CSLIST=$(cat $CSLIST_PATH | grep ^$CS_REPO_NAME | tr -s " " | awk -v FS=' ' -v OFS='\t' '/^[^#]/' )
|
||||||
|
echo "$CSLIST" #doublequote preserves the shape of the input variable, including endlines
|
||||||
|
if [ -z "$CSLIST" ]
|
||||||
|
then
|
||||||
|
echo "Nothing to update";
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
#If we use a for loop, it iterates over spaces too instead of just endlines
|
||||||
|
while IFS= read -r CSLIST_LINE; do
|
||||||
|
KUST_PATH=$(echo $CSLIST_LINE | tr -s " " | cut -d " " -f 2)
|
||||||
|
SEARCH_STRING=$(echo $CSLIST_LINE | tr -s " " | cut -d " " -f 3)
|
||||||
|
#Replace repo version in kustomization.yaml
|
||||||
|
echo 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
|
||||||
|
done <<< "$CSLIST"
|
||||||
|
}
|
||||||
|
|
||||||
|
### Starts here
|
||||||
|
while [ "$1" != "" ]; do
|
||||||
|
case $1 in
|
||||||
|
-c | --cs-repo ) shift
|
||||||
|
CS_REPO_NAME=$1
|
||||||
|
;;
|
||||||
|
-v | --version ) shift
|
||||||
|
VERSION=$1
|
||||||
|
;;
|
||||||
|
-k | --kustomization_list ) shift
|
||||||
|
CSLIST_PATH=$1
|
||||||
|
;;
|
||||||
|
-h | --help ) usage
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
* ) usage
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $CS_REPO_NAME || -z $VERSION || -z $CSLIST_PATH ]]
|
||||||
|
then
|
||||||
|
echo "Not enough arguments"
|
||||||
|
usage
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
main "$CS_REPO_NAME" "$VERSION" "$CSLIST_PATH"
|
||||||
@ -1,4 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
echo "Script directory: $SCRIPT_DIR"
|
||||||
|
|
||||||
### Functions
|
### Functions
|
||||||
usage()
|
usage()
|
||||||
@ -9,7 +11,7 @@ usage()
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
local IMAGE=$1
|
local IMAGE=$1
|
||||||
local TAG=$2
|
local IMAGE_TAG=$2
|
||||||
local REPOLIST=$3
|
local REPOLIST=$3
|
||||||
|
|
||||||
KUST_FILES_LINES=$(grep -e "$IMAGE\s" $REPOLIST)
|
KUST_FILES_LINES=$(grep -e "$IMAGE\s" $REPOLIST)
|
||||||
@ -29,22 +31,20 @@ main()
|
|||||||
#Replace repo verion in kustomization.yaml. -n is true only if the following argument is non empty
|
#Replace repo verion in kustomization.yaml. -n is true only if the following argument is non empty
|
||||||
if [ -n "$LINE_N2" ]
|
if [ -n "$LINE_N2" ]
|
||||||
then
|
then
|
||||||
echo "Replacement Op: sed -i -e \"${LINE_N2}s/newTag: .*/newTag: ${TAG}/\" \"$KUST_PATH\""
|
echo "Replacement Op: sed -i -e \"${LINE_N2}s/newTag: .*/newTag: ${IMAGE_TAG}/\" \"$KUST_PATH\""
|
||||||
sed -i -e "${LINE_N2}s/newTag: .*/newTag: ${TAG}/" "$KUST_PATH"
|
sed -i -e "${LINE_N2}s/newTag: .*/newTag: ${IMAGE_TAG}/" "$KUST_PATH"
|
||||||
|
|
||||||
git add $KUST_PATH;
|
git add $KUST_PATH;
|
||||||
fi
|
fi
|
||||||
done <<< "$KUST_FILES_LINES"
|
done <<< "$KUST_FILES_LINES"
|
||||||
|
|
||||||
VER=$(cat version)
|
source $SCRIPT_DIR/repo_to_cs_basetag.sh;
|
||||||
NEW_VER=$(./drone/increment_semver.sh -p $VER)
|
|
||||||
echo "$NEW_VER" > version
|
|
||||||
CS_REPO_NAME=`node -p require\(\'./package.json\'\).name`
|
|
||||||
|
|
||||||
git add version
|
echo "NEW_TAG: $NEW_TAG"
|
||||||
git commit -m "$NEW_VER: $IMAGE updated to $TAG [CI SKIP]"
|
COMMIT_MESSAGE="$NEW_TAG: $REPO to $IMAGE_TAG by $SENDER";
|
||||||
git tag -a $NEW_VER -m "$NEW_VER: $IMAGE updated to $TAG [CI SKIP]"
|
|
||||||
|
|
||||||
|
git commit -m "$COMMIT_MESSAGE"
|
||||||
|
git tag -a $NEW_TAG -m "$COMMIT_MESSAGE"
|
||||||
}
|
}
|
||||||
|
|
||||||
### Starts here
|
### Starts here
|
||||||
@ -54,7 +54,7 @@ while [ "$1" != "" ]; do
|
|||||||
IMAGE=$1
|
IMAGE=$1
|
||||||
;;
|
;;
|
||||||
-t | --tag ) shift
|
-t | --tag ) shift
|
||||||
TAG=$1
|
IMAGE_TAG=$1
|
||||||
;;
|
;;
|
||||||
-r | --repolist ) shift
|
-r | --repolist ) shift
|
||||||
REPOLIST=$1
|
REPOLIST=$1
|
||||||
@ -68,11 +68,11 @@ while [ "$1" != "" ]; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z $IMAGE || -z $TAG || -z $REPOLIST ]]
|
if [[ -z $IMAGE || -z $IMAGE_TAG || -z $REPOLIST ]]
|
||||||
then
|
then
|
||||||
echo "Not enough arguments"
|
echo "Not enough arguments"
|
||||||
usage
|
usage
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
main "$IMAGE" "$TAG" "$REPOLIST"
|
main "$IMAGE" "$IMAGE_TAG" "$REPOLIST"
|
||||||
|
|||||||
63
src/repo_to_cs_basetag.sh
Executable file
63
src/repo_to_cs_basetag.sh
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# #For a fresh repo / Creating new releases
|
||||||
|
# git add -A;
|
||||||
|
# git commit -m "<commit msg>"
|
||||||
|
# #Setting a tag
|
||||||
|
# git tag -a -m "<tag msg>" v1.0.0
|
||||||
|
# git push --follow-tags
|
||||||
|
# #Moving a tag (eg: for major version retagging)
|
||||||
|
# git tag -fa v1
|
||||||
|
# git push --tags -f
|
||||||
|
|
||||||
|
# Based on https://gist.github.com/CSTDev/08c127680e3b5fae38c051da3e489351
|
||||||
|
# Commit with a log containing #minor or #major to increment the respective version number
|
||||||
|
|
||||||
|
#get highest tag number containing at least 2 dots
|
||||||
|
VERSION=`git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*"`
|
||||||
|
|
||||||
|
#replace . with space so can split into an array
|
||||||
|
VERSION_BITS=(${VERSION//./ })
|
||||||
|
|
||||||
|
#get number parts and increase last one by 1
|
||||||
|
VNUM1=${VERSION_BITS[0]}
|
||||||
|
VNUM2=${VERSION_BITS[1]}
|
||||||
|
VNUM3=${VERSION_BITS[2]}
|
||||||
|
VNUM1=`echo $VNUM1 | sed 's/v//'`
|
||||||
|
|
||||||
|
# Check for #major or #minor in commit message and increment the relevant version number
|
||||||
|
MAJOR=`git log --format=%B -n 1 HEAD | grep '#major'`
|
||||||
|
MINOR=`git log --format=%B -n 1 HEAD | grep '#minor'`
|
||||||
|
|
||||||
|
if [ "$MAJOR" ]; then
|
||||||
|
echo "Update major version"
|
||||||
|
VNUM1=$((VNUM1+1))
|
||||||
|
VNUM2=0
|
||||||
|
VNUM3=0
|
||||||
|
elif [ "$MINOR" ]; then
|
||||||
|
echo "Update minor version"
|
||||||
|
VNUM2=$((VNUM2+1))
|
||||||
|
VNUM3=0
|
||||||
|
else
|
||||||
|
echo "Update patch version"
|
||||||
|
VNUM3=$((VNUM3+1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#create new tag
|
||||||
|
NEW_TAG="v$VNUM1.$VNUM2.$VNUM3"
|
||||||
|
|
||||||
|
# echo "Updating $VERSION to $NEW_TAG"
|
||||||
|
|
||||||
|
# #get current hash and see if it already has a tag
|
||||||
|
# GIT_COMMIT=`git rev-parse HEAD`
|
||||||
|
# NEEDS_TAG=`git describe --contains $GIT_COMMIT`
|
||||||
|
|
||||||
|
# #only tag if no tag already (would be better if the git describe command above could have a silent option)
|
||||||
|
# if [ -z "$NEEDS_TAG" ]; then
|
||||||
|
# echo "Tagged with $NEW_TAG (Ignoring fatal:cannot describe - this means commit is untagged) "
|
||||||
|
# git tag $NEW_TAG
|
||||||
|
# git push --tags
|
||||||
|
# else
|
||||||
|
# echo "Already a tag on this commit"
|
||||||
|
# fi
|
||||||
Loading…
x
Reference in New Issue
Block a user