Skip to content

Commit 07f0ac4

Browse files
authored
add container builds for each push to main (sigstore#1269)
* add container builds for each push to main Signed-off-by: Bob Callaway <bcallaway@google.com> * fix LDFLAGS Signed-off-by: Bob Callaway <bcallaway@google.com> --------- Signed-off-by: Bob Callaway <bcallaway@google.com>
1 parent dcfd044 commit 07f0ac4

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.github/workflows/container-build.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#
2+
# Copyright 2023 The Sigstore Authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: CI-Container-Build
17+
18+
on:
19+
workflow_dispatch:
20+
push:
21+
branches:
22+
- main
23+
24+
jobs:
25+
build:
26+
name: build
27+
runs-on: ubuntu-latest
28+
29+
permissions:
30+
id-token: write
31+
contents: read
32+
33+
steps:
34+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
35+
- uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # v3.1.1
36+
37+
- name: Extract version of Go to use
38+
run: echo "GOVERSION=$(cat Dockerfile|grep golang | awk ' { print $2 } ' | cut -d '@' -f 1 | cut -d ':' -f 2 | uniq)" >> $GITHUB_ENV
39+
40+
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
41+
with:
42+
go-version: ${{ env.GOVERSION }}
43+
44+
- name: deps
45+
run: sudo apt-get update && sudo apt-get install -yq libpcsclite-dev
46+
47+
- uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
48+
49+
- name: Set up Cloud SDK
50+
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1
51+
with:
52+
workload_identity_provider: 'projects/498091336538/locations/global/workloadIdentityPools/githubactions/providers/sigstore-fulcio'
53+
service_account: 'github-actions-fulcio@projectsigstore.iam.gserviceaccount.com'
54+
55+
- name: creds
56+
run: gcloud auth configure-docker --quiet
57+
58+
- name: container
59+
run: KO_PREFIX=gcr.io/projectsigstore/fulcio/ci/fulcio make sign-keyless-ci

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ $(PROTOC-API-LINTER): $(TOOLS_DIR)/go.mod
118118
## Images with ko
119119
## --------------------------------------
120120

121+
.PHONY: ko
122+
ko:
123+
# fulcio
124+
LDFLAGS="$(LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
125+
KO_DOCKER_REPO=$(KO_PREFIX)/fulcio ko resolve --bare \
126+
--platform=linux/amd64 --tags $(GIT_VERSION) --tags $(GIT_HASH) \
127+
--image-refs fulcioImagerefs --filename config/ > $(FULCIO_YAML)
128+
121129
.PHONY: ko-local
122130
ko-local:
123131
LDFLAGS="$(LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
@@ -137,6 +145,10 @@ ko-apply-ci: ko-apply
137145
ko-publish:
138146
LDFLAGS="$(LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) ko publish .
139147

148+
.PHONY: sign-keyless-ci
149+
sign-keyless-ci: ko
150+
cosign sign --yes -a GIT_HASH=$(GIT_HASH) $(KO_DOCKER_REPO)/fulcio:$(GIT_HASH)
151+
140152
## --------------------------------------
141153
## Modules
142154
## --------------------------------------

0 commit comments

Comments
 (0)