Skip to content

Ocs gitlab deployment

OCS Deployment

Runner permissions to execute bash scripts

  1. Log into the runner server.
  2. Run the following command to grant permissions:
    sudo usermod -aG docker <your_gitlab_runner_name>
    

Stages

  • setup
  • test
  • integration_test
  • build
  • push_images
  • execcmd
  • report

Integration tests script path

{project_name as root}/tests/integration_tests/run_tests.sh

Unit tests script path

{project_name as root}/tests/unit_tests/run_tests.sh

DevOps

  1. Create a devops folder.
  2. Add each OCS endpoint as a script.

Script Format

#!/bin/bash

# Initialize variables
session=""
appId=""
id=""
envName=""
settings=""

# Parse named arguments
while [[ $# -gt 0 ]]; do
    case $1 in
        --session)
            session="$2"
            shift # past argument
            shift # past value
            ;;
        --appId)
            appId="$2"
            shift # past argument
            shift # past value
            ;;
        --id)
            id="$2"
            shift # past argument
            shift # past value
            ;;
        --envName)
            envName="$2"
            shift # past argument
            shift # past value
            ;;
        --settings)
            settings="$2"
            shift # past argument
            shift # past value
            ;;
        *)
            shift # past argument
            ;;
    esac
done

curl --location "https://app.infra.cloudlet.cloud/1.0/marketplace/app/rest/install?session=$session&appid=$appId&id=$id&envName=$envName&settings=$settings" --data ''
  1. Update configuration to use the specific settings for the application endpoint.
  2. Reporting
  3. Create and artifacts folder for all your build artifacts
  4. have a artifacts file for each build stage
  5. Add the endpoint as a stage in the GitLab CI pipeline.

NOTE: Values passed as arrays or json objects should be url encoded.

Example

```yaml execcmd: stage: execcmd image: name: pandoc/latex entrypoint: ["/bin/sh", "-c"] script: - echo "Executing commands on UAT for ${APPLICATION_NAME} 🔥🔁" - chmod +x ocs_deploy/ocs_node_execute_command.sh - ocs_deploy/ocs_node_execute_command.sh --session $APITOKEN --nodeId 6452 --envName "dochub" --commandList "%5B%7B%22command%22%3A%20%22docker%20pull%20devops.iohub.cloud%2Fiohub%2Fdocumentation%22%7D%5D%0A" tags: - x64 artifacts: paths: - artifacts/execcmd.log when: always