forked from sigstore/rekor
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: copy overlays from midstream-v1.2.2
Since we are foregoing the use of update-to-head.sh for this next release, these overlays only need to be applied once, when the branch is created. Signed-off-by: Lance Ball <[email protected]>
- Loading branch information
Showing
6 changed files
with
183 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
# Set version variables for LDFLAGS | ||
GIT_VERSION ?= $(shell git describe --tags --always --dirty) | ||
GIT_HASH ?= $(shell git rev-parse HEAD) | ||
DATE_FMT = +%Y-%m-%dT%H:%M:%SZ | ||
SOURCE_DATE_EPOCH ?= $(shell git log -1 --pretty=%ct) | ||
ifdef SOURCE_DATE_EPOCH | ||
BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null || date -u "$(DATE_FMT)") | ||
else | ||
BUILD_DATE ?= $(shell date "$(DATE_FMT)") | ||
endif | ||
GIT_TREESTATE = "clean" | ||
DIFF = $(shell git diff --quiet >/dev/null 2>&1; if [ $$? -eq 1 ]; then echo "1"; fi) | ||
ifeq ($(DIFF), 1) | ||
GIT_TREESTATE = "dirty" | ||
endif | ||
|
||
GHCR_PREFIX ?= ghcr.io/sigstore/rekor | ||
GOBIN ?= $(shell go env GOPATH)/bin | ||
|
||
|
||
REKOR_LDFLAGS=-X sigs.k8s.io/release-utils/version.gitVersion=$(GIT_VERSION) \ | ||
-X sigs.k8s.io/release-utils/version.gitCommit=$(GIT_HASH) \ | ||
-X sigs.k8s.io/release-utils/version.gitTreeState=$(GIT_TREESTATE) \ | ||
-X sigs.k8s.io/release-utils/version.buildDate=$(BUILD_DATE) | ||
|
||
CLI_LDFLAGS=$(REKOR_LDFLAGS) | ||
SERVER_LDFLAGS=$(REKOR_LDFLAGS) | ||
|
||
.PHONY: | ||
cross-platform: rekor-cli-darwin-arm64 rekor-cli-darwin-amd64 rekor-cli-linux-amd64 rekor-cli-linux-arm64 rekor-cli-linux-ppc64le rekor-cli-linux-s390x rekor-cli-windows ## Build all distributable (cross-platform) binaries | ||
|
||
.PHONY: rekor-cli-darwin-arm64 | ||
rekor-cli-darwin-arm64: $(SRCS)## Build for mac M1 | ||
env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -v -o rekor_cli_darwin_arm64 -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli | ||
|
||
.PHONY: rekor-cli-darwin-amd64 | ||
rekor-cli-darwin-amd64: $(SRCS)## Build for Darwin (macOS) | ||
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o rekor_cli_darwin_amd64 -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli | ||
|
||
.PHONY: rekor-cli-linux-amd64 | ||
rekor-cli-linux-amd64: $(SRCS)## Build for Linux amd64 | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o rekor_cli_linux_amd64 -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli | ||
|
||
.PHONY: rekor-cli-linux-arm64 | ||
rekor-cli-linux-arm64: $(SRCS) ## Build for Linux arm64 | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o rekor_cli_linux_arm64 -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli | ||
|
||
.PHONY: rekor-cli-linux-ppc64le | ||
rekor-cli-linux-ppc64le: $(SRCS)## Build for Linux ppc64le | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -o rekor_cli_linux_ppc64le -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli | ||
|
||
.PHONY: rekor-cli-linux-s390x | ||
rekor-cli-linux-s390x: $(SRCS) ## Build for Linux s390x | ||
env CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build -o rekor_cli_linux_s390x -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli | ||
|
||
.PHONY: rekor-cli-windows | ||
rekor-cli-windows: $(SRCS) ## Build for Windows | ||
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o rekor_cli_windows_amd64.exe -trimpath -ldflags "$(CLI_LDFLAGS) -w -s" ./cmd/rekor-cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#Build stage | ||
FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca AS build-env | ||
USER root | ||
RUN git config --global --add safe.directory /opt/app-root/src | ||
COPY . . | ||
RUN make backfill-redis | ||
|
||
#Install stage | ||
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:7d1ea7ac0c6f464dac7bae6994f1658172bf6068229f40778a513bc90f47e624 | ||
COPY --from=build-env /opt/app-root/src/backfill-redis /usr/local/bin/backfill-redis | ||
WORKDIR /opt/app-root/src/home | ||
|
||
LABEL description="Backfillredis is a job that will go through the TLog and make sure that missing entries are added to the search index." | ||
LABEL io.k8s.description="Backfillredis is a job that will go through the TLog and make sure that missing entries are added to the search index." | ||
LABEL io.k8s.display-name="Backfillredis container image for Red Hat Trusted Signer" | ||
LABEL io.openshift.tags="backfill-redis trusted-signer" | ||
LABEL summary="Provides the backfill-redis binary for a rekor server" | ||
LABEL com.redhat.component="backfill-redis" | ||
|
||
#ENTRYPOINT | ||
ENTRYPOINT [ "backfill-redis" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#Build stage | ||
FROM registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca AS build-env | ||
USER root | ||
RUN git config --global --add safe.directory /opt/app-root/src | ||
COPY . . | ||
|
||
RUN git stash && \ | ||
export GIT_VERSION=$(git describe --tags --always --dirty) && \ | ||
git stash pop && \ | ||
make Makefile.swagger && \ | ||
make -f Build.mak rekor-cli-darwin-amd64 && \ | ||
make -f Build.mak rekor-cli-linux-amd64 && \ | ||
make -f Build.mak rekor-cli-windows && \ | ||
gzip rekor_cli_darwin_amd64 && \ | ||
gzip rekor_cli_linux_amd64 && \ | ||
gzip rekor_cli_windows_amd64.exe | ||
|
||
#Install stage | ||
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:7d1ea7ac0c6f464dac7bae6994f1658172bf6068229f40778a513bc90f47e624 | ||
|
||
LABEL description="Rekor-cli is a command line interface (CLI) tool used to interact with a rekor server." | ||
LABEL io.k8s.description="Rekor-cli is a command line interface (CLI) tool used to interact with a rekor server." | ||
LABEL io.k8s.display-name="Rekor-cli container image for Red Hat Trusted Signer" | ||
LABEL io.openshift.tags="rekor-cli trusted-signer" | ||
LABEL summary="Provides the rekor CLI binary for interacting with a rekor server" | ||
LABEL com.redhat.component="rekor-cli" | ||
|
||
COPY --from=build-env /opt/app-root/src/rekor_cli_darwin_amd64.gz /usr/local/bin/rekor_cli_darwin_amd64.gz | ||
COPY --from=build-env /opt/app-root/src/rekor_cli_linux_amd64.gz /usr/local/bin/rekor_cli_linux_amd64.gz | ||
COPY --from=build-env /opt/app-root/src/rekor_cli_windows_amd64.exe.gz /usr/local/bin/rekor_cli_windows_amd64.exe.gz | ||
WORKDIR /opt/app-root/src/home | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ import ( | |
"strconv" | ||
"strings" | ||
"testing" | ||
"os/exec" | ||
|
||
"github.com/sigstore/rekor/pkg/sharding" | ||
|
||
|
@@ -226,8 +227,24 @@ func TestSearchNoEntriesRC1(t *testing.T) { | |
util.RunCliErr(t, "search", "--email", "[email protected]") | ||
} | ||
func TestHostnameInSTH(t *testing.T) { | ||
// get ID of container | ||
rekorContainerID := strings.Trim(util.Run(t, "", "docker", "ps", "-q", "-f", "name=rekor-server"), "\n") | ||
var rekorContainerID string | ||
|
||
// Check if Docker is running | ||
cmd := exec.Command("docker", "info") | ||
err := cmd.Run() | ||
|
||
if err != nil { | ||
cmd := exec.Command("uname", "-n") | ||
output, err := cmd.Output() | ||
if err != nil { | ||
t.Fatalf("Failed to get hostname: %v", err) | ||
} | ||
rekorContainerID = strings.Trim(string(output), "\n") | ||
} else { | ||
// If Docker is running, get the container ID of rekor-server | ||
rekorContainerID = strings.Trim(util.Run(t, "", "docker", "ps", "-q", "-f", "name=rekor-server"), "\n") | ||
} | ||
|
||
resp, err := http.Get(fmt.Sprintf("%s/api/v1/log", rekorServer())) | ||
if err != nil { | ||
t.Fatal(err) | ||
|
@@ -380,4 +397,4 @@ func TestHTTPMaxRequestBodySize(t *testing.T) { | |
if resp.StatusCode != http.StatusRequestEntityTooLarge { | ||
t.Fatalf("expected status %d, got %d instead", http.StatusRequestEntityTooLarge, resp.StatusCode) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters