github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/cloudbuild/const.go (about)

     1  // Copyright 2022 Harness, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package cloudbuild
    16  
    17  var envMapping = map[string]string{
    18  	"PROJECT_ID":     "HARNESS_PROJECT_ID",  // the project ID of the build.
    19  	"PROJECT_NUMBER": "HARNESS_PROJECT_ID",  // (TODO) the project number of the build.
    20  	"LOCATION":       "LOCATION",            // (TODO) the location/region of the build.
    21  	"BUILD_ID":       "DRONE_BUILD_NUMBER",  // the autogenerated ID of the build.
    22  	"REPO_NAME":      "DRONE_REPO_NAME",     // the source repository name specified by RepoSource.
    23  	"BRANCH_NAME":    "DRONE_COMMIT_BRANCH", // the branch name specified by RepoSource.
    24  	"TAG_NAME":       "DRONE_TAG",           // the tag name specified by RepoSource.
    25  	"REVISION_ID":    "DRONE_COMMIT_SHA",    // the commit SHA specified by RepoSource or resolved from the specified branch or tag.
    26  	"COMMIT_SHA":     "DRONE_COMMIT_SHA",    // the commit SHA specified by RepoSource or resolved from the specified branch or tag.
    27  	"SHORT_SHA":      "DRONE_COMMIT_SHA",    // first 7 characters of $REVISION_ID or $COMMIT_SHA.
    28  }
    29  
    30  var envMappingJexl = map[string]string{
    31  	"PROJECT_ID":     "<+project.name>",
    32  	"PROJECT_NUMBER": "<+pipeline.sequenceId>",
    33  	"BUILD_ID":       "<+pipeline.sequenceId>",
    34  	"REPO_NAME":      "<+trigger.payload.repository.name>",
    35  	"BRANCH_NAME":    "<+trigger.branch>",
    36  	"TAG_NAME":       "<+trigger.commitSha>",
    37  	"REVISION_ID":    "<+trigger.commitSha>",
    38  	"COMMIT_SHA":     "<+trigger.commitSha>",
    39  	"SHORT_SHA":      "<+codebase.shortCommitSha>",
    40  }