Saagie Jenkins is a command-line tool used to manage Jenkins. It utilizes the current git and Kubernetes context in some cases to retrieve environment and branch names.
Ensure Python 3.9 and pip 3.9 are installed:
-
Linux:
sudo apt update sudo apt install python3.9 python3.9-venv curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python3.9 get-pip.py
-
MacOS:
brew install [email protected]
- To receive notifications, you need to install 'notify-send' or an equivalent and it must be written in .jks-env.
- Unzip the
jks-x.x.zip
archive in your terminal:unzip /path-to/jks-x.x.x.zip -d ~/.jks
- Navigate to the unzipped directory and create a
.jks-env
file:cd ~/.jks touch .jks-env
- Populate the
.jks-env
file with the following content:[JENKINS] ServerUrl = jenkinsUrl ApiKey = ApiKey Username = username [GITLAB] ServerUrl = https://gitlab.com ApiKey = ApiKey [SLACK] UserId = UserId [TERMINAL] Notification = notify-send
To get your Jenkins API Key: Go to https://jenkins.devtools.saagie.tech/user/YOUR_ID/configure and create a token.
To get your Gitlab API Key: Go to https://gitlab.com/-/profile/personal_access_tokens and create a token.
To get your Slack ID: Go to your Slack profile and look for the option that allows you to view or copy your member ID. - Install required dependencies:
pip3.9 install -r requirements.txt
- Create an Alias in your terminal configuration file:
alias jks="python3.9 ~/.jks/jks.py"
Arguments | Description |
---|---|
start |
Start a GKE environment |
create |
Create a GKE environment |
drop |
Drop a GKE environment |
cron |
Create a Jenkins cron |
build |
Build product |
open_mr |
Open a new MR |
get_assigned_mr |
Get a list of assigned MR |
ask_validation |
Ask validation (tests or PM) |
test |
Run test on GKE environment |
build_info |
Wait for your build to be completed to send you a notification. |
Arguments | Description |
---|---|
-b, --branch |
Branch name (if not specify use current branch) |
-e, --env |
GKE environment name (if not specify use current environment) |
Arguments | Description |
---|---|
-b, --branch |
Branch name (if not specify use current branch) |
-e, --env |
GKE environment name (if not specify use current environment) |
-iid, --installation-id |
A short name. In lower case only. (if not specify use current saagie ) |
-kv, --kubernetes-version |
Set a custom kubernete version |
-tt, --test-types |
Tests to run after test creation (UI / API / APIv2 / All) |
-p, --product_version |
Use a specify product version |
-a, --auth |
Auth_mechanism: Which authentication mechanism to deploy (default: keycloak), [ldap, keycloak, freeipa, sso] |
-f, --features |
Features comma-separated list of features to enable or disable (e.g. "gpu", "external_ui_lib", "openai", "kyverno") |
Arguments | Description |
---|---|
-e, --env |
GKE environment name (if not specify use current environment) |
Arguments | Description |
---|---|
start |
Start a GKE environment |
create |
Create a GKE environment |
build |
Build product |
Arguments | Required | Description |
---|---|---|
-f, --format |
true | Setting up a Jenkins cron |
-b, --branch |
false | Branch name (if not specify use current branch) |
-e, --env |
false | GKE environment name (if not specify use current environment) |
Arguments | Required | Description |
---|---|---|
-f, --format |
true | Setting up a Jenkins cron |
-b, --branch |
false | Branch name (if not specify use current branch) |
-e, --env |
false | GKE environment name (if not specify use current environment) |
-iid, --installation-id |
false | A short name. In lower case only. (if not specify use current saagie ) |
Arguments | Required | Description |
---|---|---|
-f, --format |
true | Setting up a Jenkins cron |
-b, --branch |
false | Branch name (if not specify use current branch) |
Arguments | Description |
---|---|
-b, --branch |
Branch name (if not specify use current branch) |
Arguments | Required | Description |
---|---|---|
-c, --card |
true | A Jira Card ID |
-b, --branch |
false | Branch name (if not specify use current branch) |
Arguments | Required | Description |
---|---|---|
-b, --branch |
false | Branch name (if not specify use current branch) |
No args
TODO
TODO
-
Open a merge request
jks open_mr -c id_of_your_ticket
-
Setting up a cron (experimental)
jks cron start -f '*/5 * * * *' jks cron start -f '*/5 * * * *' -b story/1234 -e dev1234
-
Create / Deploy
# Deploy current branch and current env jks create # Deploy current branch on a custom env jks create -e dev1234 # Deploy a custom branch jks create -b story/1234 # Deploy with a custom kubernetes version jks create -kv 1.26 # Deploy with a custom installation id jks create -iid saagie # Deploy with test types jks create -tt UI,API,APIv2,ALL # Deploy with full customization jks create -b story/123 -e dev123 -kv 1.26 -tt UI,API,APIv2,ALL --iid saagie
-
Start
# Start current env with a current branch jks start # Start current env with a custom branch jks start story/1234 # Start a custom env with current branch jks start -e dev1234 # Start with full customization jks start -b story/1234 -e dev1234
-
Remove
# Remove current env jks drop # Remove custom env jks drop -e dev1234
-
Build
# Build current branch jks build # Build a custom branch jks build -b story/1234
-
Get assigned MR
jks get_assigned_mr
-
Build Info
# wait for your build to be completed to send you a notification. jks build_info &