Jaypore CI

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

commit 6dc4781170065d0aee57601e63ce7178c44af6d1
parent e7749d1fe71586ae52f56d82d4ab511303da52f3
Author: arjoonn <arjoonn@noreply.localhost>
Date:   Thu, 29 Dec 2022 08:47:11 +0000

pypi_package (!17)

Branch auto created by JayporeCI

<details>
    <summary>JayporeCi: 🔴 8f42bf8d32</summary>

```mermaid
flowchart TB

            subgraph Pipeline
                direction TB

            end

            subgraph Docker
                direction TB

                s_Docker(( )) -.-> Docker_0(Jci):::passed
                s_Docker(( )) -.-> Docker_1(JciEnv):::passed
            end

            subgraph Jobs
                direction TB

                s_Jobs(( )) -.-> Jobs_0(black):::passed
                s_Jobs(( )) -.-> Jobs_1(pytest):::passed
                s_Jobs(( )) -.-> Jobs_2(pylint):::passed
            end

            subgraph Publish
                direction TB

                s_Publish(( )) -.-> Publish_0(PublishPypi):::failed
                s_Publish(( )) -.-> Publish_1(DockerHubJci):::failed
                s_Publish(( )) -.-> Publish_2(DockerHubJcienv):::failed
                s_Publish(( )) -.-> Publish_3(PublishDocs):::failed
            end

            Pipeline ---> Docker

            Docker ---> Jobs

            Jobs ---> Publish

            classDef pending fill:#aaa, color:black, stroke:black,stroke-width:2px,stroke-dasharray: 5 5;
            classDef skipped fill:#aaa, color:black, stroke:black,stroke-width:2px;
            classDef assigned fill:#ddd, color:black, stroke:black,stroke-width:2px;
            classDef running fill:#bae1ff,color:black,stroke:black,stroke-width:2px,stroke-dasharray: 5 5;
            classDef passed fill:#88d8b0, color:black, stroke:black;
            classDef failed fill:#ff6f69, color:black, stroke:black;
            classDef timeout fill:#ffda9e, color:black, stroke:black;
```

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

Diffstat:
M.gitignore | 1+
Acicd/build_and_push_pypi.sh | 12++++++++++++
Mcicd/cicd.py | 3++-
Asecrets/edit_env.sh | 38++++++++++++++++++++++++++++++++++++++
Msecrets/jaypore_ci.enc | 15++++++++-------
5 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ *.pyc *.env *.age +dist/ diff --git a/cicd/build_and_push_pypi.sh b/cicd/build_and_push_pypi.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +main() { + poetry build + poetry config pypi-token.pypi $PYPI_TOKEN + poetry publish +} +(main) diff --git a/cicd/cicd.py b/cicd/cicd.py @@ -7,10 +7,11 @@ with jci.Pipeline() as p: p.job("JciEnv", f"docker build --target jcienv -t jcienv:{p.remote.sha} .") p.job("Jci", f"docker build --target jci -t jci:{p.remote.sha} .") with p.stage("Jobs", image=jcienv): - p.job("PublishDocs", f"bash cicd/build_and_publish_docs.sh {p.remote.branch}") p.job("black", "python3 -m black --check .") p.job("pylint", "python3 -m pylint jaypore_ci/ tests/") p.job("pytest", "python3 -m pytest tests/") with p.stage("Publish", image=jcienv): p.job("DockerHubJcienv", "bash cicd/build_and_push_docker.sh jcienv") p.job("DockerHubJci", "bash cicd/build_and_push_docker.sh jci") + p.job("PublishDocs", f"bash cicd/build_and_publish_docs.sh {p.remote.branch}") + p.job("PublishPypi", "bash cicd/build_and_push_pypi.sh") diff --git a/secrets/edit_env.sh b/secrets/edit_env.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -o errexit +set -o pipefail + +main (){ + NAME=$1 + SOPS_AGE_KEY_FILE=secrets/$NAME.age sops --decrypt --input-type dotenv --output-type dotenv secrets/$NAME.enc > secrets/$NAME.env + vim secrets/$NAME.env + sops --encrypt --age $(age-keygen -y secrets/$NAME.age) secrets/$NAME.env > secrets/$NAME.enc + rm secrets/$NAME.env +} + +help_message (){ + + echo " + Easily edit env files. + Make sure you have age keys available in + + ~/.ssh/smaac/agekeys/<envname>.txt + + If that is available you can run the following to edit env files. + + ./api/bin/edit_env.sh <envname> + + Upon exiting the editor the file will be re-encrypted. + " +} + +if [[ $1 == "--help" || $1 == "-h" ]]; then + help_message + exit 0 +fi +if [ -z $1 ]; then + help_message + exit 0 +fi +(main $1) diff --git a/secrets/jaypore_ci.enc b/secrets/jaypore_ci.enc @@ -1,10 +1,11 @@ -DOCKER_USER=ENC[AES256_GCM,data:kodwp9BekQ==,iv:4kxwikp9m8obe3Hb1MCLdDOGga1VUnqxLPU4E6s25D4=,tag:XaRuNYq8k9QNlQ/Ftq4Atg==,type:str] -DOCKER_PWD=ENC[AES256_GCM,data:GViemE/cvlOfMdmeDdqaM83J5E5fs590KIftj5Ul3QBafTQ+,iv:bIizRqtgXS4IY7Ml01etoQ01UvV5Efkicz2epTTlcNI=,tag:DHkC4pOimYL3siMgAbkyRg==,type:str] -NETLIFY_TOKEN=ENC[AES256_GCM,data:h1yMdRv4ps+hstSCiLN388g/vq6VwYIsXT8C0Uxq7n5bA04syWosivoj1g==,iv:+m20LBp2NqzQ/EOdTXRLTe76N5kdMTqgGcuZ9QsCiL4=,tag:b7Kew1KQ6PfCIWZLvVF/9Q==,type:str] -NETLIFY_SITEID=ENC[AES256_GCM,data:lr2RcnMdHKsXTWfwhx5VM0n9hiCF2MaezajRJRjYtmD8ILFY,iv:cHyNXTYZ7nW+JAvp29jncf6GWmCHN0obJvihoYQYHic=,tag:1618mQjs7CMFfwhLvaVQ0Q==,type:str] -sops_mac=ENC[AES256_GCM,data:FIMFiy2ZQHmi/8WS+4etoiQhEFgXoGlPIUY14icexxxj2GdkGth3suDLFdQ5x92Jnq5quBkz52qQmE56fO/coIYoBCR2rZzaEmu68gDRlsfUv48vMTIHueAvN/DaEiyFwpGcg4HWoZNirbciCDyI3HBK8/C4/IpWb/arwrrNIKY=,iv:InPgDMxTdZigJN/T3TsqvQoUuBMYalAovP2dT5a7Fx8=,tag:3agYFIaLQTtr3QOPzDNdww==,type:str] +DOCKER_USER=ENC[AES256_GCM,data:2CaivUehNQ==,iv:OX1kGJMcZCPWL7prJOWWXyGdWCeH8PRUgaArQAM8Kp4=,tag:n+a5xU8wKoJ2isWPKl/g7A==,type:str] +DOCKER_PWD=ENC[AES256_GCM,data:WeQDNLJVNDBWitxhUtFCvXSVcn8PVVGjUgGAm8NxOwp85j6m,iv:2SKkjTxI7rAMUfzO2KHBKXDuq+Ud3ofVHZxOc7/6k8s=,tag:Gvg+HvARWPjMymHKg0gYOQ==,type:str] +NETLIFY_TOKEN=ENC[AES256_GCM,data:Th0pfcRKpVVbpELSties8KTpsHbZ8t8u6+XeIgunYcEKPluOxvfMOHglAQ==,iv:X9mfiz/gl9UIT1NBv/nW8VMr/pUK2ZKxjlyktpluyTo=,tag:5ykXSWGKa4Tyox8pxQZQTg==,type:str] +NETLIFY_SITEID=ENC[AES256_GCM,data:mRF8fNJ1OkRguScHQdc6REbb+4wBYEA0Plm42FNqsyyGMP2P,iv:PACpEvLBgPEZ+cy9AgHteeKXLLSM8svAM532guKGkGc=,tag:n24uq0hPVdrsDBQi0Qz58Q==,type:str] +PYPI_TOKEN=ENC[AES256_GCM,data:Xs11z/CmeZublROuasDem9brzTVIH0lIvzcBzXVt/qWyuon0jAwin37R4ZlFGkaFWDuMOlgk0imZsNsUzPxviLI7DB7da/lFekHIqdRt/zHvvsSIE3e+lISUTN53iZRSzQNs1XL07Bot/OcyENnusY2TOJkFdpeg27vC31w2dnBQOfiW9zdn6m+OLRDXfhJ1es0P7T1J5Csb5jZEsDU5pTfZZbGfrO9K5JTf+Z3xVEkn9H5FGUifO6dW+VsW9Mi3hmtZBmc8UeXadIaV8o0GxxE=,iv:ezGLQtkEm/IiY77jV78aZoB7Sr2zK5ZIxSgkmM+ISts=,tag:zLggPvtH3uS5bmf5fZty1A==,type:str] sops_version=3.7.3 sops_age__list_0__map_recipient=age1u0zd477nnqqausg4vtxl3laxz73t5tgt9qw8enmpeeadcmes3eusw3v3m9 -sops_age__list_0__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAvSzl4T2NhRFl3d2xDZkxE\nUk5lMlBtemV5UXVGMkxCbE1ma3JBbDJWcWdnCmlRejRqbUFJTnVPWVF2dUh1TThk\nZnVvWjBjTXNHTUpRd2NxU2pXVkVqQzgKLS0tIFcyNmhkbE5SazQvZ01nZ2dlcklX\ndVh5NkFuZkx3enV2Y3hFMUxmMzJhUVkKy6VXe+51BaDRN8I0KsyaviseaHSCInMY\nxMxiKM8zcs39OAv7VAkQZ6O6lhBi0digoqYMOYxPykzE7U9MfTE2aA==\n-----END AGE ENCRYPTED FILE-----\n -sops_lastmodified=2022-12-23T06:01:23Z +sops_age__list_0__map_enc=-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB1VW9NdUtUeHgrcjRROUxP\nSCtramJjZXptMVM5ajFXeGVNVld6bXZIRlVBClE3dEw1dWdZQmIvUGZQYk9ITDNj\nUVpMUXFiWXp6cGlXZFA5a1haNHUwQjAKLS0tIFJmVGdRWW1KdWsxeHhSRG00cXB2\nYzBtaFhrZGRaRWx6ZjByU1BsYWhLelUK5xY5pQJivhjEekm/FCp2cy/D3xdXb5q6\nt1ovJcko2++uM1rO8xrcqW5zXTqdbLBW2lWL8imSlkaMiFs7aVA8jA==\n-----END AGE ENCRYPTED FILE-----\n +sops_lastmodified=2022-12-29T08:40:37Z sops_unencrypted_suffix=_unencrypted +sops_mac=ENC[AES256_GCM,data:v+MUgHHzcWglAxkY7k8GrFAh9Mwjx5Y0jAn/cjxvQOcDgzd73Sl2k1GGh/v6t5Qonv0w+TSpADW76iG9ffmvLQzNvJyJduVsvEaAfyvUYUabnSSGZMVL6ytI6FloyipEoEoyV+9Ac+e+6eQZtceHWOXTxutp59y5/LsS+dZD3qU=,iv:SkxSE/ZROwarze2Im8KoO9anuBipyTYjWDXoGnrd3Nc=,tag:DAf2oT8VtnUo5TGIFSV7hA==,type:str]