Skip to content

Commit 321d7b5

Browse files
committed
Switch Docker CI from gitlab to github
Adds buildx signing and helm chart publication. Signed-off-by: Eric Van Hensbergen <[email protected]>
1 parent 3b4636f commit 321d7b5

File tree

9 files changed

+157
-17
lines changed

9 files changed

+157
-17
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Docker Image BuildX CI and Publish
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
8+
on:
9+
schedule:
10+
- cron: '19 16 * * *'
11+
push:
12+
branches: [ "main" ]
13+
# Publish semver tags as releases.
14+
tags: [ 'v*.*.*' ]
15+
pull_request:
16+
branches: [ "main" ]
17+
workflow_dispatch:
18+
19+
env:
20+
# Use docker.io for Docker Hub if empty
21+
REGISTRY: ghcr.io
22+
# github.repository as <account>/<repo>
23+
IMAGE_NAME: ${{ github.repository }}
24+
25+
jobs:
26+
build:
27+
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
packages: write
32+
# This is used to complete the identity challenge
33+
# with sigstore/fulcio when running outside of PRs.
34+
id-token: write
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
40+
# Install the cosign tool except on PR
41+
# https://github.com/sigstore/cosign-installer
42+
- name: Install cosign
43+
if: github.event_name != 'pull_request'
44+
uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0
45+
with:
46+
cosign-release: 'v1.13.1'
47+
48+
-
49+
# Add support for more platforms with QEMU (optional)
50+
# https://github.com/docker/setup-qemu-action
51+
name: Set up QEMU
52+
uses: docker/setup-qemu-action@v2
53+
54+
# Login against a Docker registry except on PR
55+
# https://github.com/docker/login-action
56+
- name: Log into registry ${{ env.REGISTRY }}
57+
if: github.event_name != 'pull_request'
58+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
59+
with:
60+
registry: ${{ env.REGISTRY }}
61+
username: ${{ github.actor }}
62+
password: ${{ secrets.GITHUB_TOKEN }}
63+
# Extract metadata (tags, labels) for Docker
64+
# https://github.com/docker/metadata-action
65+
- name: Extract Docker metadata
66+
id: meta
67+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
68+
with:
69+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
70+
71+
# Workaround: https://github.com/docker/build-push-action/issues/461
72+
- name: Setup Docker buildx
73+
uses: docker/[email protected]
74+
with:
75+
platforms: linux/amd64,linux/arm64,linux/arm/v7
76+
# Build and push Docker image with Buildx (don't push on PR)
77+
# https://github.com/docker/build-push-action
78+
- name: Build and push Docker image
79+
id: build-and-push
80+
uses: docker/build-push-action@v3
81+
with:
82+
platforms: linux/amd64,linux/arm64,linux/arm/v7
83+
context: .
84+
push: ${{ github.event_name != 'pull_request' }}
85+
tags: ${{ steps.meta.outputs.tags }}
86+
labels: ${{ steps.meta.outputs.labels }}
87+
cache-from: type=gha
88+
cache-to: type=gha,mode=max
89+
#- name: Build
90+
# run: |
91+
# docker build --platform "linux/amd64,linux/arm64" --push . --file Dockerfile --tag ${{ steps.meta.outputs.tags }} --tag ${{ steps.meta.outputs.labels }} # will run buil
92+
93+
# Sign the resulting Docker image digest except on PRs.
94+
# This will only write to the public Rekor transparency log when the Docker
95+
# repository is public to avoid leaking data. If you would like to publish
96+
# transparency data even for private images, pass --force to cosign below.
97+
# https://github.com/sigstore/cosign
98+
- name: Sign the published Docker image
99+
if: ${{ github.event_name != 'pull_request' }}
100+
env:
101+
COSIGN_EXPERIMENTAL: "true"
102+
# This step uses the identity token to provision an ephemeral certificate
103+
# against the sigstore community Fulcio instance.
104+
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

.github/workflows/helm.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# release.yaml
2+
name: Release Charts
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Configure Git
19+
run: |
20+
git config user.name "$GITHUB_ACTOR"
21+
git config user.email "[email protected]"
22+
23+
# Optional step if GPG signing is used
24+
- name: Prepare GPG key
25+
run: |
26+
gpg_dir=.cr-gpg
27+
mkdir "$gpg_dir"
28+
keyring="$gpg_dir/secring.gpg"
29+
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"
30+
passphrase_file="$gpg_dir/passphrase"
31+
echo "$GPG_PASSPHRASE" > "$passphrase_file"
32+
echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
33+
echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV"
34+
echo "sign: true" > cr.yaml
35+
echo "key: Smarter Project" >> cr.yaml
36+
env:
37+
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}"
38+
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
39+
40+
- name: Run chart-releaser
41+
uses: helm/[email protected]
42+
with:
43+
config: cr.yaml
44+
env:
45+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
46+

.gitlab-ci.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.
File renamed without changes.
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
apiVersion: v2
22
name: smarter-device-manager
33
description: smarter-device-manager chart for SMARTER edge devices
4-
home: https://gitlab.com/smarter-project/smarter-device-manager/helm
5-
version: 0.0.3
4+
home: https://getsmarter.io
5+
version: 0.0.7
66
appVersion: v1.20.11
77
kubeVersion: ">=1.16.0-0"
88
keywords:
99
- kubernetes
1010
- device
1111
- hardware
1212
sources:
13-
- https://gitlab.com/smarter-project/smarter-device-manager
14-
#dependencies:
15-
# - name: smarter-common
16-
# repository: https://gitlab.com/smarter-project/documentation
17-
# version: 0.0.1
18-
13+
- https://github.com/smarter-project/smarter-device-manager
14+
icon: https://gitlab.com/uploads/-/system/group/avatar/59012546/ARM1636_Project_Logo_ST2_RGB_V1.png
1915
annotations:
2016
artifacthub.io/changes: |
2117
- Fix template
@@ -26,5 +22,5 @@ annotations:
2622
2723
artifacthub.io/prerelease: "false"
2824
artifacthub.io/signKey: |
29-
fingerprint: 82AD709FEC4ECA4C84B093889BDC9DE410CFC23B
30-
url: https://keybase.io/alexandref75/pgp_keys.asc
25+
fingerprint: 71EDA4E3D652DC73EB09E3A5387D298C169CF24E
26+
url: https://smarter-project.github.io/documentation/pgp_keys.asc
File renamed without changes.
File renamed without changes.

chart/values.yaml renamed to charts/smarter-device-manager/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ application:
44
appName: smarter-device-manager
55

66
image:
7-
repository: registry.gitlab.com/smarter-project/smarter-device-manager
7+
repository: ghcr.io/smarter-project/smarter-device-manager
88
# @default -- chart.appVersion
99
tag: ""
1010
pullPolicy: IfNotPresent

0 commit comments

Comments
 (0)