commit f3c3070c0f5b1b6df91d4d8ff08d76fec00782fc
parent 017a3cd5b31f3ffbaa615514d953ea5bec7a9ab0
Author: arjoonn <arjoonn@noreply.localhost>
Date: Sun, 12 Mar 2023 13:32:59 +0000
Update docs to mention env (!58)
Branch auto created by JayporeCI
```jayporeci
╔ 🔴 : JayporeCI [sha 1fb6ce60ba]
┏━ build-and-test
┃
┃ 🟢 : JciEnv [e07f33a8] 0:38
┃ 🟢 : Jci [5c0c6937] 0:16 ❮-- ['JciEnv']
┃ 🟢 : black [11d3cae3] 0: 0 ❮-- ['JciEnv']
┃ 🟢 : pylint [6ffec1af] 0: 9 ❮-- ['JciEnv']
┃ 🟢 : pytest [18c4b258] 0:22 Cov: 91% ❮-- ['JciEnv']
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Publish
┃
┃ 🟢 : DockerHubJci [014fb001] 0:49
┃ 🟢 : DockerHubJcienv [d024257a] 0:37
┃ 🟢 : PublishDocs [649b0272] 0:33
┃ 🔴 : PublishPypi [1c90c8ad] 0: 4 v0.2.22
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
```
Co-authored-by: demo <demo@example.com>
Reviewed-on: https://gitea.midpathsoftware.com/midpath/jaypore_ci/pulls/58
Diffstat:
5 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/docs/source/conf.py b/docs/source/conf.py
@@ -34,8 +34,8 @@ html_sidebars = {
html_theme = "alabaster"
html_static_path = ["_static"]
html_theme_options = {
- "nosidebar": True,
"logo_name": "Jaypore CI",
+ "logo": "logo.png",
"touch_icon": "logo.png",
"github_user": "theSage21",
"github_repo": "jaypore_ci",
diff --git a/docs/source/index.rst b/docs/source/index.rst
@@ -30,11 +30,13 @@ Getting Started
Installation
------------
-You can install it using a bash script.
+You can install it using a bash script. The script creates only affects your
+repository so if you want you can do this manually also.
.. code-block:: console
- $ curl https://www.jayporeci.in/setup.sh | bash
+ cd ~/myrepository
+ curl https://www.jayporeci.in/setup.sh | bash
**Or** you can manually install it. The names are convention, you can call your
@@ -96,7 +98,10 @@ If you don't want to do this it's also possible to simply use `docker logs
Concepts
--------
-1. A pipeline config is simply a python file that imports and uses **jaypore_ci**.
+Pipeline config
+***************
+
+1. A pipeline is defined inside a python file that imports and uses **jaypore_ci**.
- It can also import other libraries / configs. Do whatever your usecase needs.
2. A config starts with creating a :class:`~jaypore_ci.jci.Pipeline` instance. Everything happens inside this context.
- A pipeline has to have one implementation of a
@@ -113,9 +118,11 @@ Concepts
be applied to jobs in that pipeline as a default. This allows you to keep
your code DRY. For example, we can specify **image='some/docker:image'**
and this will be used for all jobs in the pipeline.
-3. Pipeline components
+3. Parts of a pipeline
1. :class:`~jaypore_ci.interfaces.Repo` holds information about the project.
- You can use this to get information about things like `sha` and `branch`.
+ - It can also tell you which files have changed using
+ :meth:`~jaypore_ci.interfaces.Repo.files_changed`.
- Currently only :class:`~jaypore_ci.repos.git.Git` is supported.
2. :class:`~jaypore_ci.interfaces.Executor` Is used to run the job. Perhaps in
the future we might have shell / VMs.
@@ -139,7 +146,7 @@ Concepts
- Any extra keyword arguments specified while creating the stage are
passed to jobs. These arguments override whatever is specified at the
Pipeline level.
-4. Finally, any number of :meth:`~jaypore_ci.jci.Pipeline.job` definitions can be made.
+5. Finally, any number of :meth:`~jaypore_ci.jci.Pipeline.job` definitions can be made.
- Jobs declared inside a stage belong to that stage.
- Job names have to be unique. They cannot clash with stage names and other job names.
- Jobs are run in parallel **UNLESS** they specify
@@ -148,6 +155,18 @@ Concepts
- Jobs inherit keyword arguments from Pipelines, then stages, then whatever
is specified at the job level.
+
+Secrets and env variables
+*************************
+
+1. JayporeCI uses [SOPS](https://github.com/mozilla/sops) to manage environment variables and secrets.
+ - We add `secrets/<env_name>.enc` to store secrets.
+ - We add `secrets/<env_name>.key` to decrypt corresponding secret files. This is an [AGE](https://github.com/FiloSottile/age) key file. **Do NOT commit this to git!**. JayporeCI automatically adds a gitignore to ignore key files.
+ - We also add `secrets/bin/edit_env.sh` and `secrets/bin/set_env.sh` to help you manage your secrets easily.
+2. It is a good idea to have separate secret files for each developer, each environment respectively.
+ - For example, JayporeCI itself only has a single secret file called `ci`.
+
+
How to
======
diff --git a/jaypore_ci/interfaces.py b/jaypore_ci/interfaces.py
@@ -46,7 +46,10 @@ class Repo:
self.commit_message: str = commit_message
def files_changed(self, target: str) -> List[str]:
- "Returns list of files changed between current sha and target"
+ """
+ Returns list of file paths that have changed between current sha and
+ target.
+ """
raise NotImplementedError()
@classmethod
diff --git a/jaypore_ci/remotes/email.py b/jaypore_ci/remotes/email.py
@@ -81,6 +81,7 @@ class Email(Remote): # pylint: disable=too-many-instance-attributes
email_to: str,
email_from: str,
subject: str,
+ continuous_updates: bool = False,
publish_interval: int = 30,
**kwargs,
): # pylint: disable=too-many-arguments
@@ -95,6 +96,7 @@ class Email(Remote): # pylint: disable=too-many-instance-attributes
self.subject = subject
self.timeout = 10
self.publish_interval = publish_interval
+ self.continuous_updates = continuous_updates
# ---
self.__smtp__ = None
self.__last_published_at__ = None
@@ -127,7 +129,7 @@ class Email(Remote): # pylint: disable=too-many-instance-attributes
if (
self.__last_published_at__ is not None
and (time.time() - self.__last_published_at__) < self.publish_interval
- ):
+ ) or (not self.continuous_updates and status not in ("success", "failure")):
return
if self.__last_report__ == report:
return
diff --git a/pyproject.toml b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "jaypore_ci"
-version = "0.2.21"
+version = "0.2.22"
description = ""
authors = ["arjoonn sharma <arjoonn.94@gmail.com>"]
homepage = "https://www.jayporeci.in/"