From 0d7c9d677707935f9015ff9c0ffc99df790d21fa Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 2 Nov 2022 21:34:28 +0100 Subject: [PATCH] fork --- .chglog/CHANGELOG.tpl.md | 4 +- .chglog/config.yml | 2 +- .drone.jsonnet | 248 +++++++++++++++++++++++++ .drone.yml | 369 ++++++++++++++++++++++++++++++++++++++ .github/settings.yml | 24 +-- .gitignore | 8 +- .renovaterc.json | 4 - LICENSE | 14 +- README.md | 24 +-- docker/Dockerfile.amd64 | 14 ++ docker/Dockerfile.arm | 14 ++ docker/Dockerfile.arm64 | 14 ++ docker/manifest-quay.tmpl | 24 +++ docker/manifest.tmpl | 24 +++ retry.bats | 14 ++ 15 files changed, 764 insertions(+), 37 deletions(-) create mode 100644 .drone.jsonnet create mode 100644 .drone.yml delete mode 100644 .renovaterc.json create mode 100644 docker/Dockerfile.amd64 create mode 100644 docker/Dockerfile.arm create mode 100644 docker/Dockerfile.arm64 create mode 100644 docker/manifest-quay.tmpl create mode 100644 docker/manifest.tmpl create mode 100644 retry.bats diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md index 72cebbd..b79faa8 100755 --- a/.chglog/CHANGELOG.tpl.md +++ b/.chglog/CHANGELOG.tpl.md @@ -7,9 +7,9 @@ ### {{ .Title }} {{ range .Commits -}} -- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ (regexReplaceAll "Co-\\w*-by.*" .Subject "") | trim }} +- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ (regexReplaceAll "(.*)/issues/(.*)" (regexReplaceAll "(Co-\\w*-by.*)" .Subject "") "${1}/pull/${2}") | trim }} {{ end }} -{{ end -}} +{{- end -}} {{- if .NoteGroups -}} {{ range .NoteGroups -}} diff --git a/.chglog/config.yml b/.chglog/config.yml index 494a6ac..984ff67 100755 --- a/.chglog/config.yml +++ b/.chglog/config.yml @@ -2,7 +2,7 @@ style: github template: CHANGELOG.tpl.md info: title: CHANGELOG - repository_url: https://github.com/owncloud-ci/retry + repository_url: https://github.com/thegeeklab/retry options: commit_groups: title_maps: diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..698e6ab --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,248 @@ +local PipelineTest = { + kind: 'pipeline', + name: 'test', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'lint', + image: 'koalaman/shellcheck-alpine:stable', + commands: [ + 'shellcheck ./retry', + ], + }, + { + name: 'test', + image: 'bats/bats', + commands: [ + 'bats ./retry.bats', + ], + }, + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineBuildPackage = { + kind: 'pipeline', + name: 'build-package', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'checksum', + image: 'alpine', + commands: [ + 'sha256sum retry > sha256sum.txt', + ], + }, + { + name: 'changelog-generate', + image: 'thegeeklab/git-chglog', + commands: [ + 'git fetch -tq', + 'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}', + ], + }, + { + name: 'changelog-format', + image: 'thegeeklab/alpine-tools', + commands: [ + 'prettier CHANGELOG.md', + 'prettier -w CHANGELOG.md', + ], + }, + { + name: 'publish-github', + image: 'plugins/github-release', + settings: { + overwrite: true, + api_key: { from_secret: 'github_token' }, + files: ['retry', 'sha256sum.txt'], + title: '${DRONE_TAG}', + note: 'CHANGELOG.md', + }, + when: { + ref: ['refs/tags/**'], + }, + }, + ], + depends_on: [ + 'test', + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineBuildContainer(arch='amd64') = { + kind: 'pipeline', + name: 'build-container-' + arch, + platform: { + os: 'linux', + arch: arch, + }, + steps: [ + { + name: 'dryrun', + image: 'thegeeklab/drone-docker:19', + settings: { + dry_run: true, + dockerfile: 'docker/Dockerfile.' + arch, + repo: 'thegeeklab/${DRONE_REPO_NAME}', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + }, + when: { + ref: ['refs/pull/**'], + }, + }, + { + name: 'publish-dockerhub', + image: 'thegeeklab/drone-docker:19', + settings: { + auto_tag: true, + auto_tag_suffix: arch, + dockerfile: 'docker/Dockerfile.' + arch, + repo: 'thegeeklab/${DRONE_REPO_NAME}', + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + }, + when: { + ref: ['refs/heads/main', 'refs/tags/**'], + }, + }, + { + name: 'publish-quay', + image: 'thegeeklab/drone-docker:19', + settings: { + auto_tag: true, + auto_tag_suffix: arch, + dockerfile: 'docker/Dockerfile.' + arch, + registry: 'quay.io', + repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}', + username: { from_secret: 'quay_username' }, + password: { from_secret: 'quay_password' }, + }, + when: { + ref: ['refs/heads/main', 'refs/tags/**'], + }, + }, + ], + depends_on: [ + 'test', + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineNotifications = { + kind: 'pipeline', + name: 'notifications', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + image: 'plugins/manifest', + name: 'manifest-dockerhub', + settings: { + ignore_missing: true, + auto_tag: true, + username: { from_secret: 'docker_username' }, + password: { from_secret: 'docker_password' }, + spec: 'docker/manifest.tmpl', + }, + when: { + status: ['success'], + }, + }, + { + image: 'plugins/manifest', + name: 'manifest-quay', + settings: { + ignore_missing: true, + auto_tag: true, + username: { from_secret: 'quay_username' }, + password: { from_secret: 'quay_password' }, + spec: 'docker/manifest-quay.tmpl', + }, + when: { + status: ['success'], + }, + }, + { + name: 'pushrm-dockerhub', + pull: 'always', + image: 'chko/docker-pushrm:1', + environment: { + DOCKER_PASS: { + from_secret: 'docker_password', + }, + DOCKER_USER: { + from_secret: 'docker_username', + }, + PUSHRM_FILE: 'README.md', + PUSHRM_SHORT: 'Poor-mans docker service synchronizer', + PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}', + }, + when: { + status: ['success'], + }, + }, + { + name: 'pushrm-quay', + pull: 'always', + image: 'chko/docker-pushrm:1', + environment: { + APIKEY__QUAY_IO: { + from_secret: 'quay_token', + }, + PUSHRM_FILE: 'README.md', + PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}', + }, + when: { + status: ['success'], + }, + }, + { + name: 'matrix', + image: 'thegeeklab/drone-matrix', + settings: { + homeserver: { from_secret: 'matrix_homeserver' }, + roomid: { from_secret: 'matrix_roomid' }, + template: 'Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}', + username: { from_secret: 'matrix_username' }, + password: { from_secret: 'matrix_password' }, + }, + when: { + status: ['success', 'failure'], + }, + }, + ], + depends_on: [ + 'build-container-amd64', + 'build-container-arm', + 'build-container-arm64', + ], + trigger: { + ref: ['refs/heads/main', 'refs/tags/**'], + status: ['success', 'failure'], + }, +}; + +[ + PipelineTest, + PipelineBuildPackage, + PipelineBuildContainer(arch='amd64'), + PipelineBuildContainer(arch='arm64'), + PipelineBuildContainer(arch='arm'), + PipelineNotifications, +] diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..f282fa6 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,369 @@ +--- +kind: pipeline +name: test + +platform: + os: linux + arch: amd64 + +steps: + - name: lint + image: koalaman/shellcheck-alpine:stable + commands: + - shellcheck ./retry + + - name: test + image: bats/bats + commands: + - bats ./retry.bats + +trigger: + ref: + - refs/heads/main + - refs/tags/** + - refs/pull/** + +--- +kind: pipeline +name: build-package + +platform: + os: linux + arch: amd64 + +steps: + - name: checksum + image: alpine + commands: + - sha256sum retry > sha256sum.txt + + - name: changelog-generate + image: thegeeklab/git-chglog + commands: + - git fetch -tq + - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased} + + - name: changelog-format + image: thegeeklab/alpine-tools + commands: + - prettier CHANGELOG.md + - prettier -w CHANGELOG.md + + - name: publish-github + image: plugins/github-release + settings: + api_key: + from_secret: github_token + files: + - retry + - sha256sum.txt + note: CHANGELOG.md + overwrite: true + title: ${DRONE_TAG} + when: + ref: + - refs/tags/** + +trigger: + ref: + - refs/heads/main + - refs/tags/** + - refs/pull/** + +depends_on: + - test + +--- +kind: pipeline +name: build-container-amd64 + +platform: + os: linux + arch: amd64 + +steps: + - name: dryrun + image: thegeeklab/drone-docker:19 + settings: + dockerfile: docker/Dockerfile.amd64 + dry_run: true + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + + - name: publish-dockerhub + image: thegeeklab/drone-docker:19 + settings: + auto_tag: true + auto_tag_suffix: amd64 + dockerfile: docker/Dockerfile.amd64 + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/main + - refs/tags/** + + - name: publish-quay + image: thegeeklab/drone-docker:19 + settings: + auto_tag: true + auto_tag_suffix: amd64 + dockerfile: docker/Dockerfile.amd64 + password: + from_secret: quay_password + registry: quay.io + repo: quay.io/thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: quay_username + when: + ref: + - refs/heads/main + - refs/tags/** + +trigger: + ref: + - refs/heads/main + - refs/tags/** + - refs/pull/** + +depends_on: + - test + +--- +kind: pipeline +name: build-container-arm64 + +platform: + os: linux + arch: arm64 + +steps: + - name: dryrun + image: thegeeklab/drone-docker:19 + settings: + dockerfile: docker/Dockerfile.arm64 + dry_run: true + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + + - name: publish-dockerhub + image: thegeeklab/drone-docker:19 + settings: + auto_tag: true + auto_tag_suffix: arm64 + dockerfile: docker/Dockerfile.arm64 + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/main + - refs/tags/** + + - name: publish-quay + image: thegeeklab/drone-docker:19 + settings: + auto_tag: true + auto_tag_suffix: arm64 + dockerfile: docker/Dockerfile.arm64 + password: + from_secret: quay_password + registry: quay.io + repo: quay.io/thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: quay_username + when: + ref: + - refs/heads/main + - refs/tags/** + +trigger: + ref: + - refs/heads/main + - refs/tags/** + - refs/pull/** + +depends_on: + - test + +--- +kind: pipeline +name: build-container-arm + +platform: + os: linux + arch: arm + +steps: + - name: dryrun + image: thegeeklab/drone-docker:19 + settings: + dockerfile: docker/Dockerfile.arm + dry_run: true + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + + - name: publish-dockerhub + image: thegeeklab/drone-docker:19 + settings: + auto_tag: true + auto_tag_suffix: arm + dockerfile: docker/Dockerfile.arm + password: + from_secret: docker_password + repo: thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/main + - refs/tags/** + + - name: publish-quay + image: thegeeklab/drone-docker:19 + settings: + auto_tag: true + auto_tag_suffix: arm + dockerfile: docker/Dockerfile.arm + password: + from_secret: quay_password + registry: quay.io + repo: quay.io/thegeeklab/${DRONE_REPO_NAME} + username: + from_secret: quay_username + when: + ref: + - refs/heads/main + - refs/tags/** + +trigger: + ref: + - refs/heads/main + - refs/tags/** + - refs/pull/** + +depends_on: + - test + +--- +kind: pipeline +name: notifications + +platform: + os: linux + arch: amd64 + +steps: + - name: manifest-dockerhub + image: plugins/manifest + settings: + auto_tag: true + ignore_missing: true + password: + from_secret: docker_password + spec: docker/manifest.tmpl + username: + from_secret: docker_username + when: + status: + - success + + - name: manifest-quay + image: plugins/manifest + settings: + auto_tag: true + ignore_missing: true + password: + from_secret: quay_password + spec: docker/manifest-quay.tmpl + username: + from_secret: quay_username + when: + status: + - success + + - name: pushrm-dockerhub + pull: always + image: chko/docker-pushrm:1 + environment: + DOCKER_PASS: + from_secret: docker_password + DOCKER_USER: + from_secret: docker_username + PUSHRM_FILE: README.md + PUSHRM_SHORT: Poor-mans docker service synchronizer + PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} + when: + status: + - success + + - name: pushrm-quay + pull: always + image: chko/docker-pushrm:1 + environment: + APIKEY__QUAY_IO: + from_secret: quay_token + PUSHRM_FILE: README.md + PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME} + when: + status: + - success + + - name: matrix + image: thegeeklab/drone-matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + template: "Status: **{{ build.Status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}
Message: {{ commit.Message.Title }}" + username: + from_secret: matrix_username + when: + status: + - success + - failure + +trigger: + ref: + - refs/heads/main + - refs/tags/** + status: + - success + - failure + +depends_on: + - build-container-amd64 + - build-container-arm + - build-container-arm64 + +--- +kind: signature +hmac: 1cb682c6e2f382da9704f103c97b12d5ce10f407b0bda7d0a8377581fea34ae3 + +... diff --git a/.github/settings.yml b/.github/settings.yml index 8240bd3..c5e2ef7 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,16 +1,14 @@ ---- repository: name: retry description: Retry any shell command - topics: tools + topics: cli, tools, oci private: false has_issues: true - has_projects: false has_wiki: false - has_downloads: false + has_downloads: true - default_branch: master + default_branch: main allow_squash_merge: true allow_merge_commit: true @@ -45,22 +43,14 @@ labels: color: ffffff description: This will not be worked on -teams: - - name: bot - permission: admin - branches: - - name: master + - name: main protection: required_pull_request_reviews: null required_status_checks: strict: false contexts: - continuous-integration/drone/pr - enforce_admins: false - restrictions: - apps: - - renovate - users: [] - teams: - - bot + enforce_admins: true + required_linear_history: true + restrictions: null diff --git a/.gitignore b/.gitignore index 07ff1e8..eabd1ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ -.drone.yml +# OSX +.DS_Store + +# Node +node_modules + +# Misc CHANGELOG.md diff --git a/.renovaterc.json b/.renovaterc.json deleted file mode 100644 index d7442ec..0000000 --- a/.renovaterc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["github>owncloud-ci/renovate-presets:docker"] -} diff --git a/LICENSE b/LICENSE index e1f657b..c9faf00 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -175,7 +176,18 @@ END OF TERMS AND CONDITIONS - Copyright 2022 ownCloud GmbH + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Robert Kaussow Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index a567e0c..c25849d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ # retry -[![Build Status](https://img.shields.io/drone/build/owncloud-ci/retry?logo=drone&server=https%3A%2F%2Fdrone.owncloud.com)](https://drone.owncloud.com/owncloud-ci/retry) -[![GitHub contributors](https://img.shields.io/github/contributors/owncloud-ci/retry)](https://github.com/owncloud-ci/retry/graphs/contributors) -[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/owncloud-ci/retry) -[![License: Apache-2.0](https://img.shields.io/github/license/owncloud-ci/retry)](https://github.com/owncloud-ci/retry/blob/master/LICENSE) +Poor-mans servie synchronizer + +[![Build Status](https://img.shields.io/drone/build/thegeeklab/retry?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/retry) +[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/retry) +[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/retry) +[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/retry)](https://github.com/thegeeklab/retry/graphs/contributors) +[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/retry) +[![License: MIT](https://img.shields.io/github/license/thegeeklab/retry)](https://github.com/thegeeklab/retry/blob/main/LICENSE) Retry any shell command with exponential backoff or constant delay. @@ -14,7 +18,7 @@ Install: retry is a shell script, so drop it somewhere and make sure it's added to your \$PATH. Or you can use the following one-liner: ```Shell -curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/owncloud-ci/retry/master/retry && chmod +x /usr/local/bin/retry +curl -SsfL -o /usr/local/bin/retry https://raw.githubusercontent.com/thegeeklab/retry/main/retry && chmod +x /usr/local/bin/retry ``` ## Usage @@ -128,12 +132,10 @@ Before retry #3: sleeping 1.2 seconds Passed at attempt 3 ``` -## License +## Contributors -This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/owncloud-ci/retry/blob/master/LICENSE) file for details. +Special thanks to all [contributors](https://github.com/thegeeklab/retry/graphs/contributors). If you would like to contribute, please see the [instructions](https://github.com/thegeeklab/retry/blob/main/CONTRIBUTING.md). -## Copyright +## License -```Text -Copyright (c) 2022 ownCloud GmbH -``` +This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/thegeeklab/retry/blob/main/LICENSE) file for details. diff --git a/docker/Dockerfile.amd64 b/docker/Dockerfile.amd64 new file mode 100644 index 0000000..4dd22a2 --- /dev/null +++ b/docker/Dockerfile.amd64 @@ -0,0 +1,14 @@ +FROM alpine:3.16@sha256:7580ece7963bfa863801466c0a488f11c86f85d9988051a9f9c68cb27f6b7872 + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="retry" +LABEL org.opencontainers.image.url="https://github.com/thegeeklab/retry" +LABEL org.opencontainers.image.source="https://github.com/thegeeklab/retry" +LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/retry" + +ADD retry /usr/local/bin/retry + +USER root +CMD [] +ENTRYPOINT ["/usr/local/bin/retry"] diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm new file mode 100644 index 0000000..af9526a --- /dev/null +++ b/docker/Dockerfile.arm @@ -0,0 +1,14 @@ +FROM arm32v7/alpine:3.16@sha256:0dc112f0cf79af2654a164af9223723348b07ce2b798bbcb858984fb64d8e13b + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="retry" +LABEL org.opencontainers.image.url="https://github.com/thegeeklab/retry" +LABEL org.opencontainers.image.source="https://github.com/thegeeklab/retry" +LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/retry" + +ADD retry /usr/local/bin/retry + +USER root +CMD [] +ENTRYPOINT ["/usr/local/bin/retry"] diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 new file mode 100644 index 0000000..8053b27 --- /dev/null +++ b/docker/Dockerfile.arm64 @@ -0,0 +1,14 @@ +FROM arm64v8/alpine:3.16@sha256:d66d8a4b754d1e4da73ed711f0df63b3f19403f4e0711e4edc97ac87d20d707a + +LABEL maintainer="Robert Kaussow " +LABEL org.opencontainers.image.authors="Robert Kaussow " +LABEL org.opencontainers.image.title="retry" +LABEL org.opencontainers.image.url="https://github.com/thegeeklab/retry" +LABEL org.opencontainers.image.source="https://github.com/thegeeklab/retry" +LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/retry" + +ADD retry /usr/local/bin/retry + +USER root +CMD [] +ENTRYPOINT ["/usr/local/bin/retry"] diff --git a/docker/manifest-quay.tmpl b/docker/manifest-quay.tmpl new file mode 100644 index 0000000..14c6a70 --- /dev/null +++ b/docker/manifest-quay.tmpl @@ -0,0 +1,24 @@ +image: quay.io/thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - image: quay.io/thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64 + platform: + architecture: amd64 + os: linux + + - image: quay.io/thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + + - image: quay.io/thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl new file mode 100644 index 0000000..93ce499 --- /dev/null +++ b/docker/manifest.tmpl @@ -0,0 +1,24 @@ +image: thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} +{{#if build.tags}} +tags: +{{#each build.tags}} + - {{this}} +{{/each}} +{{/if}} +manifests: + - image: thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64 + platform: + architecture: amd64 + os: linux + + - image: thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64 + platform: + architecture: arm64 + os: linux + variant: v8 + + - image: thegeeklab/retry:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm + platform: + architecture: arm + os: linux + variant: v7 diff --git a/retry.bats b/retry.bats new file mode 100644 index 0000000..cd1a41e --- /dev/null +++ b/retry.bats @@ -0,0 +1,14 @@ +#!/usr/bin/env bats + +@test "retry echo should work" { + run ./retry echo u work good + + [ "$output" = "u work good" ] +} + +@test "retry false should fail" { + run ./retry -t 1 'echo "y u no work"; false' + + [ "$status" -ne 0 ] + [ "$output" = "y u no work" ] +}