Skip to content

Commit 5345096

Browse files
authored
Merge pull request #51 from sp-yduck/docker-publish
Docker publish
2 parents ec02d57 + 6e75c73 commit 5345096

File tree

3 files changed

+95
-3
lines changed

3 files changed

+95
-3
lines changed

.github/workflows/docker-publish.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Docker
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+
push:
10+
# Publish semver tags as releases.
11+
tags: [ 'v*.*.*' ]
12+
13+
env:
14+
# Use docker.io for Docker Hub if empty
15+
REGISTRY: ghcr.io
16+
# github.repository as <account>/<repo>
17+
IMAGE_NAME: ${{ github.repository }}
18+
19+
20+
jobs:
21+
build:
22+
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
# This is used to complete the identity challenge
28+
# with sigstore/fulcio when running outside of PRs.
29+
id-token: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v3
34+
35+
# Install the cosign tool except on PR
36+
# https://github.com/sigstore/cosign-installer
37+
- name: Install cosign
38+
if: github.event_name != 'pull_request'
39+
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
40+
with:
41+
cosign-release: 'v2.1.1'
42+
43+
# Workaround: https://github.com/docker/build-push-action/issues/461
44+
- name: Setup Docker buildx
45+
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
46+
47+
# Login against a Docker registry except on PR
48+
# https://github.com/docker/login-action
49+
- name: Log into registry ${{ env.REGISTRY }}
50+
if: github.event_name != 'pull_request'
51+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
52+
with:
53+
registry: ${{ env.REGISTRY }}
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
57+
# Extract metadata (tags, labels) for Docker
58+
# https://github.com/docker/metadata-action
59+
- name: Extract Docker metadata
60+
id: meta
61+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
62+
with:
63+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64+
65+
# Build and push Docker image with Buildx (don't push on PR)
66+
# https://github.com/docker/build-push-action
67+
- name: Build and push Docker image
68+
id: build-and-push
69+
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
70+
with:
71+
context: .
72+
push: ${{ github.event_name != 'pull_request' }}
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}
75+
cache-from: type=gha
76+
cache-to: type=gha,mode=max
77+
78+
79+
# Sign the resulting Docker image digest except on PRs.
80+
# This will only write to the public Rekor transparency log when the Docker
81+
# repository is public to avoid leaking data. If you would like to publish
82+
# transparency data even for private images, pass --force to cosign below.
83+
# https://github.com/sigstore/cosign
84+
- name: Sign the published Docker image
85+
if: ${{ github.event_name != 'pull_request' }}
86+
env:
87+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
88+
TAGS: ${{ steps.meta.outputs.tags }}
89+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
90+
# This step uses the identity token to provision an ephemeral certificate
91+
# against the sigstore community Fulcio instance.
92+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ for more information : https://cluster-api.sigs.k8s.io/user/quick-start.html#ini
1717
```sh
1818
# install cluster-api components
1919
export EXP_CLUSTER_RESOURCE_SET=true
20-
clusterctl init --infrastructure=proxmox:v0.2.2 --config https://raw.githubusercontent.com/sp-yduck/cluster-api-provider-proxmox/main/clusterctl.yaml
20+
clusterctl init --infrastructure=proxmox:v0.2.3 --config https://raw.githubusercontent.com/sp-yduck/cluster-api-provider-proxmox/main/clusterctl.yaml
2121
```
2222
**Note:** container images are available at [here](https://hub.docker.com/r/spyduck/cluster-api-provider-proxmox/tags)
2323

@@ -35,7 +35,7 @@ export NODE_USER=node-ssh-user
3535
export NODE_PASSWORD=node-ssh-password
3636

3737
# generate manifests (available flags: --target-namespace, --kubernetes-version, --control-plane-machine-count, --worker-machine-count)
38-
clusterctl generate cluster cappx-test --control-plane-machine-count=3 --infrastructure=proxmox:v0.2.2 --config https://raw.githubusercontent.com/sp-yduck/cluster-api-provider-proxmox/main/clusterctl.yaml > cappx-test.yaml
38+
clusterctl generate cluster cappx-test --control-plane-machine-count=3 --infrastructure=proxmox:v0.2.3 --config https://raw.githubusercontent.com/sp-yduck/cluster-api-provider-proxmox/main/clusterctl.yaml > cappx-test.yaml
3939

4040
# inspect and edit
4141
vi cappx-test.yaml

config/default/manager_config_patch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ spec:
88
spec:
99
containers:
1010
- name: manager
11-
image: docker.io/spyduck/cluster-api-provider-proxmox:v0.2.2
11+
image: ghcr.io/sp-yduck/cluster-api-provider-proxmox:v0.2.3

0 commit comments

Comments
 (0)