Compare commits

..

No commits in common. "689aef265539ac0e3a1d32f0167f6f7377e97770" and "bcc64b6af3d5c0f4ac2e968373866cbcff74f1ce" have entirely different histories.

2 changed files with 45 additions and 118 deletions

109
readme.md
View file

@ -1,61 +1,20 @@
# Shell to Python Continuous Deployment # Shell to Python Continuous Deployment
Get a common set of Python CI & CD commands \ Get a common set of Python CI & CD commands \
from various contexts of CA, DNS, CI and OS / OCI. from various contexts of CA, CI and OCI / OS.
## Why ## Features
Project workflows can occur in: * Certification Authority certificates
* an online or offline context, dealing with custom CA & DNS servers * [X] custom
* various Continuous Integration platforms, with different workflow syntaxes * [X] known
* specific Operating Systems, having different sets of commands and packages * Continuous Integration platforms
* specific containers for JavaScript based actions (ForgeJo, Gitea, GitHub)
What if there was a unified way to do so?
## How
Picture it…
### Group environment variables
* numbered
* Certificate Authority armored certificates
* Domain Name System servers IP addresses
* set group environment variables for
* ref names for deployment contexts of feature, staging & release
* alternate locations of
* Git repositories of this project & its parent framework
* Operating Systems & Software packages
* SSH key & hosts for deployments
* a standalone POSIX shell script payload
### Workflow files
* calling the POSIX shell script payload as their very first step
* using a unified YAML syntax made of actions implemented in Python
### Continous Integration & Deployment
* configuring the Operating System container
* installing Python system & virtual environments
## What
### Features
Handle project workflows in a unified way:
* whether the network infrastructure is
* [X] online
* [X] offline with custom
* [X] Certificate Authorities
* [X] Domain Name System servers
* whatever the Continuous Integration platform
* [X] ForgeJo * [X] ForgeJo
* [X] Gitea * [X] Gitea
* [X] GitHub * [X] GitHub
* [X] GitLab * [X] GitLab
* [ ] SourceHut * [ ] SourceHut
* whatever the Operating System container * Operating Systems
* [X] Alma * [X] Alma
* [X] 9 * [X] 9
* [X] 8 * [X] 8
@ -81,19 +40,18 @@ Handle project workflows in a unified way:
* [X] Noble (24.04) * [X] Noble (24.04)
* [ ] Jammy (22.04) * [ ] Jammy (22.04)
### Environment variables ## How
| Variable | Description | Default | | Variable | Description | Default |
|:------------------|:-------------------------|:--------------------------------| |:--------------------|:--------------------------|:--------------------------------|
| SPCD_BRANCH_RELEASE | Release deployment branch | main |
| SPCD_BRANCH_STAGING | Staging deployment branch | dev |
| SPCD_BRANCH_FEATURE | Feature deployment branch | f |
| SPCD_CA_n | Numbered CA certificates | | | SPCD_CA_n | Numbered CA certificates | |
| SPCD_CMD_SUM | Command to check sums | sha512sum | | SPCD_CMD_SUM | Command to check sums | sha512sum |
| SPCD_DNS_n | Numbered name servers | 9.9.9.9 | | SPCD_DNS_n | Numbered name servers | 9.9.9.9 |
| SPCD_GIT_MAIN | Main Git repository | spcd | | SPCD_GIT_MAIN | Main Git repository | spcd |
| SPCD_GIT_ROOT | Root Git repository | rwx | | 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_HOSTS | domain.tld ssh-type pub | |
| SPCD_SSH_KEY | SSH private key | | | SPCD_SSH_KEY | SSH private key | |
| SPCD_URL_ALMA | Alma repository URL | https://repo.almalinux.org | | SPCD_URL_ALMA | Alma repository URL | https://repo.almalinux.org |
@ -107,9 +65,9 @@ Handle project workflows in a unified way:
| SPCD_URL_ROCKY | Rocky repository URL | https://dl.rockylinux.org | | SPCD_URL_ROCKY | Rocky repository URL | https://dl.rockylinux.org |
| SPCD_URL_UBUNTU | Ubuntu repository URL | https://ubuntu.mirrors.ovh.net | | SPCD_URL_UBUNTU | Ubuntu repository URL | https://ubuntu.mirrors.ovh.net |
### Operating Systems containers ## Packages
#### Latest ### Latest
| os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt | | os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt |
|:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:| |:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:|
@ -121,7 +79,7 @@ Handle project workflows in a unified way:
| Ubuntu Noble | ☐ | ☐ | 3.12 | u2.42 | u1.2020.2 | u0.9 | 2.1.8 | u3.8 | | Ubuntu Noble | ☐ | ☐ | 3.12 | u2.42 | u1.2020.2 | u0.9 | 2.1.8 | u3.8 |
| Alma / Rocky 9 | ☑ | ☑ | 3.9 → 3.12 | 2.44 | e1.2024.6 | e0.8 | git | | | Alma / Rocky 9 | ☑ | ☑ | 3.9 → 3.12 | 2.44 | e1.2024.6 | e0.8 | git | |
#### Previous ### Previous
| os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt | | os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt |
|:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:| |:----------------|---|---|------------:|------:|-----------:|------:|------:|-----:|
@ -130,49 +88,28 @@ Handle project workflows in a unified way:
| OpenSUSE 15.5 | ☐ | ☑ | 3.6 → 3.11 | 2.48 | 1.2020.9 | 0.8 | 2.1.6 | 3.5 | | OpenSUSE 15.5 | ☐ | ☑ | 3.6 → 3.11 | 2.48 | 1.2020.9 | 0.8 | 2.1.6 | 3.5 |
| Alma / Rocky 8 | ☑ | ☑ | 3.6 → 3.12 | 2.40 | e1.2024.6 | e0.6 | git | | | Alma / Rocky 8 | ☑ | ☑ | 3.6 → 3.12 | 2.40 | e1.2024.6 | e0.6 | git | |
#### Older Python ### Older Python
| os | https | updt-ca | python | graphviz | plantuml | shellcheck | shunit | shfmt | | 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 | | 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 | | | Debian Bullseye | ☐ | ☐ | 3.9 | 2.42 | 1.2020.2 | 0.7 | 2.1.6 | |
## Who ## Tasks
### By
[Marc Beninca](https://marc.beninca.link).
### For
People feeling the need to aim for consistence in the CI & CD universe.
## Where
* [Discord](https://discord.com/channels/983145051985154108/1255894420092485652)
* [IRC](ircs://irc.libera.chat/#spcd)
* [Web](https://spcd.rwx.work)
* [Git](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)
## When
### First
* try git repo url variable first for shunit * try git repo url variable first for shunit
* turn readme into documentation
### Shell ### sh
* fit banner to text * fit banner to text
* review repositories handling for systems * review repositories handling for systems
* opensuse * opensuse
* codecs repository * codecs repository
* disable & enable https * disable & enable https
* write function to clone git repositories
* write unit tests * write unit tests
### Shell → Python ### sh → py
* check file & variable sums * check file & variable sums
* install system packages * install system packages
@ -192,7 +129,7 @@ People feeling the need to aim for consistence in the CI & CD universe.
* activate * activate
* relay environment module name * relay environment module name
### Python ### py
* check * check
* .py * .py
@ -206,7 +143,3 @@ People feeling the need to aim for consistence in the CI & CD universe.
* actions * actions
* includes * includes
* write unit tests * write unit tests
### Later
* turn readme into documentation

18
spcd.sh
View file

@ -8,7 +8,6 @@
[ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9" [ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9"
[ -n "${SPCD_GIT_MAIN}" ] || SPCD_GIT_MAIN="spcd" [ -n "${SPCD_GIT_MAIN}" ] || SPCD_GIT_MAIN="spcd"
[ -n "${SPCD_GIT_ROOT}" ] || SPCD_GIT_ROOT="rwx" [ -n "${SPCD_GIT_ROOT}" ] || SPCD_GIT_ROOT="rwx"
[ -n "${SPCD_GIT_SHUNIT}" ] || SPCD_GIT_SHUNIT="shunit2"
[ -n "${SPCD_URL_PYTHON}" ] || SPCD_URL_PYTHON="https://pypi.org/simple" [ -n "${SPCD_URL_PYTHON}" ] || SPCD_URL_PYTHON="https://pypi.org/simple"
# main # main
@ -715,7 +714,12 @@ spcd_install_python_modules() {
spcd_ipm__target="${SPCD_PYTHON_VENV_PACKAGES}" spcd_ipm__target="${SPCD_PYTHON_VENV_PACKAGES}"
echo "${spcd_ipm__root}" echo "${spcd_ipm__root}"
for spcd_ipm__repository in "${SPCD_GIT_MAIN}" "${SPCD_GIT_ROOT}"; do for spcd_ipm__repository in "${SPCD_GIT_MAIN}" "${SPCD_GIT_ROOT}"; do
spcd_ipm__url="$(spcd_get_git_url "${spcd_ipm__repository}")" case "${spcd_ipm__repository}" in
http*) spcd_ipm__url="${spcd_ipm__repository}" ;;
*/*) spcd_ipm__url="${SPCD_PROJECT_ROOT}/${spcd_ipm__repository}" ;;
*) spcd_ipm__url="\
${SPCD_PROJECT_ROOT}/${SPCD_PROJECT_PATH}/${spcd_ipm__repository}" ;;
esac
spcd_ipm__name="$(basename "${spcd_ipm__url}")" spcd_ipm__name="$(basename "${spcd_ipm__url}")"
spcd_split spcd_split
echo "\ echo "\
@ -882,16 +886,6 @@ spcd_error_os() {
exit "${SPCD_ERROR_OS}" exit "${SPCD_ERROR_OS}"
} }
spcd_get_git_url() {
if [ -n "${1}" ]; then
case "${1}" in
http*) echo "${1}" ;;
*/*) echo "${SPCD_PROJECT_ROOT}/${1}" ;;
*) echo "${SPCD_PROJECT_ROOT}/${SPCD_PROJECT_PATH}/${1}" ;;
esac
fi
}
spcd_grep_os() { spcd_grep_os() {
spcd_grep_os__variable="${1}" spcd_grep_os__variable="${1}"
[ -n "${spcd_grep_os__variable}" ] && [ -n "${spcd_grep_os__variable}" ] &&