spcd/readme.md

260 lines
7.5 KiB
Markdown
Raw Normal View History

2024-06-27 11:54:46 +00:00
# Shell to Python Continuous Deployment
2024-04-29 11:04:36 +00:00
2024-08-23 05:57:45 +00:00
Get a common set of Python based CI / CD commands\
2024-08-22 10:22:13 +00:00
from various contexts of CA, DNS, CI and OS / OCI.
2024-05-03 13:11:58 +00:00
2024-08-22 19:42:46 +00:00
---
2024-08-22 12:59:27 +00:00
## Why
Project workflows can occur in:
* an online or offline context, dealing with custom CA & DNS servers
* various Continuous Integration platforms, with different workflow syntaxes
2024-08-23 05:57:45 +00:00
* specific Operating Systems, having different commands and package names
2024-08-22 12:59:27 +00:00
* specific containers for JavaScript based actions (ForgeJo, Gitea, GitHub)
2024-08-22 19:25:35 +00:00
2024-08-22 12:59:27 +00:00
What if there was a unified way to do so?
2024-08-22 19:42:46 +00:00
---
2024-08-22 12:59:27 +00:00
## How
2024-08-22 14:14:42 +00:00
Picture it…
### Group environment variables
* numbered
* Certificate Authority armored certificates
* Domain Name System servers IP addresses
2024-08-23 05:57:45 +00:00
* ref names for deployment contexts of feature, staging & release
* alternate locations of
* Operating Systems & Software packages
2024-08-23 12:49:38 +00:00
* Git repositories of
* this project
* its parent framework
* projects not available in some distributions
* shunit2
2024-08-23 05:57:45 +00:00
* SSH key & hosts for deployments
* a standalone POSIX shell script payload
2024-08-22 14:14:42 +00:00
### Workflow files
* calling the POSIX shell script payload as their very first step
* using a unified YAML syntax made of actions implemented in Python
2024-08-23 05:57:45 +00:00
### Integration & Deployment
2024-08-22 14:14:42 +00:00
2024-08-23 12:49:38 +00:00
#### Shell
* setting up the chosen Operating System container
* Domain Name System resolving
* package manager configuration & repositories
* Certificate Authorities trusting
* Operating System updating
* installing Git to clone
* this project
* its parent framework
* installing both Python
* system environment
* virtual environment
* generating a Python module to switch
#### Python
* setting up an OpenSSH client context
* known hosts
* private key
2024-08-23 05:57:45 +00:00
* parsing common YAML syntax to launch Python actions
2024-08-22 14:14:42 +00:00
2024-08-22 19:42:46 +00:00
---
2024-08-22 12:59:27 +00:00
## What
2024-04-29 11:04:36 +00:00
2024-08-22 14:29:08 +00:00
### Features
2024-08-23 12:49:38 +00:00
Handle project workflows in a unified way:
2024-08-22 19:49:38 +00:00
2024-08-22 12:35:12 +00:00
* whether the network infrastructure is
2024-08-22 10:22:13 +00:00
* [X] online
* [X] offline with custom
* [X] Certificate Authorities
* [X] Domain Name System servers
2024-08-22 19:49:38 +00:00
2024-08-22 12:35:12 +00:00
* whatever the Continuous Integration platform
2024-06-14 08:02:31 +00:00
* [X] ForgeJo
2024-06-17 19:44:22 +00:00
* [X] Gitea
* [X] GitHub
2024-05-05 20:20:49 +00:00
* [X] GitLab
* [ ] SourceHut
2024-08-22 19:49:38 +00:00
2024-08-22 12:35:12 +00:00
* whatever the Operating System container
2024-07-21 11:24:53 +00:00
* [X] Alma
2024-05-05 20:20:49 +00:00
* [X] 9
2024-07-12 21:24:50 +00:00
* [X] 8
* [X] Alpine
2024-07-21 11:24:53 +00:00
* [X] 3.20
* [X] 3.19
* [X] Arch
2024-08-20 19:37:43 +00:00
* [X] 20240818 (.0.255804)
* [X] 20240101 (.0.204074)
2024-06-25 12:47:42 +00:00
* [X] Debian
2024-07-21 11:24:53 +00:00
* [X] Bookworm (12)
* [ ] Bullseye (11)
2024-07-21 19:24:29 +00:00
* [X] Fedora
2024-05-10 20:33:13 +00:00
* [X] 40
2024-07-12 21:24:50 +00:00
* [X] 39
2024-08-20 06:17:19 +00:00
* [ ] OpenSUSE
* [ ] 15.6
* [ ] 15.5
2024-07-21 11:24:53 +00:00
* [X] Rocky
2024-05-05 20:20:49 +00:00
* [X] 9
2024-07-12 21:24:50 +00:00
* [X] 8
2024-05-05 20:20:49 +00:00
* [X] Ubuntu
2024-07-21 11:24:53 +00:00
* [X] Noble (24.04)
2024-08-20 12:21:49 +00:00
* [ ] Jammy (22.04)
2024-04-29 11:04:36 +00:00
2024-08-22 14:29:08 +00:00
### Environment variables
2024-05-02 08:58:02 +00:00
2024-08-22 09:05:39 +00:00
| Variable | Description | Default |
|:------------------|:-------------------------|:--------------------------------|
| SPCD_CA_n | Numbered CA certificates | |
| SPCD_CMD_SUM | Command to check sums | sha512sum |
| SPCD_DNS_n | Numbered name servers | 9.9.9.9 |
| SPCD_GIT_MAIN | Main Git repository | spcd |
| SPCD_GIT_ROOT | Root Git repository | rwx |
| SPCD_GIT_SHUNIT | ShUnit Git repository | shunit2 |
| SPCD_REF_FEATURE | Feature deployment ref | f |
| SPCD_REF_RELEASE | Release deployment ref | main |
| SPCD_REF_STAGING | Staging deployment ref | dev |
| SPCD_SSH_HOSTS | domain.tld ssh-type pub | |
| SPCD_SSH_KEY | SSH private key | |
| SPCD_URL_ALMA | Alma repository URL | https://repo.almalinux.org |
| SPCD_URL_ALPINE | Alpine repository URL | https://dl-cdn.alpinelinux.org |
| SPCD_URL_ARCH | Arch repository URL | https://geo.mirror.pkgbuild.com |
| SPCD_URL_DEBIAN | Debian repository URL | https://deb.debian.org |
| SPCD_URL_EPEL | EPEL repository URL | https://dl.fedoraproject.org |
| SPCD_URL_FEDORA | Fedora repository URL | https://rpmfind.net |
| SPCD_URL_OPENSUSE | OpenSUSE repository URL | https://download.opensuse.org |
| SPCD_URL_PYTHON | Python repository URL | https://pypi.org/simple |
| SPCD_URL_ROCKY | Rocky repository URL | https://dl.rockylinux.org |
| SPCD_URL_UBUNTU | Ubuntu repository URL | https://ubuntu.mirrors.ovh.net |
2024-05-02 08:58:02 +00:00
2024-08-22 14:29:08 +00:00
### Operating Systems containers
2024-05-10 20:25:17 +00:00
2024-08-22 14:29:08 +00:00
#### Latest
2024-08-20 17:46:33 +00:00
2024-08-21 10:25:50 +00:00
| os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt |
|:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:|
| Arch 20240818 | ☑ | ☑ | 3.12 | 12.0 | 1.2023.13 | 0.10 | 2.1.8 | 3.8 |
| Alpine 3.20 | ☑ | ☐ | 3.12 | 9.0 | 1.2024.4 | 0.10 | 2.1.8 | 3.8 |
| Fedora 40 | ☑ | ☑ | 3.12 → 3.13 | 9.0 | 1.2024.6 | 0.9 | 2.1.6 | 3.7 |
| Debian Bookworm | ☐ | ☐ | 3.11 | 2.42 | 1.2020.2 | 0.9 | 2.1.8 | 3.6 |
| OpenSUSE 15.6 | ☐ | ☑ | 3.6 → 3.12 | 2.48 | 1.2020.9 | 0.8 | 2.1.6 | 3.5 |
| Ubuntu Noble | ☐ | ☐ | 3.12 | u2.42 | u1.2020.2 | u0.9 | 2.1.8 | u3.8 |
2024-08-22 19:49:38 +00:00
| Alma / Rocky 9 | ☑ | ☑ | 3.9 → 3.12 | 2.44 | e1.2024.6 | e0.8 | | |
2024-08-20 17:46:33 +00:00
2024-08-22 14:29:08 +00:00
#### Previous
2024-08-20 17:46:33 +00:00
2024-08-21 10:25:50 +00:00
| os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt |
|:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:|
| Alpine 3.19 | ☑ | ☐ | 3.11 | 9.0 | 1.2023.12 | 0.9 | 2.1.8 | 3.7 |
| Fedora 39 | ☑ | ☑ | 3.12 → 3.13 | 8.1 | 1.2024.6 | 0.9 | 2.1.6 | 3.5 |
| OpenSUSE 15.5 | ☐ | ☑ | 3.6 → 3.11 | 2.48 | 1.2020.9 | 0.8 | 2.1.6 | 3.5 |
2024-08-22 19:49:38 +00:00
| Alma / Rocky 8 | ☑ | ☑ | 3.6 → 3.12 | 2.40 | e1.2024.6 | e0.6 | | |
2024-08-20 17:46:33 +00:00
2024-08-22 14:29:08 +00:00
#### Older Python
2024-08-20 17:46:33 +00:00
2024-08-21 10:25:50 +00:00
| os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt |
|:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:|
| Ubuntu Jammy | ☐ | ☐ | 3.10 | u2.42 | u1.2020.2 | u0.8 | 2.1.6 | u3.4 |
| Debian Bullseye | ☐ | ☐ | 3.9 | 2.42 | 1.2020.2 | 0.7 | 2.1.6 | |
2024-05-10 20:25:17 +00:00
2024-08-22 19:42:46 +00:00
---
2024-08-22 14:29:08 +00:00
## Who
2024-08-22 20:03:22 +00:00
### By
2024-08-22 19:08:14 +00:00
2024-08-22 20:03:22 +00:00
* [Marc Beninca](https://marc.beninca.link)
### For
2024-08-23 07:38:34 +00:00
* People feeling the need to aim for consistency in the CI / CD universe
2024-08-22 14:29:08 +00:00
2024-08-22 19:42:46 +00:00
---
2024-08-22 14:29:08 +00:00
## Where
2024-08-22 20:03:22 +00:00
### Chat
2024-08-22 18:37:24 +00:00
* [Discord](https://discord.com/channels/983145051985154108/1255894420092485652)
* [IRC](ircs://irc.libera.chat/#spcd)
2024-08-22 20:03:22 +00:00
### Forge
* [Repository](https://forge.rwx.work/rwx.work/spcd)
* [RSS](https://forge.rwx.work/rwx.work/spcd.rss)
* [Workflows](https://forge.rwx.work/rwx.work/spcd/actions)
### Deployment
* [Site](https://spcd.rwx.work)
2024-08-22 14:29:08 +00:00
2024-08-22 19:42:46 +00:00
---
2024-08-22 14:29:08 +00:00
## When
### First
2024-04-29 11:04:36 +00:00
2024-08-21 09:53:26 +00:00
* try git repo url variable first for shunit
2024-08-21 14:46:48 +00:00
### Shell
2024-08-19 12:27:10 +00:00
2024-08-21 10:38:38 +00:00
* fit banner to text
2024-08-20 10:54:21 +00:00
* review repositories handling for systems
2024-08-20 11:57:02 +00:00
* opensuse
* codecs repository
* disable & enable https
2024-08-21 14:46:48 +00:00
* write function to clone git repositories
2024-08-21 10:38:38 +00:00
* write unit tests
2024-08-19 12:27:10 +00:00
2024-08-21 14:46:48 +00:00
### Shell → Python
2024-08-19 12:27:10 +00:00
* check file & variable sums
2024-08-19 12:43:46 +00:00
* install system packages
* epel
* plantuml
* shellcheck
* graphviz
* openssh
* rsync
* shfmt
2024-08-21 10:38:38 +00:00
* shunit
2024-08-19 12:38:39 +00:00
* python virtual environment
* install system package
* configure pip
* venv
* create
* activate
2024-08-20 12:04:17 +00:00
* relay environment module name
2024-08-19 12:27:10 +00:00
2024-08-21 14:46:48 +00:00
### Python
2024-06-14 07:16:28 +00:00
2024-08-19 18:33:11 +00:00
* check
2024-06-14 09:59:10 +00:00
* .py
* .sh
2024-08-20 12:04:17 +00:00
* maximum line length
* detect ssh private key type
2024-08-21 10:38:38 +00:00
* fit banner to text
2024-08-21 08:49:40 +00:00
* implement substeps
2024-08-20 12:04:17 +00:00
* list sys.path
* set workflow templates
* actions
* includes
2024-08-21 10:38:38 +00:00
* write unit tests
2024-08-21 14:46:48 +00:00
### Later
2024-08-23 05:57:45 +00:00
* automate versions fetching
2024-08-21 14:46:48 +00:00
* turn readme into documentation