Skip to content

Commit

Permalink
ci: Alpine migration for pinning/updating all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveloperC286 committed Nov 26, 2024
1 parent 2f66582 commit c5491c0
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 31 deletions.
70 changes: 42 additions & 28 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,51 @@ COPY_METADATA:
COPY --dir ".git/" "./"


rust-base:
FROM rust:1.70.0
alpine-base:
FROM alpine:3.20.3@sha256:1e42bbe2508154c9126d48c2b8a75420c3544343bf86fd041fb7527e017a4b4a
# renovate: datasource=repology depName=alpine_3_20/bash versioning=loose
ENV BASH_VERSION="5.2.26-r0"
RUN apk add --no-cache bash=$BASH_VERSION
WORKDIR "/zsh-simple-abbreviations"


check-clean-git-history:
FROM +rust-base
RUN cargo install clean_git_history --version 0.1.2 --locked
FROM +alpine-base
# renovate: datasource=github-releases depName=DeveloperC286/clean_git_history
ENV CLEAN_GIT_HISTORY_VERSION="v0.2.0"
RUN wget -O - "https://github.com/DeveloperC286/clean_git_history/releases/download/${CLEAN_GIT_HISTORY_VERSION}/x86_64-unknown-linux-musl.gz" | gzip -d > /usr/bin/clean_git_history && chmod 755 /usr/bin/clean_git_history
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/check-clean-git-history.sh --from-reference "${from_reference}"


check-conventional-commits-linting:
FROM +alpine-base
# renovate: datasource=github-releases depName=DeveloperC286/conventional_commits_linter
ENV CONVENTIONAL_COMMITS_LINTER_VERSION="v0.13.0"
RUN wget -O - "https://github.com/DeveloperC286/conventional_commits_linter/releases/download/${CONVENTIONAL_COMMITS_LINTER_VERSION}/x86_64-unknown-linux-musl.gz" | gzip -d > /usr/bin/conventional_commits_linter && chmod 755 /usr/bin/conventional_commits_linter
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/check-conventional-commits-linting.sh --from-reference "${from_reference}"


COPY_SOURCECODE:
COMMAND
DO +COPY_CI_DATA
COPY --dir "zsh-simple-abbreviations.zsh" "src/" "end-to-end-tests/" "./"


golang-base:
FROM golang:1.20.13
ENV GOPROXY=direct
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
WORKDIR "/zsh-simple-abbreviations"
FROM golang:1.22.1
WORKDIR "/consistent_whitespace"


shell-formatting-base:
FROM +golang-base
RUN go install mvdan.cc/sh/v3/cmd/[email protected]
DO +COPY_SOURCECODE
# renovate: datasource=github-releases depName=mvdan/sh
ENV SHFMT_VERSION="v3.7.0"
RUN go install mvdan.cc/sh/v3/cmd/shfmt@$SHFMT_VERSION
DO +COPY_CI_DATA


check-shell-formatting:
Expand All @@ -53,7 +66,9 @@ check-shell-formatting:

yaml-formatting-base:
FROM +golang-base
RUN go install github.com/google/yamlfmt/cmd/[email protected]
# renovate: datasource=github-releases depName=google/yamlfmt
ENV YAMLFMT_VERSION="v0.10.0"
RUN go install github.com/google/yamlfmt/cmd/yamlfmt@$YAMLFMT_VERSION
COPY ".yamlfmt" "./"
DO +COPY_CI_DATA

Expand Down Expand Up @@ -88,30 +103,29 @@ fix-formatting:


check-shell-linting:
FROM ubuntu:22.04
# https://askubuntu.com/questions/462690/what-does-apt-get-fix-missing-do-and-when-is-it-useful
RUN apt-get update --fix-missing
RUN apt-get install shellcheck -y
WORKDIR "/zsh-simple-abbreviations"
DO +COPY_SOURCECODE
FROM +alpine-base
# renovate: datasource=repology depName=alpine_3_20/shellcheck versioning=loose
ENV SHELLCHECK_VERSION="0.10.0-r1"
RUN apk add --no-cache shellcheck=$SHELLCHECK_VERSION
DO +COPY_CI_DATA
RUN ./ci/check-shell-linting.sh


check-conventional-commits-linting:
FROM +rust-base
RUN cargo install conventional_commits_linter --version 0.12.3 --locked
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/check-conventional-commits-linting.sh --from-reference "${from_reference}"


check-github-actions-workflows-linting:
FROM +golang-base
RUN go install github.com/rhysd/actionlint/cmd/[email protected]
# renovate: datasource=github-releases depName=rhysd/actionlint
ENV ACTIONLINT_VERSION="v1.6.26"
RUN go install github.com/rhysd/actionlint/cmd/actionlint@$ACTIONLINT_VERSION
DO +COPY_CI_DATA
RUN ./ci/check-github-actions-workflows-linting.sh


check-linting:
BUILD +check-shell-linting
BUILD +check-github-actions-workflows-linting



e2e-test:
BUILD +abbreviation-finding-ignores-arguments-e2e-test
BUILD +abbreviation-finding-ignores-environment-variables-e2e-test
Expand Down
2 changes: 1 addition & 1 deletion ci/check-clean-git-history.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ parse_commandline "$@"
set -o errexit
set -o xtrace

"${CARGO_HOME}/bin/clean_git_history" --from-reference "${_arg_from_reference}"
clean_git_history --from-reference "${_arg_from_reference}"
# ] <-- needed because of Argbash
2 changes: 1 addition & 1 deletion ci/check-conventional-commits-linting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ parse_commandline "$@"
set -o errexit
set -o xtrace

"${CARGO_HOME}/bin/conventional_commits_linter" --from-reference "${_arg_from_reference}" --allow-angular-type-only
conventional_commits_linter --from-reference "${_arg_from_reference}" --allow-angular-type-only
# ] <-- needed because of Argbash
30 changes: 29 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
"config:best-practices"
],
"dockerfile": {
"fileMatch": [
"(^|/)Earthfile$",
"(^|/|\\.)Dockerfile$",
"(^|/)Dockerfile[^/]*$"
]
},
"customManagers": [
{
"customType": "regex",
"fileMatch": ["^Earthfile$"],
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s.+_VERSION=\"(?<currentValue>.*?)\"\\s"
]
},
{
"customType": "regex",
"fileMatch": ["^Earthfile$"],
"matchStrings": [
"# renovate: datasource=repology packageName=alpine_(?<currentValue>\\d+[._]\\d+)"
],
"currentValueTemplate": "{{{ replace '_' '.' currentValue }}}",
"datasourceTemplate": "docker",
"depNameTemplate": "alpine",
"versioningTemplate": "regex:^(?<major>\\d+)[._](?<minor>\\d+)$",
"autoReplaceStringTemplate": "# renovate: datasource=repology packageName=alpine_{{{newMajor}}}_{{{newMinor}}}"
}
]
}

0 comments on commit c5491c0

Please sign in to comment.