forked from sigstore/rekor
-
Notifications
You must be signed in to change notification settings - Fork 6
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
chore: copy overlays from midstream-v1.2.2 #162
Merged
Gregory-Pereira
merged 1 commit into
securesign:redhat-v1.3
from
lance:add-redhat-build
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JasonPowr can you please confirm these changes as applied to the upstream v1.3.3 tag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep these changes still seem fine, these just relate to the rekor e2e tests, which are not running atm.