Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offer multiple versions #3

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ jobs:
matrix:
version:
- 'latest'
- '0.15'
- '0.14'
- '0.13'
- '0.12'
- '0.11'
- '0.10'
steps:

# ------------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,5 @@ jobs:
# Lint repository
# ------------------------------------------------------------
- name: Lint
id: vars
run: |
make lint

7 changes: 6 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ jobs:
matrix:
version:
- 'latest'
- '0.15'
- '0.14'
- '0.13'
- '0.12'
- '0.11'
- '0.10'
refs:
- 'master'
- '0.1'
steps:

# ------------------------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ FROM alpine:3.13 as builder

RUN set -x \
&& apk add --no-cache \
git \
wget

ARG VERSION
RUN set -x \
&& if [ "${VERSION}" = "latest" ]; then \
wget "https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz"; \
else \
wget "https://github.com/instrumenta/kubeval/releases/download/${VERSION}/kubeval-darwin-amd64.tar.gz"; \
git clone https://github.com/instrumenta/kubeval /tmp/kubeval \
&& cd /tmp/kubeval \
&& VERSION="$( git tag --sort=v:refname | grep -E "^${VERSION}" | tail -1 )" \
&& cd / \
&& echo "${VERSION}" \
&& wget "https://github.com/instrumenta/kubeval/releases/download/${VERSION}/kubeval-linux-amd64.tar.gz"; \
fi \
&& tar xf kubeval-linux-amd64.tar.gz \
&& cp kubeval /usr/bin/kubeval \
Expand Down
44 changes: 41 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,45 @@ help:
# --------------------------------------------------------------------------------------------------
# Lint Targets
# --------------------------------------------------------------------------------------------------
lint:
lint: _lint-files
lint: _lint-workflow

.PHONY: _lint-workflow
_lint-workflow:
@echo "################################################################################"
@echo "# Lint Workflow"
@echo "################################################################################"
@\
GIT_CURR_MAJOR="$$( git tag | sort -V | tail -1 | sed 's|\.[0-9]*$$||g' )"; \
GIT_CURR_MINOR="$$( git tag | sort -V | tail -1 | sed 's|^[0-9]*\.||g' )"; \
GIT_NEXT_TAG="$${GIT_CURR_MAJOR}.$$(( GIT_CURR_MINOR + 1 ))"; \
AVAILABLE_REFS="$$( \
grep 'refs:' -A 100 .github/workflows/nightly.yml \
| grep 'steps:' -B 100 \
| grep -E '[[:space:]]+\-' \
| sed 's/.*\s//g' \
| sed "s/'//g" \
| sed 's/"//g' \
| grep -v master || true \
)"; \
if [ -n "$${AVAILABLE_REFS}" ]; then \
if ! grep 'refs:' -A 100 .github/workflows/nightly.yml \
| grep " - '$${GIT_NEXT_TAG}'" >/dev/null; then \
echo "[ERR] New Tag required in .github/workflows/nightly.yml: $${GIT_NEXT_TAG}"; \
exit 1; \
else \
echo "[OK] Git Tag present in .github/workflows/nightly.yml: $${GIT_NEXT_TAG}"; \
fi \
else \
echo "[OK] No Tags defined at all in .github/workflows/nightly.yml"; \
fi
@echo

.PHONY: lint-files
_lint-files:
@echo "################################################################################"
@echo "# Lint Files"
@echo "################################################################################"
@docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint file-cr --text --ignore '.git/,.github/,tests/' --path .
@docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint file-crlf --text --ignore '.git/,.github/,tests/' --path .
@docker run --rm -v $(CURRENT_DIR):/data cytopia/file-lint file-trailing-single-newline --text --ignore '.git/,.github/,tests/' --path .
Expand Down Expand Up @@ -79,13 +117,13 @@ _test-version:
| grep -Eo '[.0-9]+' \
)"; \
echo "Testing for latest: $${LATEST}"; \
if ! docker run --rm $(IMAGE) --version | grep -E "$${LATEST}$$"; then \
if ! docker run --rm $(IMAGE) --version | grep -E "Version: $${LATEST}$$"; then \
echo "Failed"; \
exit 1; \
fi; \
else \
echo "Testing for tag: $(VERSION)"; \
if ! docker run --rm $(IMAGE) --version | grep -E "^$(VERSION)"; then \
if ! docker run --rm $(IMAGE) --version | grep -E "Version: $(VERSION)"; then \
echo "Failed"; \
exit 1; \
fi; \
Expand Down
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,37 @@ The image is built nightly against multiple stable versions and pushed to Docker

## Available Docker image versions

| Docker tag | Build from |
|------------|------------|
| `latest` | Latest stable version |
#### Rolling releaess

The following Docker image tags are rolling releases and are built and updated every night.

[![nightly](https://github.com/cytopia/docker-kubeval/workflows/nightly/badge.svg)](https://github.com/cytopia/docker-kubeval/actions?query=workflow%3Anightly)

| Docker tag | Explanation |
|-----------------|-------------|
| `latest` | Latest stable version |
| `0.15` | Latest stable `0.15.x` version |
| `0.14` | Latest stable `0.14.x` version |
| `0.13` | Latest stable `0.13.x` version |
| `0.12` | Latest stable `0.12.x` version |
| `0.11` | Latest stable `0.11.x` version |
| `0.10` | Latest stable `0.10.x` version |

#### Point in time releases

The following Docker image tags are built once and can be used for reproducible builds. Its version never changes so you will have to update tags in your pipelines from time to time in order to stay up-to-date.

[![build](https://github.com/cytopia/docker-kubeval/workflows/build/badge.svg)](https://github.com/cytopia/docker-kubeval/actions?query=workflow%3Abuild)

| Docker tag | Explanation |
|-----------------|-------------|
| `latest-<TAG>` | Latest stable version when this repository was git tagged |
| `0.15-<TAG>` | Latest stable 0.15.x version when this repository was git tagged |
| `0.14-<TAG>` | Latest stable 0.14.x version when this repository was git tagged |
| `0.13-<TAG>` | Latest stable 0.13.x version when this repository was git tagged |
| `0.12-<TAG>` | Latest stable 0.12.x version when this repository was git tagged |
| `0.11-<TAG>` | Latest stable 0.11.x version when this repository was git tagged |
| `0.10-<TAG>` | Latest stable 0.10.x version when this repository was git tagged |


## Docker mounts
Expand Down