<commit_before>builder:
  track: stable

labels:
  app-group: estafette-ci
  team: estafette-team
  language: golang

version:
  semver:
    major: 0
    minor: 0

stages:
  build:
    image: golang:1.13.0-alpine3.10
    env:
      CGO_ENABLED: 0
      GOOS: linux
      GOARCH: amd64
    commands:
    - go test ./...
    - go build -v -ldflags "-X main.appgroup=${ESTAFETTE_LABEL_APP_GROUP} -X main.app=${ESTAFETTE_GIT_NAME} -X main.version=${ESTAFETTE_BUILD_VERSION} -X main.revision=${ESTAFETTE_GIT_REVISION} -X main.branch=${ESTAFETTE_GIT_BRANCH} -X main.buildDate=${ESTAFETTE_BUILD_DATETIME}" -o ./publish/${ESTAFETTE_GIT_NAME}

  bake-all:
    parallelStages:
      bake:
        image: extensions/docker:dev
        action: build
        no-cache: true
        expand-variables: false
        repositories:
        - estafette
        path: ./publish

      bake-gocd-agent:
        image: extensions/docker:dev
        action: build
        no-cache: true
        expand-variables: false
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        path: ./publish
        dockerfile: Dockerfile.gocd

  clean-working-directory:
    image: golang:1.13.0-alpine3.10
    commands:
    - rm -rf ..?* .[!.]* *

  test:
    image: estafette/estafette-ci-builder:${ESTAFETTE_BUILD_VERSION}
    env:
      BUILDER_CONFIG:
        '{
          "action":"build",
          "track":"dev",
          "dindMtu":"1460",
          "dindBip":"192.168.2.1/24",
          "manifest":{
            "Builder":{
              "Track":"stable",
              "OperatingSystem":"linux"
            },
            "Labels":{
              "app":"estafette-ci-builder",
              "app-group":"estafette-ci",
              "language":"golang",
              "team":"estafette-team"
            },
            "Version":{
              "SemVer":{
                "Major":0,
                "Minor":0,
                "Patch":"{{auto}}",
                "LabelTemplate":"{{branch}}",
                "ReleaseBranch":"master"
              },
              "Custom":null
            },
            "GlobalEnvVars":null,
            "Stages":[
              {
                "Name":"services-test",
                "ContainerImage":"alpine:latest",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands": [
                  "apk add curl",
                  "curl -v --connect-timeout 2 --retry 10 --retry-delay 20 http://nginx:8080/"
                ],
                "When":"status == ''succeeded''",
                "EnvVars":null,
                "AutoInjected":false,
                "Retries":0,
                "Services": [
                  {
                    "Name": "nginx",
                    "ContainerImage": "nginx:alpine",
                    "Ports": [
                      {
                        "Port": 8080
                      }
                    ]
                  }
                ]
              },
              {
                "Name":"git-clone",
                "ContainerImage":"extensions/git-clone:dev",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":null,
                "shallow": false,
                "When":"status == ''succeeded''",
                "EnvVars":null,
                "AutoInjected":true,
                "Retries":0,
                "CustomProperties":null
              },
              {
                "Name":"build",
                "ContainerImage":
                "golang:1.13.0-alpine3.10",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":[
                  "go test ./...",
                  "go build -v -ldflags \"-X main.version=${ESTAFETTE_BUILD_VERSION} -X main.revision=${ESTAFETTE_GIT_REVISION} -X main.branch=${ESTAFETTE_GIT_BRANCH} -X main.buildDate=${ESTAFETTE_BUILD_DATETIME}\" -o ./publish/${ESTAFETTE_GIT_NAME}"
                ],
                "When":"status == ''succeeded''",
                "EnvVars":{
                  "CGO_ENABLED":"0",
                  "GOOS":"linux",
                  "GOARCH":"amd64"
                },
                "AutoInjected":false,
                "Retries":0,
                "CustomProperties":null
              },
              {
                "Name":"bake-estafette",
                "ContainerImage":"extensions/docker:dev",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":null,
                "When":"status == ''succeeded''",
                "EnvVars":null,
                "AutoInjected":false,
                "Retries":0,
                "CustomProperties":{
                  "action":"build",
                  "no-cache":true,
                  "expand-variables":false,
                  "path":"./publish",
                  "repositories":["estafette"]
                }
              },
              {
                "Name":"parallel-builds",
                "ContainerImage":"",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":[],
                "When":"status == ''succeeded''",
                "EnvVars":{},
                "AutoInjected":false,
                "Retries":0,
                "CustomProperties":null,
                "ParallelStages":[
                  {
                    "Name":"buildA",
                    "ContainerImage":
                    "golang:1.13.0-alpine3.10",
                    "Shell":"/bin/sh",
                    "WorkingDirectory":"/estafette-work",
                    "Commands":[
                      "go test ./...",
                      "go build -v -ldflags \"-X main.version=${ESTAFETTE_BUILD_VERSION} -X main.revision=${ESTAFETTE_GIT_REVISION} -X main.branch=${ESTAFETTE_GIT_BRANCH} -X main.buildDate=${ESTAFETTE_BUILD_DATETIME}\" -o ./publish/${ESTAFETTE_GIT_NAME}"
                    ],
                    "When":"status == ''succeeded''",
                    "EnvVars":{
                      "CGO_ENABLED":"0",
                      "GOOS":"linux",
                      "GOARCH":"amd64"
                    },
                    "AutoInjected":false,
                    "Retries":0,
                    "CustomProperties":null
                  },
                  {
                    "Name":"bakeB",
                    "ContainerImage":"extensions/docker:dev",
                    "Shell":"/bin/sh",
                    "WorkingDirectory":"/estafette-work",
                    "Commands":null,
                    "When":"status == ''succeeded''",
                    "EnvVars":null,
                    "AutoInjected":false,
                    "Retries":0,
                    "CustomProperties":{
                      "action":"build",
                      "no-cache":true,
                      "expand-variables":false,
                      "path":"./publish",
                      "repositories":["estafette"]
                    }
                  }
                ]
              }
            ],
            "Releases":null
          },
          "jobName":"build-estafette-estafette-ci-builder-391855387650326531",
          "ciServer":{
            "baseUrl":"https://httpstat.us/200",
            "builderEventsUrl":"https://httpstat.us/200",
            "postLogsUrl":"https://httpstat.us/200",
            "apiKey":""
          },
          "buildParams":{
            "buildID":391855387650326531
          },
          "git":{
            "repoSource":"github.com",
            "repoOwner":"estafette",
            "repoName":"estafette-ci-builder",
            "repoBranch":"integration-test",
            "repoRevision":"4ba7791566e3f6f69e8542183168ec9b1ad03ca7"
          },
          "buildVersion":{
            "version":"0.0.0-integration-test",
            "major":0,
            "minor":0,
            "patch":"0",
            "autoincrement":0
          },
          "credentials":null,
          "trustedImages":[
            {
              "path":"extensions/docker",
              "runDocker":true
            },
            {
              "path":"estafette/estafette-ci-builder",
              "runPrivileged":true
            },
            {
              "path":"golang",
              "runDocker":true,
              "allowCommands":true
            },
            {
              "path":"extensions/git-clone"
            },
            {
              "path":"bsycorp/kind",
              "runPrivileged":true
            }
          ]
        }'
      SECRET_DECRYPTION_KEY: "8c6E5e7R8ameE2L6qxEcN5Yc3Q7P4Yd4"

  push-all:
    parallelStages:
      push-to-docker-hub:
        image: extensions/docker:dev
        action: push
        repositories:
        - estafette

      push-to-gcr-io:
        image: extensions/docker:dev
        action: push
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)

  slack-notify:
    image: extensions/slack-build-status:dev
    workspace: estafette
    channels:
    - '#build-status'
    when:
      status == 'succeeded' ||
      status == 'failed'

releases:
  windows:
    builder:
      os: windows
    clone: true
    stages:
      build:
        image: golang:1.13.0-windowsservercore-1809
        env:
          CGO_ENABLED: 0
          GOOS: windows
          GOARCH: amd64
        commands:
        - go build -v -ldflags "-X main.app=$env:ESTAFETTE_GIT_NAME -X main.version=$env:ESTAFETTE_BUILD_VERSION -X main.revision=$env:ESTAFETTE_GIT_REVISION -X main.branch=$env:ESTAFETTE_GIT_BRANCH -X main.buildDate=$env:ESTAFETTE_BUILD_DATETIME" -o ./publish/$env:ESTAFETTE_GIT_NAME.exe

      bake:
        image: extensions/docker:windowsservercore-1809
        action: build
        no-cache: true
        expand-variables: false
        repositories:
        - estafette
        dockerfile: Dockerfile.windowsservercore-1809
        path: ./publish

      push-to-docker-hub:
        image: extensions/docker:windowsservercore-1809
        action: push
        repositories:
        - estafette
        tags:
        - windowsservercore-1809
        pushVersionTag: false

  dev:
    triggers:
    - pipeline:
        name: self
        branch: .+
    stages:
      tag-container-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette
        tags:
        - dev

      tag-gcr-io-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        tags:
        - dev

  beta:
    stages:
      tag-container-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette
        tags:
        - beta

      tag-gcr-io-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        tags:
        - beta

      slack-notify:
        image: extensions/slack-build-status:dev
        workspace: estafette
        channels:
        - '#build-status'
        when:
          status == 'succeeded' ||
          status == 'failed'

  stable:
    stages:
      tag-container-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette
        tags:
        - stable
        - latest

      tag-gcr-io-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        tags:
        - stable
        - latest

      slack-notify:
        image: extensions/slack-build-status:dev
        workspace: estafette
        channels:
        - '#build-status'
        when:
          status == 'succeeded' ||
          status == 'failed'<commit_msg>retry connection to service container when connection's refused<commit_after>builder:
  track: stable

labels:
  app-group: estafette-ci
  team: estafette-team
  language: golang

version:
  semver:
    major: 0
    minor: 0

stages:
  build:
    image: golang:1.13.0-alpine3.10
    env:
      CGO_ENABLED: 0
      GOOS: linux
      GOARCH: amd64
    commands:
    - go test ./...
    - go build -v -ldflags "-X main.appgroup=${ESTAFETTE_LABEL_APP_GROUP} -X main.app=${ESTAFETTE_GIT_NAME} -X main.version=${ESTAFETTE_BUILD_VERSION} -X main.revision=${ESTAFETTE_GIT_REVISION} -X main.branch=${ESTAFETTE_GIT_BRANCH} -X main.buildDate=${ESTAFETTE_BUILD_DATETIME}" -o ./publish/${ESTAFETTE_GIT_NAME}

  bake-all:
    parallelStages:
      bake:
        image: extensions/docker:dev
        action: build
        no-cache: true
        expand-variables: false
        repositories:
        - estafette
        path: ./publish

      bake-gocd-agent:
        image: extensions/docker:dev
        action: build
        no-cache: true
        expand-variables: false
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        path: ./publish
        dockerfile: Dockerfile.gocd

  clean-working-directory:
    image: golang:1.13.0-alpine3.10
    commands:
    - rm -rf ..?* .[!.]* *

  test:
    image: estafette/estafette-ci-builder:${ESTAFETTE_BUILD_VERSION}
    env:
      BUILDER_CONFIG:
        '{
          "action":"build",
          "track":"dev",
          "dindMtu":"1460",
          "dindBip":"192.168.2.1/24",
          "manifest":{
            "Builder":{
              "Track":"stable",
              "OperatingSystem":"linux"
            },
            "Labels":{
              "app":"estafette-ci-builder",
              "app-group":"estafette-ci",
              "language":"golang",
              "team":"estafette-team"
            },
            "Version":{
              "SemVer":{
                "Major":0,
                "Minor":0,
                "Patch":"{{auto}}",
                "LabelTemplate":"{{branch}}",
                "ReleaseBranch":"master"
              },
              "Custom":null
            },
            "GlobalEnvVars":null,
            "Stages":[
              {
                "Name":"services-test",
                "ContainerImage":"alpine:latest",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands": [
                  "apk add curl",
                  "curl -v --connect-timeout 2 --retry 10 --retry-connrefuse http://nginx:8080/"
                ],
                "When":"status == ''succeeded''",
                "EnvVars":null,
                "AutoInjected":false,
                "Retries":0,
                "Services": [
                  {
                    "Name": "nginx",
                    "ContainerImage": "nginx:alpine",
                    "Ports": [
                      {
                        "Port": 8080
                      }
                    ]
                  }
                ]
              },
              {
                "Name":"git-clone",
                "ContainerImage":"extensions/git-clone:dev",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":null,
                "shallow": false,
                "When":"status == ''succeeded''",
                "EnvVars":null,
                "AutoInjected":true,
                "Retries":0,
                "CustomProperties":null
              },
              {
                "Name":"build",
                "ContainerImage":
                "golang:1.13.0-alpine3.10",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":[
                  "go test ./...",
                  "go build -v -ldflags \"-X main.version=${ESTAFETTE_BUILD_VERSION} -X main.revision=${ESTAFETTE_GIT_REVISION} -X main.branch=${ESTAFETTE_GIT_BRANCH} -X main.buildDate=${ESTAFETTE_BUILD_DATETIME}\" -o ./publish/${ESTAFETTE_GIT_NAME}"
                ],
                "When":"status == ''succeeded''",
                "EnvVars":{
                  "CGO_ENABLED":"0",
                  "GOOS":"linux",
                  "GOARCH":"amd64"
                },
                "AutoInjected":false,
                "Retries":0,
                "CustomProperties":null
              },
              {
                "Name":"bake-estafette",
                "ContainerImage":"extensions/docker:dev",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":null,
                "When":"status == ''succeeded''",
                "EnvVars":null,
                "AutoInjected":false,
                "Retries":0,
                "CustomProperties":{
                  "action":"build",
                  "no-cache":true,
                  "expand-variables":false,
                  "path":"./publish",
                  "repositories":["estafette"]
                }
              },
              {
                "Name":"parallel-builds",
                "ContainerImage":"",
                "Shell":"/bin/sh",
                "WorkingDirectory":"/estafette-work",
                "Commands":[],
                "When":"status == ''succeeded''",
                "EnvVars":{},
                "AutoInjected":false,
                "Retries":0,
                "CustomProperties":null,
                "ParallelStages":[
                  {
                    "Name":"buildA",
                    "ContainerImage":
                    "golang:1.13.0-alpine3.10",
                    "Shell":"/bin/sh",
                    "WorkingDirectory":"/estafette-work",
                    "Commands":[
                      "go test ./...",
                      "go build -v -ldflags \"-X main.version=${ESTAFETTE_BUILD_VERSION} -X main.revision=${ESTAFETTE_GIT_REVISION} -X main.branch=${ESTAFETTE_GIT_BRANCH} -X main.buildDate=${ESTAFETTE_BUILD_DATETIME}\" -o ./publish/${ESTAFETTE_GIT_NAME}"
                    ],
                    "When":"status == ''succeeded''",
                    "EnvVars":{
                      "CGO_ENABLED":"0",
                      "GOOS":"linux",
                      "GOARCH":"amd64"
                    },
                    "AutoInjected":false,
                    "Retries":0,
                    "CustomProperties":null
                  },
                  {
                    "Name":"bakeB",
                    "ContainerImage":"extensions/docker:dev",
                    "Shell":"/bin/sh",
                    "WorkingDirectory":"/estafette-work",
                    "Commands":null,
                    "When":"status == ''succeeded''",
                    "EnvVars":null,
                    "AutoInjected":false,
                    "Retries":0,
                    "CustomProperties":{
                      "action":"build",
                      "no-cache":true,
                      "expand-variables":false,
                      "path":"./publish",
                      "repositories":["estafette"]
                    }
                  }
                ]
              }
            ],
            "Releases":null
          },
          "jobName":"build-estafette-estafette-ci-builder-391855387650326531",
          "ciServer":{
            "baseUrl":"https://httpstat.us/200",
            "builderEventsUrl":"https://httpstat.us/200",
            "postLogsUrl":"https://httpstat.us/200",
            "apiKey":""
          },
          "buildParams":{
            "buildID":391855387650326531
          },
          "git":{
            "repoSource":"github.com",
            "repoOwner":"estafette",
            "repoName":"estafette-ci-builder",
            "repoBranch":"integration-test",
            "repoRevision":"4ba7791566e3f6f69e8542183168ec9b1ad03ca7"
          },
          "buildVersion":{
            "version":"0.0.0-integration-test",
            "major":0,
            "minor":0,
            "patch":"0",
            "autoincrement":0
          },
          "credentials":null,
          "trustedImages":[
            {
              "path":"extensions/docker",
              "runDocker":true
            },
            {
              "path":"estafette/estafette-ci-builder",
              "runPrivileged":true
            },
            {
              "path":"golang",
              "runDocker":true,
              "allowCommands":true
            },
            {
              "path":"extensions/git-clone"
            },
            {
              "path":"bsycorp/kind",
              "runPrivileged":true
            }
          ]
        }'
      SECRET_DECRYPTION_KEY: "<KEY>"

  push-all:
    parallelStages:
      push-to-docker-hub:
        image: extensions/docker:dev
        action: push
        repositories:
        - estafette

      push-to-gcr-io:
        image: extensions/docker:dev
        action: push
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)

  slack-notify:
    image: extensions/slack-build-status:dev
    workspace: estafette
    channels:
    - '#build-status'
    when:
      status == 'succeeded' ||
      status == 'failed'

releases:
  windows:
    builder:
      os: windows
    clone: true
    stages:
      build:
        image: golang:1.13.0-windowsservercore-1809
        env:
          CGO_ENABLED: 0
          GOOS: windows
          GOARCH: amd64
        commands:
        - go build -v -ldflags "-X main.app=$env:ESTAFETTE_GIT_NAME -X main.version=$env:ESTAFETTE_BUILD_VERSION -X main.revision=$env:ESTAFETTE_GIT_REVISION -X main.branch=$env:ESTAFETTE_GIT_BRANCH -X main.buildDate=$env:ESTAFETTE_BUILD_DATETIME" -o ./publish/$env:ESTAFETTE_GIT_NAME.exe

      bake:
        image: extensions/docker:windowsservercore-1809
        action: build
        no-cache: true
        expand-variables: false
        repositories:
        - estafette
        dockerfile: Dockerfile.windowsservercore-1809
        path: ./publish

      push-to-docker-hub:
        image: extensions/docker:windowsservercore-1809
        action: push
        repositories:
        - estafette
        tags:
        - windowsservercore-1809
        pushVersionTag: false

  dev:
    triggers:
    - pipeline:
        name: self
        branch: .+
    stages:
      tag-container-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette
        tags:
        - dev

      tag-gcr-io-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        tags:
        - dev

  beta:
    stages:
      tag-container-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette
        tags:
        - beta

      tag-gcr-io-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        tags:
        - beta

      slack-notify:
        image: extensions/slack-build-status:dev
        workspace: estafette
        channels:
        - '#build-status'
        when:
          status == 'succeeded' ||
          status == 'failed'

  stable:
    stages:
      tag-container-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette
        tags:
        - stable
        - latest

      tag-gcr-io-image:
        image: extensions/docker:dev
        action: tag
        repositories:
        - estafette.secret(ugcaPF_CdqMZsxsh.4ZumU_A0ufxsjV3MPInyc1VjATZgX9hcB2KQM1KDIOQs)
        tags:
        - stable
        - latest

      slack-notify:
        image: extensions/slack-build-status:dev
        workspace: estafette
        channels:
        - '#build-status'
        when:
          status == 'succeeded' ||
          status == 'failed'
{'fraction_non_alphanumeric': 0.12612128477532966, 'fraction_numerical': 0.018271257905832748, 'mean_word_length': 1.3125896185833095, 'pattern_counts': {'":': 296, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '177641', 'n_tokens_mistral': 7615, 'n_tokens_neox': 7018, 'n_words': 957}