Skip to content

Commit

Permalink
🌱 cleanup: build (#3280)
Browse files Browse the repository at this point in the history
* remove *_bare.sh scripts

Signed-off-by: Per Goncalves da Silva <[email protected]>

* remove *_local.sh scripts and related targets

Signed-off-by: Per Goncalves da Silva <[email protected]>

* remove wait and related targets and hang Dockerfile

Signed-off-by: Per Goncalves da Silva <[email protected]>

* remove unnecessary makefile targets

Signed-off-by: Per Goncalves da Silva <[email protected]>

* add golangci-lint to tools

Signed-off-by: Per Goncalves da Silva <[email protected]>

* refactor Makefile

Refactor Makefile
clean up build targets

Signed-off-by: Per Goncalves da Silva <[email protected]>

* bump gha golangci-lint version

Signed-off-by: Per Goncalves da Silva <[email protected]>

---------

Signed-off-by: Per Goncalves da Silva <[email protected]>
Co-authored-by: Per Goncalves da Silva <[email protected]>
  • Loading branch information
perdasilva and Per Goncalves da Silva authored May 27, 2024
1 parent 2334c05 commit c1b059a
Show file tree
Hide file tree
Showing 1,857 changed files with 307,950 additions and 972 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/sanity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
- name: Run linting checks
uses: "golangci/golangci-lint-action@v6"
with:
version: "v1.55.2"
version: "v1.58.2"
skip-pkg-cache: true

19 changes: 12 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
run:
timeout: 8m
skip-dirs:
- pkg/lib
- pkg/api
- pkg/fakes
- pkg/package-server/apis
- test/e2e

linters:
enable:
Expand All @@ -21,6 +15,11 @@ linters:
- errcheck

linters-settings:
# This stanza is needed to avoid getting the warning
# WARN [config_reader] The configuration option `linters.errcheck.ignore` is deprecated, please use `linters.errcheck.exclude-functions`.
errcheck:
ignore: ''

importas:
alias:
- pkg: k8s.io/api/core/v1
Expand All @@ -41,7 +40,13 @@ linters-settings:
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs:
- pkg/lib
- pkg/api
- pkg/fakes
- pkg/package-server/apis
- test/e2e

output:
format: tab
formats: tab
sort-results: true
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,31 @@ builds:
dockers:
- image_templates:
- "{{ .Env.IMAGE_REPO }}:{{ .Tag }}-amd64"
dockerfile: Dockerfile.goreleaser
dockerfile: Dockerfile
use: buildx
goos: linux
goarch: amd64
build_flag_templates:
- --platform=linux/amd64
- image_templates:
- "{{ .Env.IMAGE_REPO }}:{{ .Tag }}-arm64"
dockerfile: Dockerfile.goreleaser
dockerfile: Dockerfile
use: buildx
goos: linux
goarch: arm64
build_flag_templates:
- --platform=linux/arm64
- image_templates:
- "{{ .Env.IMAGE_REPO }}:{{ .Tag }}-ppc64le"
dockerfile: Dockerfile.goreleaser
dockerfile: Dockerfile
use: buildx
goos: linux
goarch: ppc64le
build_flag_templates:
- --platform=linux/ppc64le
- image_templates:
- "{{ .Env.IMAGE_REPO }}:{{ .Tag }}-s390x"
dockerfile: Dockerfile.goreleaser
dockerfile: Dockerfile
use: buildx
goos: linux
goarch: s390x
Expand Down
41 changes: 8 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
FROM quay.io/fedora/fedora:37-x86_64 as builder
LABEL stage=builder
WORKDIR /build

# install dependencies and go 1.22

# copy just enough of the git repo to parse HEAD, used to record version in OLM binaries
RUN dnf update -y && dnf install -y bash make git mercurial jq wget && dnf upgrade -y
RUN curl -sSL https://go.dev/dl/go1.22.2.linux-amd64.tar.gz | tar -xzf - -C /usr/local
ENV PATH=/usr/local/go/bin:$PATH
COPY .git/HEAD .git/HEAD
COPY .git/refs/heads/. .git/refs/heads
RUN mkdir -p .git/objects
COPY Makefile Makefile
COPY OLM_VERSION OLM_VERSION
COPY pkg pkg
COPY vendor vendor
COPY go.mod go.mod
COPY go.sum go.sum
COPY cmd cmd
COPY util util
COPY test test
RUN CGO_ENABLED=0 make build
RUN make build-util

# use debug tag to keep a shell around for backwards compatibility with the previous alpine image
FROM gcr.io/distroless/static:debug
LABEL stage=olm
WORKDIR /
# bundle unpack Jobs require cp at /bin/cp
RUN ["/busybox/ln", "-s", "/busybox/cp", "/bin/cp"]
COPY --from=builder /build/bin/olm /bin/olm
COPY --from=builder /build/bin/catalog /bin/catalog
COPY --from=builder /build/bin/package-server /bin/package-server
COPY --from=builder /build/bin/cpb /bin/cpb
COPY --from=builder /build/bin/copy-content /bin/copy-content
USER 1001
# copy goreleaser built binaries
COPY olm /bin/olm
COPY catalog /bin/catalog
COPY package-server /bin/package-server
COPY copy-content /bin/copy-content
COPY cpb /bin/cpb
EXPOSE 8080
EXPOSE 5443
CMD ["/bin/olm"]
USER 1001
ENTRYPOINT ["/bin/olm"]
Loading

0 comments on commit c1b059a

Please sign in to comment.