Skip to content

Commit

Permalink
adding a richer tag and breaking-change label for build action
Browse files Browse the repository at this point in the history
Signed-off-by: Javan lacerda <[email protected]>
  • Loading branch information
javanlacerda committed Oct 14, 2024
1 parent 3ecf1c3 commit d2c3a25
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
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

0 comments on commit d2c3a25

Please sign in to comment.