Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build-container action #2247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
permissions:
id-token: write
contents: read
pull-requests: read

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
Expand All @@ -58,8 +59,23 @@ jobs:

- name: creds
run: gcloud auth configure-docker --quiet

- name: Formatted labels
id: labels
env:
GH_TOKEN: ${{ github.token }}
run: |
FORMATED_LABELS="--image-label commit-hash=$GITHUB_SHA"
BRANCH_NUMBER=$(gh pr list --state all --search "sha:$GITHUB_SHA" --label "breaking-change" | awk '{print $1}')

echo "Branch Number: $BRANCH_NUMBER"
# Check if a pull request number was found
if [ -n "$BRANCH_NUMBER" ]; then
FORMATED_LABELS+=" --image-label breaking-change=true"
fi
echo "FORMATED_LABELS='$FORMATED_LABELS'" >> $GITHUB_OUTPUT

- name: container
run: KO_PREFIX=gcr.io/projectsigstore/rekor/ci/rekor make sign-keyless-ci
run: KO_PREFIX=gcr.io/projectsigstore/rekor/ci/rekor FORMATED_LABEL=${{ steps.labels.outputs.FORMATED_LABELS }} make sign-keyless-ci
env:
COSIGN_YES: true
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ REKOR_LDFLAGS=-X sigs.k8s.io/release-utils/version.gitVersion=$(GIT_VERSION) \
CLI_LDFLAGS=$(REKOR_LDFLAGS)
SERVER_LDFLAGS=$(REKOR_LDFLAGS)

# It should be blank for default builds
FORMATED_LABEL ?=

GITHUB_RUN_NUMBER ?= "local"

FULL_TAG := "0.$(shell date +%Y%m%d).$(GITHUB_RUN_NUMBER)-ref.$(GIT_VERSION)"

Makefile.swagger: $(SWAGGER) $(OPENAPIDEPS)
$(SWAGGER) validate openapi.yaml
$(SWAGGER) generate client -f openapi.yaml -q -r COPYRIGHT.txt -t pkg/generated --additional-initialism=TUF --additional-initialism=DSSE
Expand Down Expand Up @@ -110,8 +117,8 @@ debug:
ko:
# rekor-server
LDFLAGS="$(SERVER_LDFLAGS)" GIT_HASH=$(GIT_HASH) GIT_VERSION=$(GIT_VERSION) \
KO_DOCKER_REPO=$(KO_PREFIX)/rekor-server ko resolve --bare \
--platform=all --tags $(GIT_VERSION) --tags $(GIT_HASH) \
KO_DOCKER_REPO=$(KO_PREFIX)/rekor-server ko resolve $(FORMATED_LABEL) --bare \
--platform=all --tags $(GIT_VERSION) --tags $(GIT_HASH) --tags $(FULL_TAG) \
--image-refs rekorServerImagerefs --filename config/ > $(REKOR_YAML)

# rekor-cli
Expand Down
Loading