Using the CI/CD

You can use CI/CD from GitHub with GitHub Actions, but also from a command prompt with command lines.

Use CI/CD With GitHub Actions

You can use the CI/CD process on GitHub.

The connection between GitHub and Saagie is made through GitHub Actions workflows. You need a file that defines them. For more information see, GitHub Actions documentation.

Before you begin:

Make sure you meet the requirements.

  1. Open your preferred IDE, link it to Git, and clone the GitHub repository you have configured for this.

  2. Make changes in your project. You can create or modify jobs and pipelines in your project. For more information on how to collaborate on projects, see GitHub flow.

  3. Trigger your GitHub Actions workflows with events.
    This will run your workflow file and trigger the actions defined in it. Your changes will be pushed in your Saagie platform.

    When you push a job via the CI/CD, a link to the source code will be automatically added to the package of the job.

    cicd job package source code link

    You cannot change this link by hand. Also, if you change your job package via the Saagie platform, the link to the source code will be removed as it is no longer relevant. However, it remains accessible from the corresponding version of your job.

Use CI/CD With Command Lines

You can use the CI/CD process locally with the command prompt. You can also rely on this local usage for use with another version control system.

The connection between your command prompt and Saagie is made through the variables that were created when the CI/CD was set up. You can find them in the command lines to be run.

Before you begin:

Make sure you meet the requirements.

  1. Install Python 3.8 or higher from your command prompt with the following command line:

    • For Linux

    • For Windows

    apt-get install python3.8 +
    1. Download the version of Python you need.

    2. Install it.

  2. Install all the libraries listed in the requirements.txt file from your command prompt with the following command line:

    pip install -r requirements.txt
  3. In your command prompt, you can manage Saagie jobs and pipelines using the following command lines:

    • Manage a Job

      • Package a job

      • Update a job

      • Run a job

      To package a job, run the following command:

      python cicd_saagie_tool/__main__.py --action package_job --job_name your_job_name

      Where your_job_name must be replaced with the name of the job that you want to package.

      For Windows

      To update a job on a Windows environment, run the following command:

      python cicd_saagie_tool/__main__.py --action update_job --job_name your_job_name --saagie_url %SAAGIE_URL% --saagie_user %SAAGIE_USER% --saagie_pwd %SAAGIE_PWD% --saagie_realm %SAAGIE_REALM% --saagie_env your_env_name
      For Linux

      To update a job on a Linux environment, run the following command:

      python cicd_saagie_tool/__main__.py --action update_job --job_name your_job_name --saagie_url $SAAGIE_URL --saagie_user $SAAGIE_USER --saagie_pwd $SAAGIE_PWD --saagie_realm $SAAGIE_REALM --saagie_env your_env_name

      Where, for both:

      • your_job_name must be replaced with the name of the job that you want to update.

      • your_env_name must be replaced with the name of your Saagie platform.

      For Windows

      To run a job on a Windows environment, run the following command:

      python cicd_saagie_tool/__main__.py --action run_job --job_name your_job_name --saagie_url %SAAGIE_URL% --saagie_user %SAAGIE_USER% --saagie_pwd %SAAGIE_PWD% --saagie_realm %SAAGIE_REALM% --saagie_env your_env_name
      For Linux

      To run a job on a Linux environment, run the following command:

      python cicd_saagie_tool/__main__.py --action run_job --job_name your_job_name --saagie_url $SAAGIE_URL --saagie_user $SAAGIE_USER --saagie_pwd $SAAGIE_PWD --saagie_realm $SAAGIE_REALM --saagie_env your_env_name

      Where, for both:

      • your_job_name must be replaced with the name of the job that you want to run.

      • your_env_name must be replaced with the name of your Saagie platform.

    • Manage a Pipeline

      • Update a pipeline

      • Run a pipeline

      For Windows

      To update a pipeline on a Windows environment, run the following command:

      python cicd_saagie_tool/__main__.py --action update_pipeline --pipeline_name your_pipeline_name --saagie_url %SAAGIE_URL% --saagie_user %SAAGIE_USER% --saagie_pwd %SAAGIE_PWD% --saagie_realm %SAAGIE_REALM% --saagie_env your_env_name
      For Linux

      To update a pipeline on a Linux environment, run the following command:

      python cicd_saagie_tool/__main__.py --action update_pipeline --pipeline_name your_pipeline_name --saagie_url $SAAGIE_URL --saagie_user $SAAGIE_USER --saagie_pwd $SAAGIE_PWD --saagie_realm $SAAGIE_REALM --saagie_env your_env_name

      Where, for both:

      • your_pipeline_name must be replaced with the name of the pipeline that you want to update.

      • your_env_name must be replaced with the name of your Saagie platform.

      For Windows

      To run a pipeline on a Windows environment, run the following command:

      python cicd_saagie_tool/__main__.py --action run_pipeline --pipeline_name your_pipeline_name --saagie_url %SAAGIE_URL% --saagie_user %SAAGIE_USER% --saagie_pwd %SAAGIE_PWD% --saagie_realm %SAAGIE_REALM% --saagie_env your_env_name
      For Linux

      To run a pipeline on a Linux environment, run the following command:

      python cicd_saagie_tool/__main__.py --action run_pipeline --pipeline_name your_pipeline_name --saagie_url $SAAGIE_URL --saagie_user $SAAGIE_USER --saagie_pwd $SAAGIE_PWD --saagie_realm $SAAGIE_REALM --saagie_env your_env_name

      Where, for both:

      • your_pipeline_name must be replaced with the name of the pipeline that you want to run.

      • your_env_name must be replaced with the name of your Saagie platform.