Skip to content

Commit f4188e9

Browse files
authored
Merge pull request #1 from Intellection/add_test_and_release_workflows
Add test and release workflows to build multi-arch Docker image
2 parents 972549d + d699334 commit f4188e9

File tree

5 files changed

+141
-1
lines changed

5 files changed

+141
-1
lines changed

.github/workflows/release.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
env:
9+
IMAGE: zappi/k8s-ttl-controller
10+
11+
jobs:
12+
github:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Create Release
16+
uses: actions/create-release@v1
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag_name: ${{ github.ref_name }}
21+
release_name: Version ${{ github.ref_name }}
22+
draft: false
23+
prerelease: false
24+
25+
docker-hub:
26+
needs: github
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: write
30+
packages: write
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
repository: TwiN/k8s-ttl-controller
36+
ref: "v${{ github.ref_name }}"
37+
- name: Prepare Image Metadata
38+
id: metadata
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: ${{ env.IMAGE }}
42+
- name: Set Up QEMU
43+
uses: docker/setup-qemu-action@v3
44+
- name: Set Up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
- name: Login To Docker Hub
47+
uses: docker/login-action@v3
48+
with:
49+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
50+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
51+
- name: Build, tag, and push image to Docker Hub
52+
uses: docker/build-push-action@v6
53+
with:
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
context: .
57+
platforms: linux/amd64,linux/arm64
58+
push: true
59+
annotations: ${{ steps.metadata.outputs.annotations }}
60+
labels: ${{ steps.metadata.outputs.labels }}
61+
tags: ${{ steps.metadata.outputs.tags }}
62+
63+
docker-hub-description:
64+
needs: docker-hub
65+
runs-on: ubuntu-latest
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v4
69+
- name: Update Description On Docker Hub Description
70+
uses: peter-evans/dockerhub-description@v4
71+
with:
72+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
73+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
74+
repository: ${{ env.IMAGE }}

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
env:
12+
# Update this to the exact version that you want to test i.e. the packaging
13+
# into a Docker image.
14+
VERSION: 1.3.1
15+
16+
jobs:
17+
docker-build:
18+
runs-on: ubuntu-latest
19+
env:
20+
IMAGE: zappi/k8s-ttl-controller
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
repository: TwiN/k8s-ttl-controller
26+
ref: v${{ env.VERSION }}
27+
- name: Prepare Image Metadata
28+
id: metadata
29+
uses: docker/metadata-action@v5
30+
with:
31+
images: ${{ env.IMAGE }}
32+
- name: Set Up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
- name: Set Up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
- name: Test Multi-Arch Building Of Image
37+
uses: docker/build-push-action@v6
38+
with:
39+
cache-from: type=gha
40+
cache-to: type=gha,mode=max
41+
context: .
42+
platforms: linux/amd64,linux/arm64
43+
push: false
44+
annotations: ${{ steps.metadata.outputs.annotations }}
45+
labels: ${{ steps.metadata.outputs.labels }}
46+
tags: ${{ steps.metadata.outputs.tags }}

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @Intellection/SRE

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Intellection
3+
Copyright (c) 2024 Zappi
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# docker-k8s-ttl-controller
2+
3+
[![release](https://github.com/Intellection/docker-k8s-ttl-controller/actions/workflows/release.yml/badge.svg)](https://github.com/Intellection/docker-k8s-ttl-controller/actions/workflows/release.yml) [![test](https://github.com/Intellection/docker-k8s-ttl-controller/actions/workflows/test.yml/badge.svg)](https://github.com/Intellection/docker-k8s-ttl-controller/actions/workflows/test.yml)
4+
5+
Docker image for [`TwiN/k8s-ttl-controller`](https://github.com/TwiN/k8s-ttl-controller), a Kubernetes controller that enables timed resource deletion using TTL annotation.
6+
7+
## Motivations
8+
9+
### How does this differ from upstream?
10+
11+
The current Docker image doesn't support ARM and we needed one that does. And [the review to add support](https://github.com/TwiN/k8s-ttl-controller/pull/95) took longer than we could wait.
12+
13+
## Usage
14+
15+
```
16+
docker run --name k8s-ttl-controller zappi/k8s-ttl-controller:latest
17+
```
18+
19+
For more detailed usage documentation [see upstream](https://github.com/TwiN/k8s-ttl-controller).

0 commit comments

Comments
 (0)