Jaypore CI

> Jaypore CI: Minimal, Offline, Local CI system.
Log | Files | Refs | README

commit 74d840a16756756ff87890f614020c1a440abf39
parent 4a48ddde792719d0d06e72d53bec18790bd81660
Author: arjoonn <arjoonn@noreply.localhost>
Date:   Wed,  8 Feb 2023 18:12:59 +0000

In pre-push check if env is set in hook call and then source from secrets (!37)

Branch auto created by JayporeCI

```jayporeci
╔ 🟢 : JayporeCI       [sha 9d0df7fb87]
┏━ build_and_test
┃
┃ 🟢 : JciEnv          [60c79539]   1:35
┃ 🟢 : Jci             [452905d4]   0:20       ❮-- ['JciEnv']
┃ 🟢 : black           [9d8fa855]   0: 1       ❮-- ['JciEnv']
┃ 🟢 : pylint          [22dca54a]   0:17       ❮-- ['JciEnv']
┃ 🟢 : pytest          [a598b741]   0: 5 65%   ❮-- ['JciEnv']
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Publish
┃
┃ 🟢 : DockerHubJci    [c3c1ff05]   1:22
┃ 🟢 : DockerHubJcienv [53a5390f]   0:53
┃ 🟢 : PublishDocs     [01f5c4c7]   0:41
┃ 🟢 : PublishPypi     [a0a51be6]   0:10
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
```

Co-authored-by: arjoonn sharma <arjoonn@midpathsoftware.com>
Reviewed-on: https://gitea.midpathsoftware.com/midpath/jaypore_ci/pulls/37

Diffstat:
Mcicd/pre-push.sh | 9+++++++--
Mpyproject.toml | 2+-
Msetup.sh | 4+++-
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/cicd/pre-push.sh b/cicd/pre-push.sh @@ -6,7 +6,12 @@ set -o pipefail run() { - source /jaypore_ci/repo/secrets/bin/set_env.sh ci + if [ -z ${ENV+x} ]; then + echo "ENV : ? -> SKIP sourcing from secrets." + else + echo "ENV : '$ENV' -> Sourcing from secrets" + source /jaypore_ci/repo/secrets/bin/set_env.sh $ENV + fi cp -r /jaypore_ci/repo/. /jaypore_ci/run cd /jaypore_ci/run/ git clean -fdx @@ -38,7 +43,7 @@ hook() { -v /tmp/jayporeci__src__$SHA:/jaypore_ci/run \ --workdir /jaypore_ci/run \ arjoonn/jci:latest \ - bash -c "bash /jaypore_ci/repo/$JAYPORE_CODE_DIR/pre-push.sh run" + bash -c "ENV=$ENV bash /jaypore_ci/repo/$JAYPORE_CODE_DIR/pre-push.sh run" echo '----------------------------------------------' } ("$@") diff --git a/pyproject.toml b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jaypore_ci" -version = "0.2.5" +version = "0.2.6" description = "" authors = ["arjoonn sharma <arjoonn.94@gmail.com>"] diff --git a/setup.sh b/setup.sh @@ -30,6 +30,7 @@ EOF curl -s https://www.jayporeci.in/pre-push.sh -o $REPO_ROOT/cicd/pre-push.sh chmod u+x $REPO_ROOT/cicd/pre-push.sh # ----------------<<<<<<<<<<<<< + ENV_PREFIX='' read -r -p "Do you want to create 'secrets' folder for environment variables? [Y/n] " response if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]] then @@ -60,6 +61,7 @@ EOF then (bash $REPO_ROOT/secrets/bin/edit_env.sh ci) fi + ENV_PREFIX='ENV=ci ' fi # ----------------<<<<<<<<<<<<< echo "Creating git hook for pre-push" @@ -82,7 +84,7 @@ EOF echo "$REPO_ROOT/.git/hooks/pre-push.old" >> $REPO_ROOT/.git/hooks/pre-push fi fi - echo "$REPO_ROOT/cicd/pre-push.sh hook" >> $REPO_ROOT/.git/hooks/pre-push + echo "$ENV_PREFIX$REPO_ROOT/cicd/pre-push.sh hook" >> $REPO_ROOT/.git/hooks/pre-push chmod u+x $LOCAL_HOOK } (main)