diff --git a/.drone.yml b/.drone.yml index 1cee7dc2d..a75012e15 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,6 +6,9 @@ pipeline: test: image: golang:1.12.4 commands: + - echo $CI_COMMIT_REF + - echo $CI_COMMIT_REFSPEC + - echo $DRONE_BRANCH - go test -cover -timeout 30s $(go list ./...) test_postgres: diff --git a/cncd/pipeline/pipeline/frontend/metadata.go b/cncd/pipeline/pipeline/frontend/metadata.go index c46791add..21ebcb1fb 100644 --- a/cncd/pipeline/pipeline/frontend/metadata.go +++ b/cncd/pipeline/pipeline/frontend/metadata.go @@ -205,6 +205,8 @@ func (m *Metadata) EnvironDrone() map[string]string { "DRONE_JOB_NUMBER": fmt.Sprintf("%d", m.Job.Number), "DRONE_JOB_STARTED": fmt.Sprintf("%d", m.Curr.Started), // ISSUE: no job started "DRONE_BRANCH": m.Curr.Commit.Branch, + "DRONE_TARGET_BRANCH": m.Curr.Commit.Branch, + "DRONE_SOURCE_BRANCH": m.Curr.Commit.Branch, "DRONE_COMMIT": m.Curr.Commit.Sha, "DRONE_VERSION": m.Sys.Version, "DRONE_DEPLOY_TO": m.Curr.Target, diff --git a/docs/usage/pipeline.md b/docs/usage/pipeline.md index e2f7c0f51..b7812b071 100644 --- a/docs/usage/pipeline.md +++ b/docs/usage/pipeline.md @@ -687,6 +687,8 @@ This is the reference list of all environment variables available to your build | `DRONE_JOB_STARTED` | job started | | `DRONE_JOB_FINISHED` | job finished | | `DRONE_BRANCH` | commit branch | +| `DRONE_TARGET_BRANCH` | The target branch of a Pull Request | +| `DRONE_SOURCE_BRANCH` | The source branch of a Pull Request | | `DRONE_COMMIT` | commit sha | | `DRONE_TAG` | commit tag | | `DRONE_PULL_REQUEST` | pull request number |