Skip to content

Commit

Permalink
feat: restart work on the topic
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanjerome committed Apr 28, 2024
1 parent 2cd65ef commit 8b4c0c8
Show file tree
Hide file tree
Showing 24 changed files with 706 additions and 3,439 deletions.
7 changes: 7 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ~/.shellcheckrc

external-sources=true
source-path="./shell"

# Suggest ${VAR} in place of $VAR
enable=require-variable-braces
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ Embrace the enchantment of Wizard to fill the void in the DevOps approach and em

Currently, `Wizard` is tailored for seamless use on the following platforms:

- Your local environment (Unix-based systems)
- Jenkins
- GitLab-CI
- [ ] Your local environment (Unix-based systems)
- [x] Jenkins
- [ ] GitLab-CI (_WIP_)

Please note that our magical integration framework may expand its compatibility with more platforms in the future. Stay tuned for updates!

Expand All @@ -59,7 +59,7 @@ In order to utilize `Wizard` on your local machine, the following prerequisites

## Installation

### Install with Homebrew
### Install with Homebrew (_WIP_)

```bash
brew tap scalastic/tap
Expand All @@ -76,7 +76,7 @@ git clone

## Wizard CLI

### Usage
### Usage (_WIP_)

```bash
wizard [options] [command]
Expand Down Expand Up @@ -148,7 +148,7 @@ wizard [options] [command]

- [Semantic Versioning](https://semver.org/) - Semantic Versioning 2.0.0.

### Contributions
### Contributions (_WIP_)

All contributions are welcome!

Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Common functions used in stage scripts

---------------------------------------
*Generated from [src/lib/common.sh](../../../src/lib/common.sh) on 10.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
*Generated from [src/lib/common.sh](../../../src/lib/common.sh) on 18.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
2 changes: 1 addition & 1 deletion docs/src/lib/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,4 @@ log_banner "This is a banner message"
* `stdout`: Writes the banner message to stdout

---------------------------------------
*Generated from [src/lib/log.sh](../../../src/lib/log.sh) on 10.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
*Generated from [src/lib/log.sh](../../../src/lib/log.sh) on 18.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
2 changes: 1 addition & 1 deletion docs/src/lib/platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ platform_get_platform
* `stdout`: The platform where the script is running

---------------------------------------
*Generated from [src/lib/platform.sh](../../../src/lib/platform.sh) on 10.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
*Generated from [src/lib/platform.sh](../../../src/lib/platform.sh) on 18.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
2 changes: 1 addition & 1 deletion docs/src/lib/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ project__architecture_print_layers
* `stdout`: The project architecture layers as a formatted string

---------------------------------------
*Generated from [src/lib/project.sh](../../../src/lib/project.sh) on 10.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
*Generated from [src/lib/project.sh](../../../src/lib/project.sh) on 18.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
2 changes: 1 addition & 1 deletion docs/src/lib/tooling.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ tooling_set_jq
### `tooling_get_ip ✅ (public)`

---------------------------------------
*Generated from [src/lib/tooling.sh](../../../src/lib/tooling.sh) on 10.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
*Generated from [src/lib/tooling.sh](../../../src/lib/tooling.sh) on 18.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
2 changes: 1 addition & 1 deletion docs/src/lib/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ workflow_load_action_definition "action1" "config/workflow-default.json"
* `return`: Action definition as an array

---------------------------------------
*Generated from [src/lib/workflow.sh](../../../src/lib/workflow.sh) on 10.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
*Generated from [src/lib/workflow.sh](../../../src/lib/workflow.sh) on 18.09.2023 (writen with ✨ by [gendoc](../../../src/lib/ext/gendoc.sh))*
2 changes: 1 addition & 1 deletion helm/create-ca-tls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

set -euo pipefail

COMPANY_NAME=${1:-scalastic}
COMPANY_NAME=${1:-macompanie}
CERT_CA_PATH="${CERT_CA_PATH:=openssl/ca}"

echo "Creating CA certificate..."
Expand Down
81 changes: 81 additions & 0 deletions infra/gitlab-ci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# GitLab-CI Installation

## Prerequisites

- A Kubernetes cluster
- The following tools installed on your local machine:
- [Helm](https://helm.sh/docs/intro/install/)
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)

Both Helm and Kubectl are available in the Homebrew package manager. To install them, run the following commands:

- Install Homebrew:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

- Install Helm and Kubectl:

```bash
brew install helm
brew install kubectl
```

## Configure Helm

```bash
helm repo add gitlab https://charts.gitlab.io
helm repo update
```

## Deploy GitLab-CI with Helm

```bash
helm install gitlab gitlab/gitlab --set global.edition=ce --set global.hosts.domain=scalastic.local --set certmanager.install=false
```

Get the Jenkins admin password:

```bash
kubectl get secret jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode; echo
```

## Configure Ingress to access Jenkins

- Install Nginx Ingress Controller:

```bash
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install nginx-ingress ingress-nginx/ingress-nginx
```

- Create a `jenkins-ingress.yaml` file:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jenkins-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: jenkins.scalastic.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: jenkins
port:
number: 8080
```
- Apply the configuration:
```bash
kubectl apply -f jenkins-ingress.yaml
```
81 changes: 81 additions & 0 deletions infra/jenkins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Jenkins Installation

## Prerequisites

- A Kubernetes cluster
- The following tools installed on your local machine:
- [Helm](https://helm.sh/docs/intro/install/)
- [Kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)

Both Helm and Kubectl are available in the Homebrew package manager. To install them, run the following commands:

- Install Homebrew:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

- Install Helm and Kubectl:

```bash
brew install helm
brew install kubectl
```

## Configure Helm

```bash
helm repo add jenkins https://charts.jenkins.io
helm repo update
```

## Deploy Jenkins with Helm

```bash
helm install jenkins jenkins/jenkins --set controller.service.type=NodePort
```

Get the Jenkins admin password:

```bash
kubectl get secret jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode; echo
```

## Configure Ingress to access Jenkins

- Install Nginx Ingress Controller:

```bash
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install nginx-ingress ingress-nginx/ingress-nginx
```

- Create a `jenkins-ingress.yaml` file:

```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jenkins-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: jenkins.scalastic.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: jenkins
port:
number: 8080
```
- Apply the configuration:
```bash
kubectl apply -f jenkins-ingress.yaml
```
18 changes: 18 additions & 0 deletions infra/jenkins/jenkins-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: jenkins-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: jenkins.scalastic.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: jenkins
port:
number: 8080
32 changes: 32 additions & 0 deletions shell/lib/core/command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# shellcheck source-path=shell
. "${SHELL_DIR}/lib/core/logger.sh"

# shellcheck disable=SC2034
COMMAND_SUCCESS=0
# shellcheck disable=SC2034
COMMAND_WARNING=1
# shellcheck disable=SC2034
COMMAND_ERROR=2

command.run_function() {
local function_name="$1"
shift
local args=("$@")

if declare -f "${function_name}" > /dev/null; then
log.debug "Running function: ${function_name} with args: ${args[*]}"
${function_name} "${args[@]}"
else
log.error "Function ${function_name} is not defined"
return 1
fi
}

command.run_eval() {
local command="$1"

log.debug "Running eval for command: ${command}"
eval "${command}"
}
Loading

0 comments on commit 8b4c0c8

Please sign in to comment.