diff --git a/.harness/eventPR.yaml b/.harness/eventPR.yaml new file mode 100644 index 0000000..b32bffc --- /dev/null +++ b/.harness/eventPR.yaml @@ -0,0 +1,125 @@ +inputSet: + name: event-PR + identifier: eventPR + orgIdentifier: default + projectIdentifier: Drone_Plugins + pipeline: + identifier: dronedockerharness + properties: + ci: + codebase: + build: + type: PR + spec: + number: <+trigger.prNumber> + stages: + - 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 diff --git a/.harness/eventPush.yaml b/.harness/eventPush.yaml new file mode 100644 index 0000000..e047956 --- /dev/null +++ b/.harness/eventPush.yaml @@ -0,0 +1,125 @@ +inputSet: + name: event-Push + identifier: eventPush + orgIdentifier: default + projectIdentifier: Drone_Plugins + pipeline: + identifier: dronedockerharness + properties: + ci: + codebase: + build: + type: branch + spec: + branch: <+trigger.branch> + stages: + - 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 diff --git a/.harness/eventTag.yaml b/.harness/eventTag.yaml new file mode 100644 index 0000000..454b662 --- /dev/null +++ b/.harness/eventTag.yaml @@ -0,0 +1,125 @@ +inputSet: + name: event-Tag + identifier: eventTag + orgIdentifier: default + projectIdentifier: Drone_Plugins + pipeline: + identifier: dronedockerharness + properties: + ci: + codebase: + build: + type: tag + spec: + tag: <+trigger.tag> + stages: + - 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 diff --git a/.harness/harness.yaml b/.harness/harness.yaml new file mode 100644 index 0000000..957749e --- /dev/null +++ b/.harness/harness.yaml @@ -0,0 +1,381 @@ +pipeline: + orgIdentifier: default + tags: {} + properties: + ci: + codebase: + connectorRef: GitHub_Drone_Plugins_Org + repoName: drone-docker + build: <+input> + sparseCheckout: [] + stages: + - stage: + name: Test + identifier: Test + description: "" + type: CI + spec: + cloneCodebase: true + caching: + enabled: false + paths: [] + platform: + os: Linux + arch: Amd64 + runtime: + type: Cloud + spec: {} + execution: + steps: + - step: + type: Run + name: GO VET + identifier: Run_1 + spec: + connectorRef: account.harnessImage + image: golang:1.22.4 + shell: Sh + command: go vet ./... + - step: + type: Run + name: GO TEST + identifier: Run_2 + spec: + connectorRef: account.harnessImage + image: golang:1.22.4 + shell: Sh + command: go test -cover ./... + - stage: + name: linux-amd64 + identifier: linamd64 + description: "" + type: CI + spec: + 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: + 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 + 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: + name: Manifest and Release + identifier: Manifest + description: "" + type: CI + spec: + cloneCodebase: true + caching: + enabled: false + paths: [] + execution: + steps: + - step: + type: Plugin + name: Manifest + identifier: Plugin_1 + spec: + connectorRef: Plugins_Docker_Hub_Connector + image: plugins/manifest + settings: + username: drone + password: <+secrets.getValue("Plugins_Docker_Hub_Pat")> + auto_tag: "true" + ignore_missing: "true" + spec: <+input> + when: + stageStatus: Success + condition: <+codebase.build.type> == "tag" || <+codebase.build.type> == "branch" + platform: + os: Linux + arch: Amd64 + runtime: + type: Cloud + spec: {} + strategy: + matrix: + repo: + - docker + - gcr + - gar + - ecr + - heroku + - acr + identifier: dronedockerharness + projectIdentifier: Drone_Plugins + name: drone-docker-harness