Tech & DevOps HubEspace Tech & DevOps

Explorez le monde du Dev, du Cloud et des outils DevOps à travers nos articles et discussions Explore the world of development, the cloud and DevOps tools
 FR      EN
CI/CD
Github Actions
Add a GitHub Actions secret
gh secret set DOCKER_TOKEN

Creates or updates a GitHub Actions secret.
how-tos/write-workflows/choose-what-workflows-do/use-secrets
Trigger workflow manually
gh workflow run ci.yml

Triggers a GitHub workflow manually.
See all options available: gh_workflow_run
Download workflow artifacts
gh run download <run-id>

Download all artifacts generated by a workflow run
See all available options: gh_run_download
Examples: # Download a specific artifact within a run $ gh run download <run-id> -n <name> # Download specific artifacts across all runs in a repository $ gh run download -n <name1> -n <name2> # Select artifacts to download interactively $ gh run download
List GitHub Actions secrets
gh secret list

Displays secrets stored in GitHub Actions.
See all available options: gh secret list
List secrets at one of the following levels:
  • repository (default): available for GitHub Actions or Dependabot runs in a repository
  • environment: available for GitHub Actions runs for a deployment environment in a repository
  • organization: available for GitHub Actions, Dependabot, or Codespaces runs within an organization
  • user: available for your user
List workflow runs
gh run list

Lists historical workflow runs and their statuses.
gh_run_list
List workflows
gh workflow list

Shows all workflows defined in the repository.
See all the options available: gh_workflow_list
Gitlab CI
Cancel a GitLab job via API
curl --request POST https://gitlab.com/api/v4/projects/123/jobs/456/cancel --header "PRIVATE-TOKEN: <TOKEN>"

Cancels a running job via GitLab API.
Run a GitLab CI pipeline remotely
glab ci run

Remote triggering via the terminal. The `glab ci run` command is part of the official GitLab CLI. Unlike `gitlab-ci-local`, it does not execute anything on the local machine. It asks the GitLab API to create and start a real remote pipeline on the company’s servers or Runners
Run on a specific branch with variables:bashglab ci run -b main --variables KEY1:value1,KEY2:value2
Run a GitLab pipeline locally
gitlab-ci-local

Reads the file .gitlab-ci.yml and recreates the build environment in local Docker containers.
Quick installation (NPM): npm install -g gitlab-ci-local
To run a specific job: gitlab-ci-local job_name
List GitLab runners
gitlab-runner list

Lists all GitLab runners registered on the instance.
Trigger a pipeline via API
curl --request POST https://gitlab.com/api/v4/projects/123/ref/main/trigger/pipeline --form token=<TOKEN>

Triggers a remote pipeline run using the GitLab API.
Check GitLab Runner version
gitlab-runner --version

Displays the version and configuration of the runner.
Jenkins
Trigger a Jenkins job
java -jar jenkins-cli.jar -s http://localhost:8080/ build my-job

Triggers a Jenkins job remotely or manually.
List Jenkins jobs
java -jar jenkins-cli.jar -s http://localhost:8080/ list-jobs

Retrieves the list of jobs available in Jenkins.
Restart Jenkins
java -jar jenkins-cli.jar -s http://localhost:8080/ restart

Restarts the Jenkins service gracefully.
Validate Jenkinsfile
curl -X POST -F "jenkinsfile=<Jenkinsfile" \
http://localhost:8080/pipeline-model-converter/validate

Analyses and validates the syntax of the Jenkinsfile in Declarative Pipeline format, without executing it. It sends the local file to the validation API of a local Jenkins instance.
If the file is valid: The server returns a success message (e.g. Jenkinsfile successfully validated.).
If the file contains errors: The server displays the exact lines and syntax errors found.
If the file is secure, add your credentials or an API token