support for legacy 0.8 env variables

pull/1/head
Brad Rydzewski 5 years ago
parent a111933214
commit 3104657412

@ -1,6 +1,19 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Latest
### Fixed
- text overflow for long commit messages
- error in step should bubble up to stage
### Added
- support for legacy CI_ environment variables
- support for registry plugins
- support for concurrency limits in yaml
- support for nodes in yaml
- helpers for working with docker auth config files
- helpers for tagging containers with labels
## [1.2.2] - 2019-09-28
### Fixed
- powershell scripts should check last exit code

@ -49,6 +49,16 @@ func Repo(repo *drone.Repo) map[string]string {
"DRONE_GIT_SSH_URL": repo.SSHURL,
"DRONE_REPO_VISIBILITY": repo.Visibility,
"DRONE_REPO_PRIVATE": fmt.Sprint(repo.Private),
// these are legacy configuration parameters for backward
// compatibility with drone 0.8. These are deprecated and
// should not be relied upon going forward.
"CI_REPO": repo.Slug,
"CI_REPO_NAME": repo.Slug,
"CI_REPO_LINK": repo.Link,
"CI_REPO_REMOTE": repo.HTTPURL,
"CI_REMOTE_URL": repo.HTTPURL,
"CI_REPO_PRIVATE": fmt.Sprint(repo.Private),
}
}
@ -119,6 +129,27 @@ func Build(build *drone.Build) map[string]string {
"DRONE_BUILD_STARTED": fmt.Sprint(build.Started),
"DRONE_BUILD_FINISHED": fmt.Sprint(build.Finished),
"DRONE_DEPLOY_TO": build.Deploy,
// these are legacy configuration parameters for backward
// compatibility with drone 0.8. These are deprecated and
// should not be relied upon going forward.
"CI_BUILD_NUMBER": fmt.Sprint(build.Number),
"CI_PARENT_BUILD_NUMBER": fmt.Sprint(build.Parent),
"CI_BUILD_CREATED": fmt.Sprint(build.Created),
"CI_BUILD_STARTED": fmt.Sprint(build.Started),
"CI_BUILD_FINISHED": fmt.Sprint(build.Finished),
"CI_BUILD_STATUS": build.Status,
"CI_BUILD_EVENT": build.Event,
"CI_BUILD_LINK": build.Link,
"CI_BUILD_TARGET": build.Deploy,
"CI_COMMIT_SHA": build.After,
"CI_COMMIT_REF": build.Ref,
"CI_COMMIT_BRANCH": build.Target,
"CI_COMMIT_MESSAGE": build.Message,
"CI_COMMIT_AUTHOR": build.Author,
"CI_COMMIT_AUTHOR_NAME": build.AuthorName,
"CI_COMMIT_AUTHOR_EMAIL": build.AuthorEmail,
"CI_COMMIT_AUTHOR_AVATAR": build.AuthorAvatar,
}
if isBuildFailing(build) {
env["DRONE_BUILD_STATUS"] = "failure"

@ -42,6 +42,13 @@ func TestRepo(t *testing.T) {
"DRONE_GIT_SSH_URL": "git@github.com:octocat/hello-world",
"DRONE_REPO_VISIBILITY": "internal",
"DRONE_REPO_PRIVATE": "true",
"CI_REMOTE_URL": "https://github.com/octocat/hello-world.git",
"CI_REPO": "octocat/hello-world",
"CI_REPO_LINK": "https://github.com/octocat/hello-world",
"CI_REPO_NAME": "octocat/hello-world",
"CI_REPO_PRIVATE": "true",
"CI_REPO_REMOTE": "https://github.com/octocat/hello-world.git",
}
if diff := cmp.Diff(a, b); diff != "" {
t.Fail()
@ -113,6 +120,24 @@ func TestBuild(t *testing.T) {
"DRONE_PULL_REQUEST": "32",
"DRONE_SOURCE_BRANCH": "develop",
"DRONE_TARGET_BRANCH": "master",
"CI_BUILD_CREATED": "1561421740",
"CI_BUILD_EVENT": "pull_request",
"CI_BUILD_FINISHED": "1561421753",
"CI_BUILD_LINK": "https://github.com/octocat/Hello-World/commit/762941318ee16e59dabbacb1b4049eec22f0d303",
"CI_BUILD_NUMBER": "1",
"CI_BUILD_STARTED": "1561421746",
"CI_BUILD_STATUS": "failure",
"CI_BUILD_TARGET": "prod",
"CI_COMMIT_AUTHOR": "octocat",
"CI_COMMIT_AUTHOR_AVATAR": "https://avatars0.githubusercontent.com/u/583231",
"CI_COMMIT_AUTHOR_EMAIL": "octocat@github.com",
"CI_COMMIT_AUTHOR_NAME": "The Octocat",
"CI_COMMIT_BRANCH": "master",
"CI_COMMIT_MESSAGE": "updated README",
"CI_COMMIT_REF": "refs/pull/32/head",
"CI_COMMIT_SHA": "762941318ee16e59dabbacb1b4049eec22f0d303",
"CI_PARENT_BUILD_NUMBER": "2",
}
if diff := cmp.Diff(a, b); diff != "" {
t.Fail()

Loading…
Cancel
Save