From b76f805f7f660d207cbea2a14c853180f7ae50d3 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 3 Nov 2022 22:03:02 +0100 Subject: [PATCH] refactor: replace linkcheck with muffet (#93) --- .drone.yml | 22 ++-------------------- Dockerfile | 9 ++++++--- Makefile | 29 ----------------------------- README.md | 8 ++++---- overlay/bin/link-validator | 4 ++-- 5 files changed, 14 insertions(+), 58 deletions(-) delete mode 100644 Makefile diff --git a/.drone.yml b/.drone.yml index 99a75a4..05c4109 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,22 +27,6 @@ platform: arch: amd64 steps: - - name: binary - image: dart:stable - commands: - - apt-get -qq update && apt-get install -yqq --no-install-recommends make - - make build - environment: - BUILD_VERSION: ${DRONE_TAG%-*} - - - name: verify - image: dart:stable - commands: - - src/build/linkcheck/linkcheck --help - - src/build/linkcheck/linkcheck --version - depends_on: - - binary - - name: dryrun image: thegeeklab/drone-docker-buildx:20 settings: @@ -52,8 +36,6 @@ steps: when: ref: - refs/pull/** - depends_on: - - verify - name: tags image: thegeeklab/docker-autotag @@ -161,7 +143,7 @@ steps: DOCKER_USER: from_secret: docker_username PUSHRM_FILE: README.md - PUSHRM_SHORT: Custom image for linkcheck + PUSHRM_SHORT: Custom image for muffet PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} when: status: @@ -209,6 +191,6 @@ depends_on: --- kind: signature -hmac: 8746fe501b443c4f93f766414ef030b10c28cdc0cc19ca5984601c4bb5f98bf6 +hmac: 0c57ba1ef7ccc0642fd0811c068c3d7fd15e299c54fafcffb750dfac47323e50 ... diff --git a/Dockerfile b/Dockerfile index 8061de3..e9b3a83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,28 +17,31 @@ ENV CADDY_VERSION="${CADDY_VERSION:-v2.6.2}" ENV WAIT_FOR_VERSION="${WAIT_FOR_VERSION:-v0.2.0}" # renovate: datasource=github-releases depName=thegeeklab/retry ENV RETRY_VERSION="${RETRY_VERSION:-v0.3.0}" +# renovate: datasource=github-releases depName=raviqqe/muffet +ENV MUFFET_VERSION="${MUFFET_VERSION:-v2.6.1}" # renovate: datasource=git-tags depName=https://gitea.rknet.org/docker/container-library ENV CONTAINER_LIBRARY="${CONTAINER_LIBRARY:-v0.1.3}" ENV LINK_VALIDATOR_BASE_DIR=/drone/src \ - LINK_VALIDATOR_SERVER_PORT=8000 + LINK_VALIDATOR_SERVER_PORT=8000 \ + LINK_VALIDATOR_RETRIES=0 COPY overlay/ / RUN apt-get update && apt-get install -y curl bash ncat media-types && \ curl -SsfL "https://gitea.rknet.org/docker/container-library/releases/download/${CONTAINER_LIBRARY}/container-library.tar.gz" | tar xz -C / && \ curl -sSL "https://github.com/caddyserver/caddy/releases/download/${CADDY_VERSION}/caddy_${CADDY_VERSION##v}_linux_amd64.tar.gz" | tar xz -C /usr/local/bin caddy && \ + curl -SsfL "https://github.com/raviqqe/muffet/releases/download/${MUFFET_VERSION}/muffet_${MUFFET_VERSION##v}_Linux_x86_64.tar.gz" | tar xz -C /usr/local/bin muffet && \ curl -SsfL -o /usr/local/bin/wait-for "https://github.com/thegeeklab/wait-for/releases/download/${WAIT_FOR_VERSION}/wait-for" && \ curl -SsfL -o /usr/local/bin/retry "https://github.com/thegeeklab/retry/releases/download/${RETRY_VERSION}/retry" && \ chmod 755 /usr/local/bin/caddy && \ + chmod 755 /usr/local/bin/muffet && \ chmod 755 /usr/local/bin/wait-for && \ chmod 755 /usr/local/bin/retry && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /tmp/* && \ rm -rf /root/.cache/ -ADD src/build/linkcheck/linkcheck /usr/local/bin/linkcheck - USER root CMD [] ENTRYPOINT ["/bin/link-validator"] diff --git a/Makefile b/Makefile deleted file mode 100644 index e08238c..0000000 --- a/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# renovate: datasource=github-tags depName=filiph/linkcheck -export BUILD_VERSION ?= 2.0.23 -export PATH := $(PATH):$(HOME)/.pub-cache/bin - -SRC := src - -.PHONY: all -all: build - -.PHONY: build -build: build-src build-bin - -.PHONY: build-src -build-src: - mkdir -p $(SRC); \ - curl -sSL "https://github.com/filiph/linkcheck/archive/$${BUILD_VERSION##v}.tar.gz" | tar xz -C $(SRC) --strip-components=1 - -.PHONY: build-bin -build-bin: - dart --disable-analytics --version; \ - cd $(SRC); \ - dart pub get; \ - dart pub global activate grinder; \ - grind pkg-standalone-linux-x64; \ - tar xzf build/linkcheck-*-linux-x64.tar.gz -C ./build - -.PHONY: clean -clean: - rm -rf $(SRC) diff --git a/README.md b/README.md index d4aa328..e51dae3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # link-validator -Custom image for linkcheck +Custom image for muffet [![Build Status](https://img.shields.io/drone/build/docker/link-validator?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/docker/link-validator) [![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/link-validator) @@ -8,15 +8,15 @@ Custom image for linkcheck [![Source: Gitea](https://img.shields.io/badge/source-gitea-blue.svg?logo=gitea&logoColor=white)](https://gitea.rknet.org/docker/link-validator) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://gitea.rknet.org/docker/link-validator/src/branch/main/LICENSE) -Custom wrapper Docker image for [linkcheck](https://github.com/filiph/linkcheck/) optimized for CI. +Custom wrapper Docker image for [muffet](https://github.com/raviqqe/muffet) optimized for CI. ## Usage ```Shell docker run -v $(pwd)/public:/drone/src link-validator -# or pass arguments to linkcheck -# ... but DO NOT set the server url! This will be done automatically. See environment variables. +# Pass arguments to muffet +# ... but DO NOT set the server url! This is done automatically. docker run -v $(pwd)/public:/drone/src link-validator -e ``` diff --git a/overlay/bin/link-validator b/overlay/bin/link-validator index f810b1c..53f2cf1 100755 --- a/overlay/bin/link-validator +++ b/overlay/bin/link-validator @@ -12,5 +12,5 @@ caddy file-server --root "$LINK_VALIDATOR_BASE_DIR" --listen "$URL" & log_info "Wait for web server on '$URL'" /usr/local/bin/wait-for "$URL" -log_info "Start linkcheck" -exec retry -t "${LINK_VALIDATOR_RETRIES:-0}" -- "/usr/local/bin/linkcheck $* $URL" +log_info "Start muffet" +exec retry -t "$LINK_VALIDATOR_RETRIES" -- "/usr/local/bin/muffet $* http://$URL"