Skip to content

Commit

Permalink
feature: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippHeuer committed Aug 30, 2019
0 parents commit f5c559b
Show file tree
Hide file tree
Showing 23 changed files with 1,312 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Auto detect text files and perform LF normalization
* text=auto

# Bash Scripts
*.sh text eol=lf
*.bash text eol=lf
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# docs: https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: CI

on: [push]

jobs:
# stages
build:
# runtime environment
runs-on: ubuntu-latest

# jobs
steps:
# checkout
- uses: actions/checkout@v1
with:
fetch-depth: 1
# prepare environment
- name: Prepare Environment
run: |
curl https://raw.githubusercontent.com/EnvCLI/modular-pipeline/master/install.sh | sh
# pipeline steps
- name: Test
run: |
go-test
- name: Build
run: |
go-build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated artifacts
dist/*
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# normalize.ci

> A tool to turn the continious integration / deployment variables into a common format for generally usable scripts without any dependencies.
## usage

dowonload the provided library and run it ...

```bash
// TODO
```

## normalized variables

- [Specification: Variables](docs/spec/variables.md)

## supported systems

NAME | SLUG
--- | --- |
[Azure DevOps Pipeline](docs/system/azure-devops-pipeline.md) | `azure-devops`
[GitLab CI/CD](docs/system/gitlab-ci.md) | `gitlab-ci`
[GitHub Actions](docs/system/github-actions.md) | `github-actions`

*Note:* If none of the above systems is detected, repository information is determined based on the local Git repository.
5 changes: 5 additions & 0 deletions docs/spec/types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Variable Types

## SLUG

> lowercased, and with everything except 0-9 and a-z replaced with -. No leading / trailing -.
62 changes: 62 additions & 0 deletions docs/spec/variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Variables

If a system already provides `NCI` compliant variables, then it can set `NCI` to true to prevent this script from being executed.
In that case it's required to set `NCI_VERSION` to the implemented specification, to allow scripts to run actions if a newer spec is released.

## common

Variable | Description
--- | --- |
`NCI` | Will be set the true, if the variables have been normalized. (this script)
`NCI_VERSION` | The revision of nci that was used to generate the normalized variables.
`NCI_SERVICE_NAME` | The commercial name of the used ci service. (e.g. GitLab CI, Travis CI, CircleCI, Jenkins)
`NCI_SERVICE_SLUG` | The commercial name normalized as slug for use in scripts, will not be changed.

## server

Variable | Description
--- | --- |
`NCI_SERVER_NAME` | The commercial name of the vcs server.
`NCI_SERVER_HOST` | The hostname that the vcs server is running on.
`NCI_SERVER_VERSION` | The running version of the vcs server.

## worker

Variable | Description
--- | --- |
`NCI_WORKER_ID` | A unique id of the ci worker.
`NCI_WORKER_NAME` | The human readable name of the ci worker.
`NCI_WORKER_VERSION` | The version of the ci worker.
`NCI_WORKER_ARCH` | The arch of the ci worker. (ie. linux/amd64)

## pipeline

Variable | Description
--- | --- |
`NCI_PIPELINE_TRIGGER` | What triggered the pipeline. (ie. manual/push/trigger/api/schedule/pull_request/build)
`NCI_PIPELINE_STAGE_NAME` | Human readable name of the current stage.
`NCI_PIPELINE_STAGE_SLUG` | Slug of the current stage.
`NCI_PIPELINE_JOB_NAME` | Human readable name of the current job.
`NCI_PIPELINE_JOB_SLUG` | Slug of the current job.
`NCI_PIPELINE_PULL_REQUEST_ID` | The number of the pull request, is only present if `NCI_PIPELINE_TRIGGER` = pull_request.

## project

Variable | Description
--- | --- |
`NCI_PROJECT_ID` | Unique project id, can be used in deployments.
`NCI_PROJECT_NAME` | Unique project id, can be used in deployments.

## repository

Variable | Description
--- | --- |
`NCI_REPOSITORY_KIND` | The used version control system. (git)
`NCI_REPOSITORY_REMOTE` | The remote url pointing at the repository. (git remote url or `local` if no remote was found)
`NCI_COMMIT_REF_TYPE` | The reference type. (branch / tag)
`NCI_COMMIT_REF_NAME` | Human readable name of the current repository reference.
`NCI_COMMIT_REF_SLUG` | Slug of the current repository reference.
`NCI_COMMIT_SHA` | A unique hash, that each commit gets.
`NCI_COMMIT_SHA_SHORT` | A short form of the unique commit hash. (8 chars)
`NCI_COMMIT_TITLE` | The title of the latest commit on the current reference.
`NCI_COMMIT_DESCRIPTION` | The description of the latest commit on the current reference.
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module github.com/PhilippHeuer/normalize-ci

go 1.12

require (
github.com/sirupsen/logrus v1.4.2
gopkg.in/src-d/go-git.v4 v4.13.1
)
83 changes: 83 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
github.com/PhilippHeuer/normalize.ci v0.0.0-20190815223534-5a3ca3eceacb h1:oSuhFc/YfIoBavi9t5Y5D5kzd0XjoVNa/DwrGcPQMxY=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY=
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
github.com/philippheuer/normalize-ci v0.0.0-20190815223534-5a3ca3eceacb h1:PJb+htauJY9RY5FqBINZGm6P07hcPrYobm/1sflywew=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4=
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e h1:D5TXcfTk7xF7hvieo4QErS3qqCB4teTffacDWr7CI+0=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
golang.org/x/tools v0.0.0-20190820033707-85edb9ef3283/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg=
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
gopkg.in/src-d/go-git.v4 v4.13.1 h1:SRtFyV8Kxc0UP7aCHcijOMQGPxHSmMOPrzulQWolkYE=
gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
9 changes: 9 additions & 0 deletions pkg/azuredevops/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Azure DevOps Pipeline

## sources

- [Predefined variables](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&abs=yaml#agent-variables)

## detection

By checking for the presence of the environment variable `TF_BUILD`.
90 changes: 90 additions & 0 deletions pkg/azuredevops/azuredevops.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package azuredevops

import (
"runtime"

"github.com/PhilippHeuer/normalize-ci/pkg/common"
)

// Normalizer is the implementation of the normalizer
type Normalizer struct {
version string
name string
slug string
}

// GetName returns the name of the normalizer
func (n Normalizer) GetName() string {
return n.name
}

// Check validates that the current environment is gitlab ci
func (n Normalizer) Check(env []string) bool {
if common.IsEnvironmentSetTo(env, "TF_BUILD", "true") {
return true
}

return false
}

// Normalize normalizes the environment variables into the common format
func (n Normalizer) Normalize(env []string) []string {
var normalized []string

// common
normalized = append(normalized, "NCI=true")
normalized = append(normalized, "NCI_VERSION="+n.version)
normalized = append(normalized, "NCI_SERVICE_NAME="+n.name)
normalized = append(normalized, "NCI_SERVICE_SLUG="+n.slug)

// server
normalized = append(normalized, "NCI_SERVER_NAME="+common.GetEnvironment(env, "BUILD_REPOSITORY_PROVIDER"))
normalized = append(normalized, "NCI_SERVER_HOST="+common.GetHostFromURL(common.GetEnvironment(env, "BUILD_REPOSITORY_URI")))
normalized = append(normalized, "NCI_SERVER_VERSION=")

// worker
normalized = append(normalized, "NCI_WORKER_ID="+common.GetEnvironment(env, "AGENT_ID"))
normalized = append(normalized, "NCI_WORKER_NAME="+common.GetEnvironment(env, "AGENT_MACHINENAME"))
normalized = append(normalized, "NCI_WORKER_VERSION="+common.GetEnvironment(env, "AGENT_VERSION"))
normalized = append(normalized, "NCI_WORKER_ARCH="+runtime.GOOS+"/"+runtime.GOARCH)

// pipeline
if common.GetEnvironment(env, "BUILD_REASON") == "Manual" {
normalized = append(normalized, "NCI_PIPELINE_TRIGGER=manual")
} else if common.GetEnvironment(env, "BUILD_REASON") == "IndividualCI" || common.GetEnvironment(env, "BUILD_REASON") == "BatchedCI" {
normalized = append(normalized, "NCI_PIPELINE_TRIGGER=push")
} else if common.GetEnvironment(env, "BUILD_REASON") == "Schedule" {
normalized = append(normalized, "NCI_PIPELINE_TRIGGER=schedule")
} else if common.GetEnvironment(env, "BUILD_REASON") == "PullRequest" {
normalized = append(normalized, "NCI_PIPELINE_TRIGGER=pull_request")
} else if common.GetEnvironment(env, "BUILD_REASON") == "BuildCompletion" {
normalized = append(normalized, "NCI_PIPELINE_TRIGGER=build")
} else {
normalized = append(normalized, "NCI_PIPELINE_TRIGGER=unknown")
}
normalized = append(normalized, "NCI_PIPELINE_STAGE_NAME="+common.GetEnvironment(env, "SYSTEM_STAGENAME")) // SYSTEM_STAGEDISPLAYNAME
normalized = append(normalized, "NCI_PIPELINE_STAGE_SLUG="+common.GetSlug(common.GetEnvironment(env, "SYSTEM_STAGENAME")))
normalized = append(normalized, "NCI_PIPELINE_JOB_NAME="+common.GetEnvironment(env, "SYSTEM_JOBNAME")) // SYSTEM_JOBDISPLAYNAME
normalized = append(normalized, "NCI_PIPELINE_JOB_SLUG="+common.GetSlug(common.GetEnvironment(env, "SYSTEM_JOBNAME")))

// project
normalized = append(normalized, "NCI_PROJECT_ID="+common.GetEnvironment(env, "SYSTEM_TEAMPROJECTID"))
normalized = append(normalized, "NCI_PROJECT_NAME="+common.GetEnvironment(env, "SYSTEM_TEAMPROJECT"))
normalized = append(normalized, "NCI_PROJECT_SLUG="+common.GetSlug(common.GetEnvironment(env, "SYSTEM_TEAMPROJECT")))

// repository
normalized = append(normalized, common.GetSCMArguments(common.GetGitDirectory())...)

return normalized
}

// NewNormalizer gets a instance of the normalizer
func NewNormalizer() Normalizer {
entity := Normalizer{
version: "0.1.0",
name: "Azure DevOps Pipeline",
slug: "azure-devops",
}

return entity
}
Loading

0 comments on commit f5c559b

Please sign in to comment.