drone-gitlab-ci

command module
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 13 Imported by: 0

README

drone-gitlab-ci

logo

Lint and Testing GoDoc codecov Go Report Card

Drone plugin for trigger gitlab-ci jobs.

GitLab Setting

See the detail documentation for Pipeline trigger tokens API. You can create personal access tokens to authenticate with:

  1. The GitLab API.
  2. GitLab repositories.
  3. The GitLab registry.

See the GitLab token overview.

token

How to get the project ID? going to your project’s Settings ➔ General under Gerneral project.

projectID

Build or Download a binary

The pre-compiled binaries can be downloaded from release page. Support the following OS type.

  • Windows amd64/386
  • Linux amd64/386
  • Darwin amd64/386

With Go installed

go install github.com/appleboy/drone-gitlab-ci

or build the binary with the following command:

make build

Usage

There are three ways to trigger gitlab-ci jobs.

Usage from binary

trigger job.

drone-gitlab-ci \
  --host https://gitlab.com/ \
  --token XXXXXXXX \
  --ref master \
  --project-id gitlab-ci-project-id

Enable debug mode.

drone-gitlab-ci \
  --host https://gitlab.com/ \
  --token XXXXXXXX \
  --ref master \
  --project-id gitlab-ci-project-id
+ --debug
Usage from docker

trigger job.

docker run --rm \
  -e GITLAB_HOST=https://gitlab.com/
  -e GITLAB_TOKEN=xxxxx
  -e GITLAB_REF=master
  -e GITLAB_ID=gitlab-ci-project-id
  appleboy/drone-gitlab-ci

Enable debug mode.

docker run --rm \
  -e GITLAB_HOST=https://gitlab.com/ \
  -e GITLAB_TOKEN=xxxxx \
  -e GITLAB_REF=master \
  -e GITLAB_ID=gitlab-ci-project-id \
  -e GITLAB_DEBUG=true \
  appleboy/drone-gitlab-ci
Usage from drone ci

Execute from the working directory:

docker run --rm \
  -e PLUGIN_HOST=https://gitlab.com/ \
  -e PLUGIN_TOKEN=xxxxx \
  -e PLUGIN_REF=master \
  -e PLUGIN_ID=gitlab-ci-project-id \
  -e PLUGIN_DEBUG=true \
  -v $(pwd):$(pwd) \
  -w $(pwd) \
  appleboy/drone-gitlab-ci

You can get more information about how to use scp plugin in drone.

Testing

Test the package with the following command:

make test

Documentation

Overview

Package main provides functionality to interact with GitLab's API, specifically for creating and managing pipelines.

The Gitlab struct contains an authenticated client to communicate with the GitLab API.

Functions:

- NewGitlab: Initializes a new Gitlab client with the provided host, token, and configuration options. - CreatePipeline: Triggers the creation of a new pipeline in a specified GitLab project. - GetPipelineStatus: Retrieves the status of a specific pipeline for a given project.

Types:

- Gitlab: Contains the authenticated client for GitLab API interactions.

Dependencies:

- "crypto/tls" - "net/http" - "github.com/xanzy/go-gitlab"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL