Setting Up the CI/CD
Setting Up the CI/CD to Use With GitHub Actions
-
You must have a Saagie account with at least editor rights to the platform(s). For more information on access rights, see About Groups Page.
-
You must have at least one project on your Saagie platform(s). For more information on how to create projects, see Creating Projects.
-
Create the following environment variables:
-
SAAGIE_URL
: This is the URL of your Saagie platform. -
SAAGIE_USER
: This is the username of your Saagie account. -
SAAGIE_PWD
: This is the password of your Saagie account. -
SAAGIE_REALM
: This is the DNS prefix determined when Saagie was installed. The Realm allows you to connect to your Saagie platform.They will be used to make the connection with Saagie. For more information on how to create environment variables, see the GitHub documentation for Creating configuration variables for a repository.
If you have password type variables, you must create them as secrets.
-
-
You have a GitHub repository.
You can directly clone our repository or create your own. If you clone our repository, remember to adjust the files to suit your needs. -
Import the
cicd_saagie_tool
folder from the GitHub marketplace in your GitHub repository. This folder includes the__main__.py
,requirements.txt
, andutils.py
files.-
The
__main__.py
file is the entry point to your program, where the top-level code is run. It calls the other modules required to run the CI/CD. For more information, see the official Python documentation. -
The
requirements.txt
is the list of required dependencies to run the project. It includes libraries and their versions. -
The
utils.py
contains a set of small Python functions and classes, which make common patterns shorter and easier. This file is called by the__main__.py
file to retrieve these functions, used to run the CI/CD. For more information, see the official Python Utils documentation.
-
-
Make sure you have the required configuration and code files for each Saagie platform, job, and pipeline.
If you need examples, see our template repository. It is made up of:
-
The
saagie
directory. This is where the configuration files are stored. For more information on their architecture, see Configuration Files. -
The
code
directory. This is where the code files for your Saagie jobs and pipelines are stored.
You can store these files anywhere as long as they remain accessible. You will need the path to them in your job and pipeline configuration files, as well as in your GitHub Actions workflow file.
-
-
Create a GitHub Actions workflow file in your repository. For more information, see the GitHub documentation on the Workflow syntax for GitHub Actions.
-
Add the following step to your workflow file:
name: Saagie CICD on: push: branches: - main jobs: saagie-cicd: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v2 - name: Saagie CICD Action uses: <repository>/<action-name>@<release-tag> with: action: 'update' # Available values: package_job, update_job, update_pipeline, update. Default: update saagie_url: ${{ secrets.SAAGIE_URL }} saagie_user: ${{ secrets.SAAGIE_USER }} saagie_pwd: ${{ secrets.SAAGIE_PASSWORD }} saagie_realm: ${{ secrets.SAAGIE_REALM }} saagie_env: 'dev' # Environment to connect to the Saagie Platform. It should be the same as the one in the env config files. job_config_folder: 'saagie/jobs/*.json' # Folder where job config files are stored pipeline_config_folder: 'saagie/pipelines/*.json' # Folder where pipeline config files are stored env_config_folder: './saagie/envs/*.json' # Folder where env config files are stored job_source_folder: './code/jobs/*/*' # Folder where job source code files are stored pipeline_source_folder: './code/pipelines/*.yaml' # Folder where pipeline source code files are stored artefact_code_folder: './dist/*/*' # Folder where artefact code files are stored
Where the path to configuration and code files can be replaced with your own value.
For more information on possible inputs, see the README of the GitHub Actions.
When using the package_job
action, the Zip file will be stored in the{artefact_code_folder}/{job_name}
folder. The name of the zip file will be{job_name}.zip
.
Setting Up the CI/CD to Use With Other Version Control System
-
You must have a Saagie account with at least editor rights to the platform(s). For more information on access rights, see About Groups Page.
-
You must have at least one project on your Saagie platform(s). For more information on how to create projects, see Creating Projects.
-
Create the following environment variables:
-
SAAGIE_URL
: This is the URL of your Saagie platform. -
SAAGIE_USER
: This is the username of your Saagie account. -
SAAGIE_PWD
: This is the password of your Saagie account. -
SAAGIE_REALM
: This is the DNS prefix determined when Saagie was installed. The Realm allows you to connect to your Saagie platform.They will be used to make the connection with Saagie. For more information on how to create environment variables, see:
Linux
Windows
Mac
-
-
You have a working directory.
You can create your own repository, or you can use our template repository. If you use our repository, remember to adjust the files to suit your needs. -
Import the
cicd_saagie_tool
folder in your work directory. This folder includes the__main__.py
,requirements.txt
, andutils.py
files.-
The
__main__.py
file is the entry point to your program, where the top-level code is run. It calls the other modules required to run the CI/CD. For more information, see the official Python documentation. -
The
requirements.txt
is the list of required dependencies to run the project. It includes libraries and their versions. -
The
utils.py
contains a set of small Python functions and classes, which make common patterns shorter and easier. This file is called by the__main__.py
file to retrieve these functions, used to run the CI/CD. For more information, see the official Python Utils documentation.
-
-
Make sure you have the required configuration and code files for each Saagie platform, job, and pipeline.
If you need examples, see our template repository. It is made up of:
-
The
saagie
directory. This is where the configuration files are stored. For more information on their architecture, see Configuration Files. -
The
code
directory. This is where the code files for your Saagie jobs and pipelines are stored.
You can store these files anywhere as long as they remain accessible. You will need the path to them in your job and pipeline configuration files.
-