Update pipeline drone-docker-harness: Add matrix strategy at step level. (#481)

* Update pipeline drone-docker-harness

* Update pipeline drone-docker-harness

* Update pipeline drone-docker-harness: Add matrix strategy at step level.

* Update inputset event-Push

* Update inputset event-Tag

* Update inputset event-PR

---------

Co-authored-by: ompragash.viswanathan@harness.io <ompragash.viswanathan@harness.io>
Co-authored-by: Devansh Mathur <devanshmathur@harness.io>
This commit is contained in:
ci-reporunner
2025-03-26 16:23:45 +05:30
committed by GitHub
parent 44157a2e29
commit 57234fcfd0
4 changed files with 156 additions and 428 deletions
-112
View File
@@ -13,115 +13,3 @@ inputSet:
type: PR type: PR
spec: spec:
number: <+trigger.prNumber> number: <+trigger.prNumber>
stages:
- parallel:
- stage:
identifier: linamd64
type: CI
spec:
execution:
steps:
- step:
identifier: Build_Push
type: Run
spec:
command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
- step:
identifier: Docker_Build_and_Push
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
auto_tag_suffix: linux-amd64
- step:
identifier: BuildAndPushDockerRegistry_1
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- linux-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
- stage:
identifier: linarm64
type: CI
spec:
execution:
steps:
- step:
identifier: buildpush
type: Run
spec:
command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
- step:
identifier: Docker_Build_and_Push
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
auto_tag_suffix: linux-arm64
- step:
identifier: BuildAndPushDockerRegistry_1
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- linux-arm64
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
- stage:
identifier: win1809amd64
type: CI
spec:
execution:
steps:
- step:
identifier: Docker_Build_and_Push1
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
auto_tag_suffix: windows-1809-amd64
- step:
identifier: BuildAndPushDockerRegistry_2
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- windows-1809-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
- stage:
identifier: winamd64
type: CI
spec:
execution:
steps:
- step:
identifier: Docker_Build_and_Push1
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
auto_tag_suffix: windows-ltsc2022-amd64
- step:
identifier: BuildAndPushDockerRegistry_2
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- windows-ltsc2022-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- stage:
identifier: Manifest
type: CI
spec:
execution:
steps:
- step:
identifier: Plugin_1
type: Plugin
spec:
settings:
spec: docker/<+matrix.repo>/manifest.tmpl
-112
View File
@@ -13,115 +13,3 @@ inputSet:
type: branch type: branch
spec: spec:
branch: <+trigger.branch> branch: <+trigger.branch>
stages:
- parallel:
- stage:
identifier: linamd64
type: CI
spec:
execution:
steps:
- step:
identifier: Build_Push
type: Run
spec:
command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
- step:
identifier: Docker_Build_and_Push
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
auto_tag_suffix: linux-amd64
- step:
identifier: BuildAndPushDockerRegistry_1
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- linux-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
- stage:
identifier: linarm64
type: CI
spec:
execution:
steps:
- step:
identifier: buildpush
type: Run
spec:
command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
- step:
identifier: Docker_Build_and_Push
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
auto_tag_suffix: linux-arm64
- step:
identifier: BuildAndPushDockerRegistry_1
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- linux-arm64
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
- stage:
identifier: win1809amd64
type: CI
spec:
execution:
steps:
- step:
identifier: Docker_Build_and_Push1
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
auto_tag_suffix: windows-1809-amd64
- step:
identifier: BuildAndPushDockerRegistry_2
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- windows-1809-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
- stage:
identifier: winamd64
type: CI
spec:
execution:
steps:
- step:
identifier: Docker_Build_and_Push1
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
auto_tag_suffix: windows-ltsc2022-amd64
- step:
identifier: BuildAndPushDockerRegistry_2
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- windows-ltsc2022-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- stage:
identifier: Manifest
type: CI
spec:
execution:
steps:
- step:
identifier: Plugin_1
type: Plugin
spec:
settings:
spec: docker/<+matrix.repo>/manifest.tmpl
-112
View File
@@ -13,115 +13,3 @@ inputSet:
type: tag type: tag
spec: spec:
tag: <+trigger.tag> tag: <+trigger.tag>
stages:
- parallel:
- stage:
identifier: linamd64
type: CI
spec:
execution:
steps:
- step:
identifier: Build_Push
type: Run
spec:
command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
- step:
identifier: Docker_Build_and_Push
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
auto_tag_suffix: linux-amd64
- step:
identifier: BuildAndPushDockerRegistry_1
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- linux-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
- stage:
identifier: linarm64
type: CI
spec:
execution:
steps:
- step:
identifier: buildpush
type: Run
spec:
command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
- step:
identifier: Docker_Build_and_Push
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
auto_tag_suffix: linux-arm64
- step:
identifier: BuildAndPushDockerRegistry_1
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- linux-arm64
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
- stage:
identifier: win1809amd64
type: CI
spec:
execution:
steps:
- step:
identifier: Docker_Build_and_Push1
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
auto_tag_suffix: windows-1809-amd64
- step:
identifier: BuildAndPushDockerRegistry_2
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- windows-1809-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
- stage:
identifier: winamd64
type: CI
spec:
execution:
steps:
- step:
identifier: Docker_Build_and_Push1
type: Plugin
spec:
settings:
repo: plugins/<+matrix.repo>
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
auto_tag_suffix: windows-ltsc2022-amd64
- step:
identifier: BuildAndPushDockerRegistry_2
type: BuildAndPushDockerRegistry
spec:
repo: plugins/<+matrix.repo>
tags:
- windows-ltsc2022-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- stage:
identifier: Manifest
type: CI
spec:
execution:
steps:
- step:
identifier: Plugin_1
type: Plugin
spec:
settings:
spec: docker/<+matrix.repo>/manifest.tmpl
+156 -92
View File
@@ -32,8 +32,8 @@ pipeline:
name: GO VET name: GO VET
identifier: Run_1 identifier: Run_1
spec: spec:
connectorRef: account.harnessImage connectorRef: Plugins_Docker_Hub_Connector
image: golang:1.22.4 image: golang:1.23.0
shell: Sh shell: Sh
command: go vet ./... command: go vet ./...
- step: - step:
@@ -41,8 +41,8 @@ pipeline:
name: GO TEST name: GO TEST
identifier: Run_2 identifier: Run_2
spec: spec:
connectorRef: account.harnessImage connectorRef: Plugins_Docker_Hub_Connector
image: golang:1.22.4 image: golang:1.23.0
shell: Sh shell: Sh
command: go test -cover ./... command: go test -cover ./...
- parallel: - parallel:
@@ -69,12 +69,21 @@ pipeline:
name: Build Binary name: Build Binary
identifier: Build_Push identifier: Build_Push
spec: spec:
connectorRef: account.harnessImage connectorRef: Plugins_Docker_Hub_Connector
image: golang:1.22.4 image: golang:1.23.0
shell: Sh shell: Sh
command: <+input> command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
envVariables: envVariables:
CGO_ENABLED: "0" CGO_ENABLED: "0"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- step: - step:
type: Plugin type: Plugin
name: Build and Push on Tag name: Build and Push on Tag
@@ -85,35 +94,45 @@ pipeline:
settings: settings:
username: drone username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input> repo: plugins/<+matrix.repo>
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
auto_tag: "true" auto_tag: "true"
auto_tag_suffix: <+input> auto_tag_suffix: linux-amd64
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "tag" condition: <+codebase.build.type> == "tag"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- step: - step:
type: BuildAndPushDockerRegistry type: BuildAndPushDockerRegistry
name: Build and Push on Branch name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_1 identifier: BuildAndPushDockerRegistry_1
spec: spec:
connectorRef: Plugins_Docker_Hub_Connector connectorRef: Plugins_Docker_Hub_Connector
repo: <+input> repo: plugins/<+matrix.repo>
tags: <+input> tags:
- linux-amd64
caching: true caching: true
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "branch" condition: <+codebase.build.type> == "branch"
strategy: strategy:
matrix: matrix:
repo: repo:
- docker - docker
- gcr - gcr
- gar - gar
- ecr - ecr
- heroku - heroku
- acr - acr
- stage: - stage:
name: linux-arm64 name: linux-arm64
identifier: linarm64 identifier: linarm64
@@ -137,12 +156,21 @@ pipeline:
name: Build Binary name: Build Binary
identifier: buildpush identifier: buildpush
spec: spec:
connectorRef: account.harnessImage connectorRef: Plugins_Docker_Hub_Connector
image: golang:1.22.4 image: golang:1.23.0
shell: Sh shell: Sh
command: <+input> command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
envVariables: envVariables:
CGO_ENABLED: "0" CGO_ENABLED: "0"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- step: - step:
type: Plugin type: Plugin
name: Build and Push on Tag name: Build and Push on Tag
@@ -153,35 +181,45 @@ pipeline:
settings: settings:
username: drone username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input> repo: plugins/<+matrix.repo>
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
auto_tag: "true" auto_tag: "true"
auto_tag_suffix: <+input> auto_tag_suffix: linux-arm64
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "tag" condition: <+codebase.build.type> == "tag"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- step: - step:
type: BuildAndPushDockerRegistry type: BuildAndPushDockerRegistry
name: Build and Push on Branch name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_1 identifier: BuildAndPushDockerRegistry_1
spec: spec:
connectorRef: Plugins_Docker_Hub_Connector connectorRef: Plugins_Docker_Hub_Connector
repo: <+input> repo: plugins/<+matrix.repo>
tags: <+input> tags:
- linux-arm64
caching: true caching: true
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "branch" condition: <+codebase.build.type> == "branch"
strategy: strategy:
matrix: matrix:
repo: repo:
- docker - docker
- gcr - gcr
- gar - gar
- ecr - ecr
- heroku - heroku
- acr - acr
- stage: - stage:
name: win-1809-amd64 name: win-1809-amd64
identifier: win1809amd64 identifier: win1809amd64
@@ -205,18 +243,22 @@ pipeline:
name: Build Binary name: Build Binary
identifier: go_build identifier: go_build
spec: spec:
connectorRef: account.harnessImage connectorRef: Plugins_Docker_Hub_Connector
image: golang:1.22.4 image: golang:1.23.0
shell: Sh shell: Sh
command: |- command: |-
# disable cgo # disable cgo
export CGO_ENABLED=0 export CGO_ENABLED=0
go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker go build -o release/windows/amd64/drone-<+matrix.repo>.exe ./cmd/drone-<+matrix.repo>
go build -o release/windows/amd64/drone-ecr.exe ./cmd/drone-ecr strategy:
go build -o release/windows/amd64/drone-gcr.exe ./cmd/drone-gcr matrix:
go build -o release/windows/amd64/drone-acr.exe ./cmd/drone-acr repo:
go build -o release/windows/amd64/drone-gar.exe ./cmd/drone-gar - docker
- gcr
- gar
- ecr
- acr
- step: - step:
type: Plugin type: Plugin
name: Build and Push on Tag name: Build and Push on Tag
@@ -227,34 +269,43 @@ pipeline:
settings: settings:
username: drone username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input> repo: plugins/<+matrix.repo>
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
auto_tag: "true" auto_tag: "true"
auto_tag_suffix: <+input> auto_tag_suffix: windows-1809-amd64
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "tag" condition: <+codebase.build.type> == "tag"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
- step: - step:
type: BuildAndPushDockerRegistry type: BuildAndPushDockerRegistry
name: Build and Push on Branch name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_2 identifier: BuildAndPushDockerRegistry_2
spec: spec:
connectorRef: Plugins_Docker_Hub_Connector connectorRef: Plugins_Docker_Hub_Connector
repo: <+input> repo: plugins/<+matrix.repo>
tags: <+input> tags:
- windows-1809-amd64
caching: true caching: true
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "branch" condition: <+codebase.build.type> == "branch"
strategy: strategy:
matrix: matrix:
repo: repo:
- docker - docker
- gcr - gcr
- gar - gar
- ecr - ecr
- acr - acr
delegateSelectors: delegateSelectors:
- windows-vm - windows-vm
- stage: - stage:
@@ -280,20 +331,24 @@ pipeline:
name: Build Binary -ltsc2022 name: Build Binary -ltsc2022
identifier: build_amd64ltsc2022 identifier: build_amd64ltsc2022
spec: spec:
connectorRef: account.harnessImage connectorRef: Plugins_Docker_Hub_Connector
image: golang:1.22.4 image: golang:1.23.0
shell: Sh shell: Sh
command: |- command: |-
# disable cgo # disable cgo
export CGO_ENABLED=0 export CGO_ENABLED=0
go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker go build -o release/windows/amd64/drone-<+matrix.repo>.exe ./cmd/drone-<+matrix.repo>
go build -o release/windows/amd64/drone-ecr.exe ./cmd/drone-ecr
go build -o release/windows/amd64/drone-gcr.exe ./cmd/drone-gcr
go build -o release/windows/amd64/drone-acr.exe ./cmd/drone-acr
go build -o release/windows/amd64/drone-gar.exe ./cmd/drone-gar
envVariables: envVariables:
CGO_ENABLED: "0" CGO_ENABLED: "0"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
- step: - step:
type: Plugin type: Plugin
name: Build and Push on Tag name: Build and Push on Tag
@@ -304,36 +359,45 @@ pipeline:
settings: settings:
username: drone username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input> repo: plugins/<+matrix.repo>
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
auto_tag: "true" auto_tag: "true"
auto_tag_suffix: <+input> auto_tag_suffix: windows-ltsc2022-amd64
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "tag" condition: <+codebase.build.type> == "tag"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
- step: - step:
type: BuildAndPushDockerRegistry type: BuildAndPushDockerRegistry
name: Build and Push on Branch name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_2 identifier: BuildAndPushDockerRegistry_2
spec: spec:
connectorRef: Plugins_Docker_Hub_Connector connectorRef: Plugins_Docker_Hub_Connector
repo: <+input> repo: plugins/<+matrix.repo>
tags: <+input> tags:
- windows-ltsc2022-amd64
caching: true caching: true
dockerfile: <+input> dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "branch" condition: <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
buildIntelligence: buildIntelligence:
enabled: false enabled: false
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
- stage: - stage:
name: Manifest and Release name: Manifest and Release
identifier: Manifest identifier: Manifest
@@ -358,25 +422,25 @@ pipeline:
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
auto_tag: "true" auto_tag: "true"
ignore_missing: "true" ignore_missing: "true"
spec: <+input> spec: docker/<+matrix.repo>/manifest.tmpl
when: when:
stageStatus: Success stageStatus: Success
condition: <+codebase.build.type> == "tag" || <+codebase.build.type> == "branch" condition: <+codebase.build.type> == "tag" || <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
platform: platform:
os: Linux os: Linux
arch: Amd64 arch: Amd64
runtime: runtime:
type: Cloud type: Cloud
spec: {} spec: {}
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
identifier: dronedockerharness identifier: dronedockerharness
projectIdentifier: Drone_Plugins projectIdentifier: Drone_Plugins
name: drone-docker-harness name: drone-docker-harness