Skip to content

Commit

Permalink
Prepare to onboard to prow (#107)
Browse files Browse the repository at this point in the history
* Onboard to prow

* Remove ppc64le and s390x Dockerfiles

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* fix args

* update Makefile

* Update Makefile.prow

* Update Makefile.prow

* Update Makefile

* Update Configfile

* Go 1.16

* bin directory
  • Loading branch information
jlpadilla authored Mar 12, 2021
1 parent 8c200f1 commit ac430ee
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ os:

language: go
go:
- 1.15.x
- 1.16.x

services:
- docker
Expand Down
37 changes: 37 additions & 0 deletions DCO
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.2
# Copyright Contributors to the Open Cluster Management project

FROM registry.ci.openshift.org/open-cluster-management/builder:go1.16-linux-amd64 AS builder

WORKDIR /go/src/github.com/open-cluster-management/search-collector
COPY . .
RUN CGO_ENABLED=0 GOGC=25 go build -trimpath -o main main.go

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

ARG VCS_REF
ARG VCS_URL
Expand Down Expand Up @@ -36,11 +44,11 @@ RUN microdnf update &&\
mkdir /licenses &&\
microdnf clean all

COPY --from=builder /go/src/github.com/open-cluster-management/search-collector/main /bin/main

ENV VCS_REF="$VCS_REF" \
USER_UID=1001 \
GOGC=50

ADD output/search-collector /bin
GOGC=25

USER ${USER_UID}
ENTRYPOINT ["bin/search-collector"]
ENTRYPOINT ["/bin/main"]
28 changes: 19 additions & 9 deletions Dockerfile.ppc64le → Dockerfile.prow
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
FROM registry.access.redhat.com/ubi7/ubi-minimal:7.7-238
# Copyright Contributors to the Open Cluster Management project

FROM registry.ci.openshift.org/open-cluster-management/builder:go1.16-linux-amd64 AS builder

WORKDIR /go/src/github.com/open-cluster-management/search-collector
COPY . .
RUN CGO_ENABLED=0 GOGC=25 go build -trimpath -o main main.go

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3

ARG VCS_REF
ARG VCS_URL
Expand All @@ -13,12 +21,12 @@ ARG IMAGE_RELEASE
ARG IMAGE_SUMMARY
ARG IMAGE_OPENSHIFT_TAGS

LABEL org.label-schema.vendor="$IMAGE_VENDOR" \
LABEL org.label-schema.vendor="Red Hat" \
org.label-schema.name="$IMAGE_NAME_ARCH" \
org.label-schema.description="$IMAGE_DESCRIPTION" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.license="Licensed Materials - Property of IBM" \
org.label-schema.license="Red Hat Advanced Cluster Management for Kubernetes EULA" \
org.label-schema.schema-version="1.0" \
name="$IMAGE_NAME" \
maintainer="$IMAGE_MAINTAINER" \
Expand All @@ -31,14 +39,16 @@ LABEL org.label-schema.vendor="$IMAGE_VENDOR" \
io.k8s.description="$IMAGE_DESCRIPTION" \
io.openshift.tags="$IMAGE_OPENSHIFT_TAGS"

RUN microdnf install ca-certificates vi --nodocs &&\
RUN microdnf update &&\
microdnf install ca-certificates vi --nodocs &&\
mkdir /licenses &&\
microdnf clean all

COPY license.txt /licenses/

ENV VCS_REF="$VCS_REF"
COPY --from=builder /go/src/github.com/open-cluster-management/search-collector/main /bin/main

ADD output/search-collector /bin
ENV VCS_REF="$VCS_REF" \
USER_UID=1001 \
GOGC=25

ENTRYPOINT ["bin/search-collector"]
USER ${USER_UID}
ENTRYPOINT ["/bin/main"]
44 changes: 0 additions & 44 deletions Dockerfile.s390x

This file was deleted.

13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ default::
deps:
go mod tidy

.PHONY: search-collector
search-collector:
CGO_ENABLED=0 GOGC=25 go build -a -v -i -installsuffix cgo -ldflags '-s -w' -o $(BINDIR)/search-collector ./

.PHONY: build
build: search-collector
build:
CGO_ENABLED=0 GOGC=25 go build -o $(BINDIR)/search-collector ./

.PHONY: build-linux
build-linux:
make search-collector GOOS=linux
make build GOOS=linux

.PHONY: lint
lint:
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.27.0
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.38.0
# Flag GOGC=25 needed to run garbage collection more often and avoid out of memory issue.
GOGC=50 golangci-lint run --timeout=3m
GOGC=25 golangci-lint run --timeout=3m

run:
GOGC=25 go run main.go
Expand Down
7 changes: 7 additions & 0 deletions Makefile.prow
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright Contributors to the Open Cluster Management project

-include /opt/build-harness/Makefile.prow

.PHONY: build
build:
CGO_ENABLED=0 GOGC=25 go build -o $(BINDIR)/search-collector ./
2 changes: 1 addition & 1 deletion build/Configfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif


IMAGE_NAME =$(shell cat COMPONENT_NAME)
IMAGE_DISPLAY_NAME =Search Colector
IMAGE_DISPLAY_NAME =Search Collector
ARCH = $(shell uname -m)
ifeq ($(ARCH), x86_64)
IMAGE_NAME_ARCH =$(IMAGE_NAME)-amd64
Expand Down
14 changes: 11 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@

module github.com/open-cluster-management/search-collector

go 1.15
go 1.16

require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
github.com/golang/protobuf v1.4.2
github.com/google/go-cmp v0.5.4 // indirect
github.com/kennygrant/sanitize v1.2.4
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
github.com/onsi/gomega v1.10.4 // indirect
github.com/open-cluster-management/governance-policy-propagator v0.0.0-20200602150427-d0f4af8aba9d
github.com/open-cluster-management/multicloud-operators-channel v1.0.1-0.20200930214554-fa55cf642642
github.com/open-cluster-management/multicloud-operators-deployable v0.0.0-20200925154205-fc4ec3e30a4d
Expand All @@ -18,9 +23,12 @@ require (
github.com/open-cluster-management/multicloud-operators-subscription v1.0.0-2020-05-12-21-17-19.0.20201009005738-cbe273a045ab
github.com/open-cluster-management/multicloud-operators-subscription-release v1.0.1-2020-06-08-14-28-27.0.20200819124024-818f01d780ff //Use 2.0 when available
github.com/openshift/api v3.9.1-0.20190924102528-32369d4db2ad+incompatible
github.com/stretchr/testify v1.6.0
github.com/stretchr/testify v1.7.0
github.com/tkanos/gonfig v0.0.0-20181112185242-896f3d81fadf
gopkg.in/yaml.v2 v2.3.0
golang.org/x/mod v0.4.0 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.4.0
honnef.co/go/tools v0.1.2 // indirect
k8s.io/api v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/client-go v13.0.0+incompatible
Expand Down
Loading

0 comments on commit ac430ee

Please sign in to comment.