Compare commits

...

5 Commits

Author SHA1 Message Date
OP (oppenheimer) 44157a2e29 Revert base ding image tag to 20.10.14 (#476) 2025-02-14 15:39:08 +05:30
OP (oppenheimer) feb90fe92d New input skip_push_if_tag_exists (#472) 2025-02-13 15:34:02 +05:30
ci-reporunner 55c76aeaf0 Update inputset event-Push (#474)
* Update inputset event-Push

* Update inputset event-Push

* Update inputset event-PR

* Update inputset event-Tag

---------

Co-authored-by: Archit Mallik <archit.mallik@harness.io>
2025-02-13 10:53:37 +05:30
ci-reporunner b54379f077 Update pipeline drone-docker-harness (#473)
Co-authored-by: Archit Mallik <archit.mallik@harness.io>
2025-02-12 17:04:26 +05:30
OP (oppenheimer) ab3fed4710 Merge pull request #469 from drone-plugins/CI-15946
Create pipeline drone-docker-harness
2025-02-12 13:26:14 +05:30
7 changed files with 650 additions and 593 deletions
+100 -98
View File
@@ -1,5 +1,6 @@
inputSet: inputSet:
name: event-PR name: event-PR
tags: {}
identifier: eventPR identifier: eventPR
orgIdentifier: default orgIdentifier: default
projectIdentifier: Drone_Plugins projectIdentifier: Drone_Plugins
@@ -13,104 +14,105 @@ inputSet:
spec: spec:
number: <+trigger.prNumber> number: <+trigger.prNumber>
stages: stages:
- stage: - parallel:
identifier: linamd64 - stage:
type: CI identifier: linamd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Build_Push - step:
type: Run identifier: Build_Push
spec: type: Run
command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo> spec:
- step: command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
identifier: Docker_Build_and_Push - step:
type: Plugin identifier: Docker_Build_and_Push
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64 repo: plugins/<+matrix.repo>
auto_tag_suffix: linux-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
- step: auto_tag_suffix: linux-amd64
identifier: BuildAndPushDockerRegistry_1 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_1
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- linux-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64 - linux-amd64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
identifier: linarm64 - stage:
type: CI identifier: linarm64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: buildpush - step:
type: Run identifier: buildpush
spec: type: Run
command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo> spec:
- step: command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
identifier: Docker_Build_and_Push - step:
type: Plugin identifier: Docker_Build_and_Push
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64 repo: plugins/<+matrix.repo>
auto_tag_suffix: linux-arm64 dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
- step: auto_tag_suffix: linux-arm64
identifier: BuildAndPushDockerRegistry_1 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_1
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- linux-arm64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64 - linux-arm64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
identifier: win1809amd64 - stage:
type: CI identifier: win1809amd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Docker_Build_and_Push1 - step:
type: Plugin identifier: Docker_Build_and_Push1
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809 repo: plugins/<+matrix.repo>
auto_tag_suffix: windows-1809-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
- step: auto_tag_suffix: windows-1809-amd64
identifier: BuildAndPushDockerRegistry_2 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_2
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- windows-1809-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809 - windows-1809-amd64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
identifier: winamd64 - stage:
type: CI identifier: winamd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Docker_Build_and_Push1 - step:
type: Plugin identifier: Docker_Build_and_Push1
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022 repo: plugins/<+matrix.repo>
auto_tag_suffix: windows-ltsc2022-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- step: auto_tag_suffix: windows-ltsc2022-amd64
identifier: BuildAndPushDockerRegistry_2 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_2
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- windows-ltsc2022-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022 - windows-ltsc2022-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- stage: - stage:
identifier: Manifest identifier: Manifest
type: CI type: CI
+100 -98
View File
@@ -1,5 +1,6 @@
inputSet: inputSet:
name: event-Push name: event-Push
tags: {}
identifier: eventPush identifier: eventPush
orgIdentifier: default orgIdentifier: default
projectIdentifier: Drone_Plugins projectIdentifier: Drone_Plugins
@@ -13,104 +14,105 @@ inputSet:
spec: spec:
branch: <+trigger.branch> branch: <+trigger.branch>
stages: stages:
- stage: - parallel:
identifier: linamd64 - stage:
type: CI identifier: linamd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Build_Push - step:
type: Run identifier: Build_Push
spec: type: Run
command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo> spec:
- step: command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
identifier: Docker_Build_and_Push - step:
type: Plugin identifier: Docker_Build_and_Push
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64 repo: plugins/<+matrix.repo>
auto_tag_suffix: linux-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
- step: auto_tag_suffix: linux-amd64
identifier: BuildAndPushDockerRegistry_1 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_1
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- linux-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64 - linux-amd64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
identifier: linarm64 - stage:
type: CI identifier: linarm64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: buildpush - step:
type: Run identifier: buildpush
spec: type: Run
command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo> spec:
- step: command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
identifier: Docker_Build_and_Push - step:
type: Plugin identifier: Docker_Build_and_Push
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64 repo: plugins/<+matrix.repo>
auto_tag_suffix: linux-arm64 dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
- step: auto_tag_suffix: linux-arm64
identifier: BuildAndPushDockerRegistry_1 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_1
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- linux-arm64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64 - linux-arm64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
identifier: win1809amd64 - stage:
type: CI identifier: win1809amd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Docker_Build_and_Push1 - step:
type: Plugin identifier: Docker_Build_and_Push1
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809 repo: plugins/<+matrix.repo>
auto_tag_suffix: windows-1809-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
- step: auto_tag_suffix: windows-1809-amd64
identifier: BuildAndPushDockerRegistry_2 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_2
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- windows-1809-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809 - windows-1809-amd64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
identifier: winamd64 - stage:
type: CI identifier: winamd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Docker_Build_and_Push1 - step:
type: Plugin identifier: Docker_Build_and_Push1
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022 repo: plugins/<+matrix.repo>
auto_tag_suffix: windows-ltsc2022-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- step: auto_tag_suffix: windows-ltsc2022-amd64
identifier: BuildAndPushDockerRegistry_2 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_2
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- windows-ltsc2022-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022 - windows-ltsc2022-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- stage: - stage:
identifier: Manifest identifier: Manifest
type: CI type: CI
+100 -98
View File
@@ -1,5 +1,6 @@
inputSet: inputSet:
name: event-Tag name: event-Tag
tags: {}
identifier: eventTag identifier: eventTag
orgIdentifier: default orgIdentifier: default
projectIdentifier: Drone_Plugins projectIdentifier: Drone_Plugins
@@ -13,104 +14,105 @@ inputSet:
spec: spec:
tag: <+trigger.tag> tag: <+trigger.tag>
stages: stages:
- stage: - parallel:
identifier: linamd64 - stage:
type: CI identifier: linamd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Build_Push - step:
type: Run identifier: Build_Push
spec: type: Run
command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo> spec:
- step: command: go build -a -tags netgo -o release/linux/amd64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
identifier: Docker_Build_and_Push - step:
type: Plugin identifier: Docker_Build_and_Push
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64 repo: plugins/<+matrix.repo>
auto_tag_suffix: linux-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
- step: auto_tag_suffix: linux-amd64
identifier: BuildAndPushDockerRegistry_1 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_1
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- linux-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64 - linux-amd64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.linux.amd64
identifier: linarm64 - stage:
type: CI identifier: linarm64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: buildpush - step:
type: Run identifier: buildpush
spec: type: Run
command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo> spec:
- step: command: go build -a -tags netgo -o release/linux/arm64/drone-<+matrix.repo> ./cmd/drone-<+matrix.repo>
identifier: Docker_Build_and_Push - step:
type: Plugin identifier: Docker_Build_and_Push
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64 repo: plugins/<+matrix.repo>
auto_tag_suffix: linux-arm64 dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
- step: auto_tag_suffix: linux-arm64
identifier: BuildAndPushDockerRegistry_1 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_1
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- linux-arm64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64 - linux-arm64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.linux.arm64
identifier: win1809amd64 - stage:
type: CI identifier: win1809amd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Docker_Build_and_Push1 - step:
type: Plugin identifier: Docker_Build_and_Push1
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809 repo: plugins/<+matrix.repo>
auto_tag_suffix: windows-1809-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
- step: auto_tag_suffix: windows-1809-amd64
identifier: BuildAndPushDockerRegistry_2 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_2
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- windows-1809-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809 - windows-1809-amd64
- stage: dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.1809
identifier: winamd64 - stage:
type: CI identifier: winamd64
spec: type: CI
execution: spec:
steps: execution:
- step: steps:
identifier: Docker_Build_and_Push1 - step:
type: Plugin identifier: Docker_Build_and_Push1
spec: type: Plugin
settings: spec:
repo: plugins/<+matrix.repo> settings:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022 repo: plugins/<+matrix.repo>
auto_tag_suffix: windows-ltsc2022-amd64 dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- step: auto_tag_suffix: windows-ltsc2022-amd64
identifier: BuildAndPushDockerRegistry_2 - step:
type: BuildAndPushDockerRegistry identifier: BuildAndPushDockerRegistry_2
spec: type: BuildAndPushDockerRegistry
repo: plugins/<+matrix.repo> spec:
tags: repo: plugins/<+matrix.repo>
- windows-ltsc2022-amd64 tags:
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022 - windows-ltsc2022-amd64
dockerfile: docker/<+matrix.repo>/Dockerfile.windows.amd64.ltsc2022
- stage: - stage:
identifier: Manifest identifier: Manifest
type: CI type: CI
+286 -285
View File
@@ -45,294 +45,295 @@ pipeline:
image: golang:1.22.4 image: golang:1.22.4
shell: Sh shell: Sh
command: go test -cover ./... command: go test -cover ./...
- stage: - parallel:
name: linux-amd64 - stage:
identifier: linamd64 name: linux-amd64
description: "" identifier: linamd64
type: CI description: ""
spec: type: CI
cloneCodebase: true
caching:
enabled: false
paths: []
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: Build Binary
identifier: Build_Push
spec:
connectorRef: account.harnessImage
image: golang:1.22.4
shell: Sh
command: <+input>
envVariables:
CGO_ENABLED: "0"
- step:
type: Plugin
name: Build and Push on Tag
identifier: Docker_Build_and_Push
spec:
connectorRef: Plugins_Docker_Hub_Connector
image: plugins/docker
settings:
username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input>
dockerfile: <+input>
auto_tag: "true"
auto_tag_suffix: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "tag"
- step:
type: BuildAndPushDockerRegistry
name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_1
spec:
connectorRef: Plugins_Docker_Hub_Connector
repo: <+input>
tags: <+input>
caching: true
dockerfile: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- stage:
name: linux-arm64
identifier: linarm64
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: false
paths: []
platform:
os: Linux
arch: Arm64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: Build Binary
identifier: buildpush
spec:
connectorRef: account.harnessImage
image: golang:1.22.4
shell: Sh
command: <+input>
envVariables:
CGO_ENABLED: "0"
- step:
type: Plugin
name: Build and Push on Tag
identifier: Docker_Build_and_Push
spec:
connectorRef: Plugins_Docker_Hub_Connector
image: plugins/docker
settings:
username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input>
dockerfile: <+input>
auto_tag: "true"
auto_tag_suffix: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "tag"
- step:
type: BuildAndPushDockerRegistry
name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_1
spec:
connectorRef: Plugins_Docker_Hub_Connector
repo: <+input>
tags: <+input>
caching: true
dockerfile: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- stage:
name: win-1809-amd64
identifier: win1809amd64
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: true
infrastructure:
type: VM
spec: spec:
type: Pool cloneCodebase: true
spec: caching:
poolName: windows-2019 enabled: false
paths: []
platform:
os: Linux
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: Build Binary
identifier: Build_Push
spec:
connectorRef: account.harnessImage
image: golang:1.22.4
shell: Sh
command: <+input>
envVariables:
CGO_ENABLED: "0"
- step:
type: Plugin
name: Build and Push on Tag
identifier: Docker_Build_and_Push
spec:
connectorRef: Plugins_Docker_Hub_Connector
image: plugins/docker
settings:
username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input>
dockerfile: <+input>
auto_tag: "true"
auto_tag_suffix: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "tag"
- step:
type: BuildAndPushDockerRegistry
name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_1
spec:
connectorRef: Plugins_Docker_Hub_Connector
repo: <+input>
tags: <+input>
caching: true
dockerfile: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- stage:
name: linux-arm64
identifier: linarm64
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: false
paths: []
platform:
os: Linux
arch: Arm64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: Build Binary
identifier: buildpush
spec:
connectorRef: account.harnessImage
image: golang:1.22.4
shell: Sh
command: <+input>
envVariables:
CGO_ENABLED: "0"
- step:
type: Plugin
name: Build and Push on Tag
identifier: Docker_Build_and_Push
spec:
connectorRef: Plugins_Docker_Hub_Connector
image: plugins/docker
settings:
username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input>
dockerfile: <+input>
auto_tag: "true"
auto_tag_suffix: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "tag"
- step:
type: BuildAndPushDockerRegistry
name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_1
spec:
connectorRef: Plugins_Docker_Hub_Connector
repo: <+input>
tags: <+input>
caching: true
dockerfile: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- heroku
- acr
- stage:
name: win-1809-amd64
identifier: win1809amd64
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: true
infrastructure:
type: VM
spec:
type: Pool
spec:
poolName: windows-2019
os: Windows
execution:
steps:
- step:
type: Run
name: Build Binary
identifier: go_build
spec:
connectorRef: account.harnessImage
image: golang:1.22.4
shell: Sh
command: |-
# disable cgo
export CGO_ENABLED=0
go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
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
- step:
type: Plugin
name: Build and Push on Tag
identifier: Docker_Build_and_Push1
spec:
connectorRef: Plugins_Docker_Hub_Connector
image: plugins/docker
settings:
username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input>
dockerfile: <+input>
auto_tag: "true"
auto_tag_suffix: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "tag"
- step:
type: BuildAndPushDockerRegistry
name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_2
spec:
connectorRef: Plugins_Docker_Hub_Connector
repo: <+input>
tags: <+input>
caching: true
dockerfile: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "branch"
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
delegateSelectors:
- windows-vm
- stage:
name: win-ltsc2022-amd64
identifier: winamd64
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: false
paths: []
platform:
os: Windows os: Windows
execution: arch: Amd64
steps: runtime:
- step: type: Cloud
type: Run spec: {}
name: Build Binary execution:
identifier: go_build steps:
spec: - step:
connectorRef: account.harnessImage type: Run
image: golang:1.22.4 name: Build Binary -ltsc2022
shell: Sh identifier: build_amd64ltsc2022
command: |- spec:
# disable cgo connectorRef: account.harnessImage
export CGO_ENABLED=0 image: golang:1.22.4
shell: Sh
command: |-
# disable cgo
export CGO_ENABLED=0
go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
go build -o release/windows/amd64/drone-ecr.exe ./cmd/drone-ecr 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-gcr.exe ./cmd/drone-gcr
go build -o release/windows/amd64/drone-acr.exe ./cmd/drone-acr go build -o release/windows/amd64/drone-acr.exe ./cmd/drone-acr
go build -o release/windows/amd64/drone-gar.exe ./cmd/drone-gar go build -o release/windows/amd64/drone-gar.exe ./cmd/drone-gar
- step: envVariables:
type: Plugin CGO_ENABLED: "0"
name: Build and Push on Tag - step:
identifier: Docker_Build_and_Push1 type: Plugin
spec: name: Build and Push on Tag
connectorRef: Plugins_Docker_Hub_Connector identifier: Docker_Build_and_Push1
image: plugins/docker spec:
settings: connectorRef: Plugins_Docker_Hub_Connector
username: drone image: plugins/docker
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> settings:
repo: <+input> username: drone
dockerfile: <+input> password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
auto_tag: "true" repo: <+input>
auto_tag_suffix: <+input> dockerfile: <+input>
when: auto_tag: "true"
stageStatus: Success auto_tag_suffix: <+input>
condition: <+codebase.build.type> == "tag" when:
- step: stageStatus: Success
type: BuildAndPushDockerRegistry condition: <+codebase.build.type> == "tag"
name: Build and Push on Branch - step:
identifier: BuildAndPushDockerRegistry_2 type: BuildAndPushDockerRegistry
spec: name: Build and Push on Branch
connectorRef: Plugins_Docker_Hub_Connector identifier: BuildAndPushDockerRegistry_2
repo: <+input> spec:
tags: <+input> connectorRef: Plugins_Docker_Hub_Connector
caching: true repo: <+input>
dockerfile: <+input> tags: <+input>
when: caching: true
stageStatus: Success dockerfile: <+input>
condition: <+codebase.build.type> == "branch" when:
strategy: stageStatus: Success
matrix: condition: <+codebase.build.type> == "branch"
repo: buildIntelligence:
- docker enabled: false
- gcr strategy:
- gar matrix:
- ecr repo:
- acr - docker
delegateSelectors: - gcr
- windows-vm - gar
- stage: - ecr
name: win-ltsc2022-amd64 - acr
identifier: winamd64
description: ""
type: CI
spec:
cloneCodebase: true
caching:
enabled: false
paths: []
platform:
os: Windows
arch: Amd64
runtime:
type: Cloud
spec: {}
execution:
steps:
- step:
type: Run
name: Build Binary -ltsc2022
identifier: build_amd64ltsc2022
spec:
connectorRef: account.harnessImage
image: golang:1.22.4
shell: Sh
command: |-
# disable cgo
export CGO_ENABLED=0
go build -o release/windows/amd64/drone-docker.exe ./cmd/drone-docker
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:
CGO_ENABLED: "0"
- step:
type: Plugin
name: Build and Push on Tag
identifier: Docker_Build_and_Push1
spec:
connectorRef: Plugins_Docker_Hub_Connector
image: plugins/docker
settings:
username: drone
password: <+secrets.getValue("Plugins_Docker_Hub_Pat")>
repo: <+input>
dockerfile: <+input>
auto_tag: "true"
auto_tag_suffix: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "tag"
- step:
type: BuildAndPushDockerRegistry
name: Build and Push on Branch
identifier: BuildAndPushDockerRegistry_2
spec:
connectorRef: Plugins_Docker_Hub_Connector
repo: <+input>
tags: <+input>
caching: true
dockerfile: <+input>
when:
stageStatus: Success
condition: <+codebase.build.type> == "branch"
buildIntelligence:
enabled: false
strategy:
matrix:
repo:
- docker
- gcr
- gar
- ecr
- acr
- stage: - stage:
name: Manifest and Release name: Manifest and Release
identifier: Manifest identifier: Manifest
+62 -12
View File
@@ -22,6 +22,10 @@ import (
docker "github.com/drone-plugins/drone-docker" docker "github.com/drone-plugins/drone-docker"
) )
type ecrAPI interface {
DescribeImages(*ecr.DescribeImagesInput) (*ecr.DescribeImagesOutput, error)
}
const defaultRegion = "us-east-1" const defaultRegion = "us-east-1"
func main() { func main() {
@@ -31,18 +35,19 @@ func main() {
} }
var ( var (
repo = getenv("PLUGIN_REPO") repo = getenv("PLUGIN_REPO")
registry = getenv("PLUGIN_REGISTRY") registry = getenv("PLUGIN_REGISTRY")
region = getenv("PLUGIN_REGION", "ECR_REGION", "AWS_REGION") region = getenv("PLUGIN_REGION", "ECR_REGION", "AWS_REGION")
key = getenv("PLUGIN_ACCESS_KEY", "ECR_ACCESS_KEY", "AWS_ACCESS_KEY_ID") key = getenv("PLUGIN_ACCESS_KEY", "ECR_ACCESS_KEY", "AWS_ACCESS_KEY_ID")
secret = getenv("PLUGIN_SECRET_KEY", "ECR_SECRET_KEY", "AWS_SECRET_ACCESS_KEY") secret = getenv("PLUGIN_SECRET_KEY", "ECR_SECRET_KEY", "AWS_SECRET_ACCESS_KEY")
create = parseBoolOrDefault(false, getenv("PLUGIN_CREATE_REPOSITORY", "ECR_CREATE_REPOSITORY")) create = parseBoolOrDefault(false, getenv("PLUGIN_CREATE_REPOSITORY", "ECR_CREATE_REPOSITORY"))
lifecyclePolicy = getenv("PLUGIN_LIFECYCLE_POLICY") lifecyclePolicy = getenv("PLUGIN_LIFECYCLE_POLICY")
repositoryPolicy = getenv("PLUGIN_REPOSITORY_POLICY") repositoryPolicy = getenv("PLUGIN_REPOSITORY_POLICY")
assumeRole = getenv("PLUGIN_ASSUME_ROLE") assumeRole = getenv("PLUGIN_ASSUME_ROLE")
externalId = getenv("PLUGIN_EXTERNAL_ID") externalId = getenv("PLUGIN_EXTERNAL_ID")
scanOnPush = parseBoolOrDefault(false, getenv("PLUGIN_SCAN_ON_PUSH")) scanOnPush = parseBoolOrDefault(false, getenv("PLUGIN_SCAN_ON_PUSH"))
idToken = os.Getenv("PLUGIN_OIDC_TOKEN_ID") idToken = os.Getenv("PLUGIN_OIDC_TOKEN_ID")
skipPushIfTagExists = parseBoolOrDefault(false, getenv("PLUGIN_SKIP_PUSH_IF_TAG_EXISTS"))
) )
// set the region // set the region
@@ -114,6 +119,34 @@ func main() {
os.Setenv("DOCKER_PASSWORD", password) os.Setenv("DOCKER_PASSWORD", password)
os.Setenv("PLUGIN_REGISTRY_TYPE", "ECR") os.Setenv("PLUGIN_REGISTRY_TYPE", "ECR")
// Skip if tag already exits for both mutable and immutable repos
if skipPushIfTagExists {
tagInput := getenv("PLUGIN_TAG", "PLUGIN_TAGS")
var tags []string
if tagInput == "" {
tags = []string{"latest"}
} else {
for _, t := range strings.Split(tagInput, ",") {
trimmed := strings.TrimSpace(t)
if trimmed != "" {
tags = append(tags, trimmed)
}
}
}
repositoryName := trimHostname(repo, registry)
for _, t := range tags {
exists, err := tagExists(svc, repositoryName, t)
if err != nil {
logrus.Fatalf("Error checking if image exists for tag %s: %v", t, err)
}
if exists {
logrus.Infof("%s:%s: Image tag exists. Skipping push.", repo, t)
os.Exit(0)
}
}
}
// invoke the base docker plugin binary // invoke the base docker plugin binary
cmd := exec.Command(docker.GetDroneDockerExecCmd()) cmd := exec.Command(docker.GetDroneDockerExecCmd())
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
@@ -249,3 +282,20 @@ func getECRClient(sess *session.Session, role string, externalId string, idToken
}) })
} }
} }
func tagExists(svc ecrAPI, repository, tag string) (bool, error) {
input := &ecr.DescribeImagesInput{
RepositoryName: aws.String(repository),
ImageIds: []*ecr.ImageIdentifier{
{ImageTag: aws.String(tag)},
},
}
output, err := svc.DescribeImages(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "ImageNotFoundException" {
return false, nil
}
return false, err
}
return len(output.ImageDetails) > 0, nil
}
+1 -1
View File
@@ -1,4 +1,4 @@
FROM docker:27.3.1-dind FROM docker:20.10.14-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock ENV DOCKER_HOST=unix:///var/run/docker.sock
+1 -1
View File
@@ -1,4 +1,4 @@
FROM arm64v8/docker:27.3.1-dind FROM arm64v8/docker:20.10.14-dind
ENV DOCKER_HOST=unix:///var/run/docker.sock ENV DOCKER_HOST=unix:///var/run/docker.sock