diff --git a/.drone.jsonnet b/.drone.jsonnet index cbde015..6d81af0 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -93,9 +93,9 @@ local PipelineSecurity = { }, }; -local PipelineBuild = { +local PipelineBuildPackage = { kind: "pipeline", - name: "build", + name: "build-package", platform: { os: "linux", arch: "amd64", @@ -155,6 +155,60 @@ local PipelineBuild = { }, }; +local PipelineBuildContainer(arch="amd64") = { + kind: "pipeline", + name: "build-container-" + arch, + platform: { + os: "linux", + arch: arch, + }, + steps: [ + { + name: "build", + image: "python:3.7", + pull: "always", + commands: [ + "python setup.py sdist", + ] + }, + { + name: "dryrun", + image: "plugins/docker:linux-" + arch, + pull: "always", + settings: { + dry_run: true, + tags: arch, + dockerfile: "Dockerfile", + repo: "xoxys/ansible-doctor", + username: { "from_secret": "docker_username" }, + password: { "from_secret": "docker_password" }, + } + }, + { + name: "publish", + image: "plugins/docker:linux-" + arch, + pull: "always", + settings: { + auto_tag: true, + auto_tag_suffix: arch, + dockerfile: "Dockerfile", + repo: "xoxys/ansible-doctor", + username: { "from_secret": "docker_username" }, + password: { "from_secret": "docker_password" }, + }, + when: { + ref: [ "refs/tags/**" ], + }, + }, + ], + depends_on: [ + "security", + ], + trigger: { + ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"], + }, +}; + local PipelineNotifications = { kind: "pipeline", name: "notifications", @@ -188,6 +242,9 @@ local PipelineNotifications = { PipelineLint, PipelineTest, PipelineSecurity, - PipelineBuild, + PipelineBuildPackage, + PipelineBuildContainer(arch="amd64"), + PipelineBuildContainer(arch="arm64"), + PipelineBuildContainer(arch="arm"), PipelineNotifications, ] diff --git a/.drone.yml b/.drone.yml index 68dc711..16b66f3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -119,7 +119,7 @@ depends_on: --- kind: pipeline -name: build +name: build-package platform: os: linux @@ -177,6 +177,165 @@ trigger: depends_on: - security +--- +kind: pipeline +name: build-container-amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + pull: always + image: python:3.7 + commands: + - python setup.py sdist + +- name: dryrun + pull: always + image: plugins/docker:linux-amd64 + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/ansible-doctor + tags: amd64 + username: + from_secret: docker_username + +- name: publish + pull: always + image: plugins/docker:linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: amd64 + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/ansible-doctor + username: + from_secret: docker_username + when: + ref: + - "refs/tags/**" + +trigger: + ref: + - refs/heads/master + - "refs/tags/**" + - "refs/pull/**" + +depends_on: +- security + +--- +kind: pipeline +name: build-container-arm64 + +platform: + os: linux + arch: arm64 + +steps: +- name: build + pull: always + image: python:3.7 + commands: + - python setup.py sdist + +- name: dryrun + pull: always + image: plugins/docker:linux-arm64 + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/ansible-doctor + tags: arm64 + username: + from_secret: docker_username + +- name: publish + pull: always + image: plugins/docker:linux-arm64 + settings: + auto_tag: true + auto_tag_suffix: arm64 + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/ansible-doctor + username: + from_secret: docker_username + when: + ref: + - "refs/tags/**" + +trigger: + ref: + - refs/heads/master + - "refs/tags/**" + - "refs/pull/**" + +depends_on: +- security + +--- +kind: pipeline +name: build-container-arm + +platform: + os: linux + arch: arm + +steps: +- name: build + pull: always + image: python:3.7 + commands: + - python setup.py sdist + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/ansible-doctor + tags: arm + username: + from_secret: docker_username + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: arm + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/ansible-doctor + username: + from_secret: docker_username + when: + ref: + - "refs/tags/**" + +trigger: + ref: + - refs/heads/master + - "refs/tags/**" + - "refs/pull/**" + +depends_on: +- security + --- kind: pipeline name: notifications @@ -212,6 +371,6 @@ depends_on: --- kind: signature -hmac: 602f1e2058d0b5d15da827d7893c2f111bb161741bfd7ea60cc2b882e1a54ea2 +hmac: 0ac43538538113c88342a17b4cc14b9e08f8540247844cac6cd46f7116048332 ... diff --git a/Dockerfile.linux b/Dockerfile similarity index 57% rename from Dockerfile.linux rename to Dockerfile index c0762cf..b293983 100644 --- a/Dockerfile.linux +++ b/Dockerfile @@ -6,12 +6,15 @@ LABEL maintainer="Robert Kaussow " \ org.label-schema.vendor="Robert Kaussow" \ org.label-schema.schema-version="1.0" +ADD dist/ansible_doctor*.whl /ansible_doctor.whl + RUN \ apk update --no-cache \ - && rm -rf /var/cache/apk/* \ - && pip install --upgrade --no-cache-dir pip \ - && pip install --no-cache-dir ${PIP_PACKAGES} \ - && rm -rf /root/.cache/ + rm -rf /var/cache/apk/* && \ + pip install --upgrade --no-cache-dir pip && \ + pip install --no-cache-dir ansible_doctor.whl && \ + rm -f ansible_doctor.whl && \ + rm -rf /root/.cache/ USER root CMD [] diff --git a/manifest.tmpl b/manifest.tmpl new file mode 100644 index 0000000..999876b --- /dev/null +++ b/manifest.tmpl @@ -0,0 +1,25 @@ +image: xoxys/ansible-doctor:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + {{#if this}} + - {{trimPrefix "v" this}} + - {{trimPrefix "v" this}}-linux-amd64 + {{/if}} +{{/each}} +{{/if}} +manifests: + - image: xoxys/ansible-doctor:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + + - image: xoxys/ansible-doctor:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + + - image: xoxys/ansible-doctor:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm + platform: + architecture: arm + os: linux