DocsGitLabCI/CD ComponentsCI/CD Components Make sure you previously read CI/CD with Mélodium. CI/CD Component GitLab CI/CD Components are available to run Mélodium within GitLab runners: Mélodium GitLab Components . Mélodium on GitLab CI The configuration to add in GitLab YAML is: include: - component: gitlab.com/melodium/gitlab-ci/melodium@v0.10 inputs: job_name: melodium-ci command: run .melodium-ci/Compo.toml --api_token <YOUR_RUN_API_TOKEN> --output_directory logs --repository_clone_url "$CI_REPOSITORY_URL" --repository_clone_ref "$CI_COMMIT_REF_NAME" --on_gitlab true --ci_service_token "$PERSONNAL_GITLAB_API_TOKEN" --ci_service_project "$CI_PROJECT_ID" --ci_service_sha "$CI_COMMIT_SHA" --ci_service_ref "$CI_COMMIT_REF_NAME" --ci_service_pipeline "$CI_PIPELINE_ID" melodium-ci: artifacts: paths: - logs Refer to melodium.yml for full list of input parameters. Dispatch Work Within GitLab Runner A GitLab Component to run Mélodium with local distribution is available: include: - component: gitlab.com/melodium/gitlab-ci/melodium-local-distrib@v0.10 inputs: job_name: melodium-ci command: run .melodium-ci/Compo.toml --work_location compose --api_token <YOUR_RUN_API_TOKEN> --output_directory logs --repository_clone_url "$CI_REPOSITORY_URL" --repository_clone_ref "$CI_COMMIT_REF_NAME" --on_gitlab true --ci_service_token "$PERSONNAL_GITLAB_API_TOKEN" --ci_service_project "$CI_PROJECT_ID" --ci_service_sha "$CI_COMMIT_SHA" --ci_service_ref "$CI_COMMIT_REF_NAME" --ci_service_pipeline "$CI_PIPELINE_ID" melodium-ci: artifacts: paths: - logs Using local distribution in GitLab allows to make full use of provided runners without relying on additional cluster. It can also be useful to use bigger runner size by applying some tags (see GitLab Runners ): melodium-ci: tags: - saas-linux-medium-amd64 artifacts: paths: - logs Refer to melodium-local-distrib.yml for full list of input parameters. Windows Runner A GitLab Component to run Mélodium on Windows runner is available: include: - component: gitlab.com/melodium/gitlab-ci/melodium-windows@v0.10 inputs: job_name: melodium-ci command: run .melodium-ci/Compo.toml --api_token <YOUR_RUN_API_TOKEN> --output_directory logs --repository_clone_url "$CI_REPOSITORY_URL" --repository_clone_ref "$CI_COMMIT_REF_NAME" --on_gitlab true --ci_service_token "$PERSONNAL_GITLAB_API_TOKEN" --ci_service_project "$CI_PROJECT_ID" --ci_service_sha "$CI_COMMIT_SHA" --ci_service_ref "$CI_COMMIT_REF_NAME" --ci_service_pipeline "$CI_PIPELINE_ID" melodium-ci: artifacts: paths: - logs Refer to melodium-windows.yml for full list of input parameters. Mac OS Runner A GitLab Component to run Mélodium on Mac OS runner is available: include: - component: gitlab.com/melodium/gitlab-ci/melodium-macos@v0.10 inputs: job_name: melodium-ci command: run .melodium-ci/Compo.toml --api_token <YOUR_RUN_API_TOKEN> --output_directory logs --repository_clone_url "$CI_REPOSITORY_URL" --repository_clone_ref "$CI_COMMIT_REF_NAME" --on_gitlab true --ci_service_token "$PERSONNAL_GITLAB_API_TOKEN" --ci_service_project "$CI_PROJECT_ID" --ci_service_sha "$CI_COMMIT_SHA" --ci_service_ref "$CI_COMMIT_REF_NAME" --ci_service_pipeline "$CI_PIPELINE_ID" melodium-ci: artifacts: paths: - logs Refer to melodium-macos.yml for full list of input parameters. Report Status to GitLab To report commit pipeline status to GitLab, different methods are available. Using simpleStep In a simpleStep treatment, add the parameters as follows. simpleStep( /* … */ gitlab=true, gitlab_token=/* GitLab Token with API Access */, gitlab_project_id=/* GitLab Project Identifier */, gitlab_sha=/* GitLab SHA related to the step */, gitlab_ref=/* GitLab Git reference related to the step */, gitlab_pipeline_id=/* GitLab pipeline ID where step should be reported */ ) In CI/CD template, in main treatment: build: simpleStep[cicd=cicd]( /* … */ gitlab=on_gitlab, gitlab_token=ci_service_token, gitlab_project_id=ci_service_project, gitlab_sha=ci_service_sha, gitlab_ref=ci_service_ref, gitlab_pipeline_id=ci_service_pipeline ) /* … */ test: simpleStepWithInput[cicd=cicd]( /* … */ gitlab=on_gitlab, gitlab_token=ci_service_token, gitlab_project_id=ci_service_project, gitlab_sha=ci_service_sha, gitlab_ref=ci_service_ref, gitlab_pipeline_id=ci_service_pipeline ) Using postGitlabState Within appropriate treatment, add the postGitlabState treatment. use cicd/services/gitlab::|success use cicd/services/gitlab::postGitlabState /* … */ treatment someStuff[cicd: CicdDispatchEngine]( // Add the following parameters gitlab_project_id: string, gitlab_sha: string, gitlab_token: string gitlab_pipeline_id: string, gitlab_ref: string ) // … { /* … */ postSuccess: postGitlabState( name="Doing a treatment", description="Treatment accomplishing some stuff", state=|success(), project=gitlab_project_id, sha=gitlab_sha, token=gitlab_token, pipeline=gitlab_pipeline_id ref=gitlab_ref ) theTreatment.completed -> postSuccess.trigger } There also exists a more generic setServiceState treatment with prepared triggers for different states: use cicd/services::setServiceState /* … */ treatment someStuff[cicd: CicdDispatchEngine]( // Add the following parameters gitlab_project_id: string, gitlab_sha: string, gitlab_token: string gitlab_pipeline_id: string, gitlab_ref: string ) // … { /* … */ setServiceState( name="Doing a treatment", description="Treatment accomplishing some stuff", gitlab=true, gitlab_project_id=gitlab_project_id, gitlab_sha=gitlab_sha, gitlab_token=gitlab_token, gitlab_pipeline_id=gitlab_pipeline_id, gitlab_ref=gitlab_ref ) Self.trigger -----------> setServiceState.pending theTreatment.started ---> setServiceState.running theTreatment.completed -> setServiceState.success theTreatment.failed ----> setServiceState.failed } Setup Variables In order to use some features, such as Cadence.CI API or GitLab API for reporting, variables and secrets have to be set up. In GitLab, within Settings > CI/CD > Variables, add the corresponding tokens to make them available in workflows. Note Currently GitLab CI_JOB_TOKEN does not have right to update commit/pipeline status, an API token with write authorization must be used to report status. Generate with AISelf-Managed Cluster