Skeleton for target and source branches

This commit is contained in:
Laszlo Fogas 2019-10-24 11:05:43 +02:00
parent 272a48ff2c
commit 85d8b16f90
3 changed files with 7 additions and 0 deletions

View file

@ -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:

View file

@ -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,

View file

@ -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 |