Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit b07b5ce

Browse files
author
Paulo Gomes
authored
Merge pull request #29 from pjbgf/set-new-tag
Set new semver format based for release tags
2 parents 842e24f + 76c0e68 commit b07b5ce

File tree

6 files changed

+100
-42
lines changed

6 files changed

+100
-42
lines changed

Diff for: .github/workflows/build.yaml

+90-28
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: macos-11
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v3
2626
- name: Test build script for darwin-amd64 - libgit2-all
2727
run: |
2828
make dev-test
@@ -46,20 +46,20 @@ jobs:
4646
- 5000:5000
4747
steps:
4848
- name: Checkout
49-
uses: actions/checkout@v2
49+
uses: actions/checkout@v3
5050
- name: Unshallow
5151
run: git fetch --prune --unshallow
5252
- name: Setup Cosign
5353
uses: sigstore/cosign-installer@main
5454
- name: Set up QEMU
5555
id: qemu
56-
uses: docker/setup-qemu-action@v1
56+
uses: docker/setup-qemu-action@v2
5757
with:
5858
image: tonistiigi/binfmt:latest
5959
platforms: ${{ env.PLATFORMS }}
6060
- name: Set up Docker Buildx
6161
id: buildx
62-
uses: docker/setup-buildx-action@v1
62+
uses: docker/setup-buildx-action@v2
6363
with:
6464
config-inline: |
6565
[worker.oci]
@@ -73,7 +73,7 @@ jobs:
7373
echo "Flags: ${{ steps.buildx.outputs.flags }}"
7474
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
7575
- name: Cache Docker layers
76-
uses: actions/cache@v2
76+
uses: actions/cache@v3
7777
id: cache
7878
with:
7979
path: /tmp/.buildx-cache
@@ -83,7 +83,7 @@ jobs:
8383
- run: cat ./hack/static.sh
8484
- name: Build candidate image - libgit2 compiled with libssh2 and openssl
8585
id: build_candidate_libgit2_all
86-
uses: docker/build-push-action@v2
86+
uses: docker/build-push-action@v3
8787
with:
8888
context: .
8989
file: Dockerfile
@@ -92,26 +92,13 @@ jobs:
9292
tags: localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
9393
cache-from: type=local,src=/tmp/.buildx-cache
9494
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
95-
- name: Build candidate image - libgit2 only
96-
id: build_candidate_libgti2_only
97-
uses: docker/build-push-action@v2
98-
with:
99-
context: .
100-
file: Dockerfile.libgit2-only
101-
platforms: ${{ env.PLATFORMS }}
102-
push: true
103-
tags: localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
104-
cache-from: type=local,src=/tmp/.buildx-cache
105-
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
10695
- name: Inspect candidate images
10796
run: |
10897
docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all:latest
109-
docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
11098
- name: Test candidate images
11199
id: test_candidate
112100
run: |
113101
IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-all make test
114-
IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only LIBGIT2_ONLY=true make test
115102
- # Temp fix
116103
# https://github.com/docker/build-push-action/issues/252
117104
# https://github.com/moby/buildkit/issues/1896
@@ -121,7 +108,7 @@ jobs:
121108
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
122109
- name: Login to GHCR
123110
if: github.event_name != 'pull_request'
124-
uses: docker/login-action@v1
111+
uses: docker/login-action@v2
125112
with:
126113
registry: ghcr.io
127114
username: ${{ github.repository_owner }}
@@ -134,15 +121,13 @@ jobs:
134121
images: |
135122
ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-all
136123
tags: |
137-
type=schedule
138-
type=ref,event=branch
139-
type=ref,event=tag
124+
type=semver,pattern=v{{version}}
140125
type=sha
141126
type=sha,format=long
142127
- name: Release candidate image - golang-with-libgit2-all
143128
id: release_candidate_libgit2_all
144129
if: github.event_name != 'pull_request'
145-
uses: docker/build-push-action@v2
130+
uses: docker/build-push-action@v3
146131
with:
147132
context: .
148133
file: Dockerfile
@@ -162,6 +147,85 @@ jobs:
162147
cosign sign $image
163148
done
164149
150+
build-libgit2-only:
151+
runs-on: ubuntu-latest
152+
env:
153+
PLATFORMS: linux/amd64,linux/arm/v7,linux/arm64
154+
services:
155+
registry:
156+
image: registry:2
157+
ports:
158+
- 5000:5000
159+
steps:
160+
- name: Checkout
161+
uses: actions/checkout@v3
162+
- name: Unshallow
163+
run: git fetch --prune --unshallow
164+
- name: Setup Cosign
165+
uses: sigstore/cosign-installer@main
166+
- name: Set up QEMU
167+
id: qemu
168+
uses: docker/setup-qemu-action@v2
169+
with:
170+
image: tonistiigi/binfmt:latest
171+
platforms: ${{ env.PLATFORMS }}
172+
- name: Set up Docker Buildx
173+
id: buildx
174+
uses: docker/setup-buildx-action@v2
175+
with:
176+
config-inline: |
177+
[worker.oci]
178+
max-parallelism = 4
179+
driver-opts: network=host
180+
- name: Inspect builder
181+
run: |
182+
echo "Name: ${{ steps.buildx.outputs.name }}"
183+
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
184+
echo "Status: ${{ steps.buildx.outputs.status }}"
185+
echo "Flags: ${{ steps.buildx.outputs.flags }}"
186+
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
187+
- name: Cache Docker layers
188+
uses: actions/cache@v3
189+
id: cache
190+
with:
191+
path: /tmp/.buildx-cache
192+
key: ${{ runner.os }}-buildx-ghcache-${{ github.sha }}
193+
restore-keys: |
194+
${{ runner.os }}-buildx-ghcache-
195+
- run: cat ./hack/static.sh
196+
- name: Build candidate image - libgit2 only
197+
id: build_candidate_libgti2_only
198+
uses: docker/build-push-action@v3
199+
with:
200+
context: .
201+
file: Dockerfile.libgit2-only
202+
platforms: ${{ env.PLATFORMS }}
203+
push: true
204+
tags: localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
205+
cache-from: type=local,src=/tmp/.buildx-cache
206+
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
207+
- name: Inspect candidate images
208+
run: |
209+
docker buildx imagetools inspect localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only:latest
210+
- name: Test candidate images
211+
id: test_candidate
212+
run: |
213+
IMG=localhost:5000/${{ github.repository_owner }}/golang-with-libgit2-only LIBGIT2_ONLY=true make test
214+
- # Temp fix
215+
# https://github.com/docker/build-push-action/issues/252
216+
# https://github.com/moby/buildkit/issues/1896
217+
name: Move cache
218+
run: |
219+
rm -rf /tmp/.buildx-cache
220+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
221+
- name: Login to GHCR
222+
if: github.event_name != 'pull_request'
223+
uses: docker/login-action@v2
224+
with:
225+
registry: ghcr.io
226+
username: ${{ github.repository_owner }}
227+
password: ${{ secrets.GITHUB_TOKEN }}
228+
165229
- name: Compose release candidate metadata - golang-with-libgit2-only
166230
id: meta_libgit2_only
167231
uses: docker/metadata-action@v3
@@ -170,15 +234,13 @@ jobs:
170234
images: |
171235
ghcr.io/${{ github.repository_owner }}/golang-with-libgit2-only
172236
tags: |
173-
type=schedule
174-
type=ref,event=branch
175-
type=ref,event=tag
237+
type=semver,pattern=v{{version}}
176238
type=sha
177239
type=sha,format=long
178240
- name: Release candidate image - golang-with-libgit2-only
179241
id: release_candidate_libgit2_only
180242
if: github.event_name != 'pull_request'
181-
uses: docker/build-push-action@v2
243+
uses: docker/build-push-action@v3
182244
with:
183245
context: .
184246
file: Dockerfile.libgit2-only

Diff for: .github/workflows/release.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v2
26+
uses: actions/checkout@v3
2727
- name: Build static libraries - libgit2 compiled with libssh2 and openssl
2828
run: |
2929
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-linux \
@@ -71,7 +71,7 @@ jobs:
7171
runs-on: macos-11
7272
steps:
7373
- name: Checkout
74-
uses: actions/checkout@v2
74+
uses: actions/checkout@v3
7575
- name: Build universal static libraries for Darwin - libgit2 compiled with libssh2 and openssl
7676
run: |
7777
TARGET_DIR=${GITHUB_WORKSPACE}/build/libgit2-darwin-amd64 \
@@ -151,12 +151,12 @@ jobs:
151151
needs: [linux-amd64-release, darwin-release]
152152
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
153153
steps:
154-
- uses: actions/checkout@v2
154+
- uses: actions/checkout@v3
155155
with:
156156
fetch-depth: 0
157-
- uses: actions/setup-go@v2
157+
- uses: actions/setup-go@v3
158158
with:
159-
go-version: 1.17.x
159+
go-version: 1.18.x
160160
- name: Setup Cosign
161161
uses: sigstore/cosign-installer@main
162162
- name: Setup Syft

Diff for: Dockerfile.libgit2-only

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Dockerfile builds and packages libgit2 only (not linked with openssl and libssh2)
22

33
ARG BASE_VARIANT=alpine
4-
ARG GO_VERSION=1.17
4+
ARG GO_VERSION=1.18
55
ARG XX_VERSION=1.1.0
66

77
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx

Diff for: Dockerfile.test-libgit2-only

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This Dockerfile builds and packages libgit2 only (not linked with openssl and libssh2); and tests it against git2go.
22

33
ARG BASE_VARIANT=alpine
4-
ARG GO_VERSION=1.17
4+
ARG GO_VERSION=1.18
55
ARG XX_VERSION=1.1.0
66

77
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx

Diff for: README.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,9 @@ FROM go-${BASE_VARIANT} AS build-dependencies-awesome-os
9494
### Releasing a new image
9595

9696
For the `main` branch, images are pushed automatically to a tag matching the branch name, and a tag in the format of
97-
`sha-<Git sha>`. In addition, images are created for new tags, with as preferred format: `libgit2-<libgit2 SemVer>`.
97+
`sha-<Git sha>`. In addition, images are created for new tags, with as preferred format: `v<SemVer>`.
9898

99-
For example, `libgit2-1.1.1` for an image with **libgit2 1.1.1** included.
100-
101-
In case changes happen to the `Dockerfile` while the `libgit2` version does not change, sequential tags should
102-
be suffixed with `-<seq num in range>`. For example, `libgit2-1.1.1-2` for the **third** container image
103-
with the same version.
99+
For example, `v0.1.0`.
104100

105101
### Debugging cross-compilation
106102

Diff for: tests/smoketest/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/fluxcd/golang-with-libgit2/tests/sample
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/fluxcd/pkg/gittestserver v0.5.2

0 commit comments

Comments
 (0)