Skip to content

Commit 6179602

Browse files
committedJan 22, 2020
chore(release): add a travis.yml to build and release opm
1 parent d8e2ec5 commit 6179602

10 files changed

+88
-32
lines changed
 

‎.travis.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
language: go
2+
go:
3+
- 1.13
4+
sudo: true
5+
6+
os:
7+
- linux
8+
- osx
9+
- windows
10+
11+
install:
12+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install make; fi
13+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install make; fi
14+
15+
script:
16+
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then mingw32-make build; fi
17+
- if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then make unit build; fi
18+
19+
notifications:
20+
email: false
21+
22+
deploy:
23+
provider: releases
24+
api_key:
25+
secure: CMJ3KGhwuB7YRCYsJMe0cWAY/gkj2BVGorW9G1awxOyR2+Dv9G5PhItVkVfti0P2LzX8K2rplDp4O8b976wWzWJlJ6MQsSkFId0wYJSXRwNGdqnGhTLdDXB4FmPKapTBqTaYQgumrfvSOMiZ3tAwCD9AjW2fqYnBWnJXJ3yv8cpmN+TOZLJAKG+wAqb2foD9mS3HEQ9ItcoBqqEg8eRedzLuLGKVROLdFweLpi9gWdC22xLNomySwITTXX4kVs35MS0iwZE2cpTNDR8tLLIirHNgkiCCVYdiY0AB77Ikp5AF458UA064yr1b8TjAC3oyi4h6ddFaXo6CT9PZmsc41Te7cguSm2J9Ok2OdxLGitce7oty38QeY0QaG0oolcbXYw6QeiUXJ3BScAzVQBveDYgIACkSlsXAFEgdmR9YLOjYcw1MmquhmDbEuvaHi5T85aqsL8v5PUTMZq9+X/wOTqzR6D+8nQGqvqodxnopAFKpiR7UyiCl16VqrTJnkpWnYEerlx1i3Y7JLEiEK9O8UKL13J65cumCHPbcPNXbIsV6cFM+WXV8XhzKNOenrI5LZS9ske73wN9mOlgJKPwzEzP1H5hw1DTgm7gH/T+0bPCUdg7vh+dGavunjHEth1HmD2F8p6dvMC7+JG7Fjyw2PU76yl9DDm611p69A5auQ14=
26+
file: bin/$TRAVIS_OS_NAME/opm
27+
skip_cleanup: true
28+
on:
29+
repo: operator-framework/operator-registry
30+
tags: true

‎Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ FROM openshift/origin-base
2828
RUN mkdir /registry
2929
WORKDIR /registry
3030

31-
COPY --from=builder /src/bin/initializer /bin/initializer
32-
COPY --from=builder /src/bin/registry-server /bin/registry-server
33-
COPY --from=builder /src/bin/configmap-server /bin/configmap-server
34-
COPY --from=builder /src/bin/appregistry-server /bin/appregistry-server
35-
COPY --from=builder /src/bin/opm /bin/opm
31+
COPY --from=builder /src/bin/linux/initializer /bin/initializer
32+
COPY --from=builder /src/bin/linux/registry-server /bin/registry-server
33+
COPY --from=builder /src/bin/linux/configmap-server /bin/configmap-server
34+
COPY --from=builder /src/bin/linux/appregistry-server /bin/appregistry-server
35+
COPY --from=builder /src/bin/linux/opm /bin/opm
3636
COPY --from=builder /go/bin/grpc-health-probe /bin/grpc_health_probe
3737

3838
RUN chgrp -R 0 /registry && \
@@ -46,5 +46,5 @@ USER 1001
4646
EXPOSE 50051
4747

4848
LABEL io.k8s.display-name="OpenShift Operator Registry" \
49-
io.k8s.description="This is a component of OpenShift Operator Lifecycle Manager and is the base for operator catalog API containers." \
50-
maintainer="Odin Team <aos-odin@redhat.com>"
49+
io.k8s.description="This is a component of OpenShift Operator Lifecycle Manager and is the base for operator catalog API containers." \
50+
maintainer="Odin Team <aos-odin@redhat.com>"

‎Makefile

+5-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
2-
MOD_FLAGS := $(shell (go version | grep -q -E "1\.(11|12)") && echo -mod=vendor)
3-
CMDS := $(addprefix bin/, $(shell ls ./cmd))
1+
GOOS := $(shell go env GOOS)
2+
OS := $(shell bash -c 'if [[ $(GOOS) == darwin ]]; then echo osx; else echo $(GOOS); fi')
3+
CMDS := $(addprefix bin/$(OS)/, $(shell ls ./cmd))
44
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
5+
MOD_FLAGS := $(shell bash -c 'if [[ "$(shell go env GOFLAGS)" == "-mod=vendor" ]]; then echo ""; else echo "-mod=vendor"; fi')
56

67
.PHONY: build test vendor clean
78

8-
all: clean install-go-bindata test build
9+
all: clean test build
910

1011
$(CMDS):
1112
go build $(MOD_FLAGS) $(extra_flags) -o $@ ./cmd/$(shell basename $@)
@@ -27,12 +28,6 @@ image-upstream:
2728
vendor:
2829
go mod vendor
2930

30-
install-go-bindata:
31-
go get -u github.com/go-bindata/go-bindata/...
32-
33-
generate-migration-bundle:
34-
go-bindata -pkg sqlite -o ./pkg/sqlite/migrations.go ./pkg/sqlite/db_migrations/
35-
3631
codegen:
3732
protoc -I pkg/api/ --go_out=plugins=grpc:pkg/api pkg/api/*.proto
3833
protoc -I pkg/api/grpc_health_v1 --go_out=plugins=grpc:pkg/api/grpc_health_v1 pkg/api/grpc_health_v1/*.proto

‎appr-registry.Dockerfile

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
FROM golang:1.10-alpine as builder
1+
FROM golang:1.13-alpine as builder
22

3-
RUN apk update && apk add sqlite build-base git mercurial
3+
RUN apk update && apk add sqlite build-base git mercurial bash
44
WORKDIR /go/src/github.com/operator-framework/operator-registry
55

66
COPY vendor vendor
77
COPY cmd cmd
88
COPY pkg pkg
99
COPY Makefile Makefile
10+
COPY go.mod go.mod
1011
RUN make static
1112

12-
FROM golang:1.10-alpine as probe-builder
13+
FROM golang:1.13-alpine as probe-builder
1314

1415
RUN apk update && apk add build-base git
1516
ENV ORG github.com/grpc-ecosystem
@@ -19,10 +20,12 @@ WORKDIR /go/src/$PROJECT
1920
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/vendor/$ORG/grpc-health-probe .
2021
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/vendor .
2122
RUN CGO_ENABLED=0 go install -a -tags netgo -ldflags "-w"
23+
RUN ls /go/bin
24+
RUN ls .
2225

2326

2427
FROM scratch
25-
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/bin/appregistry-server /bin/appregistry-server
26-
COPY --from=probe-builder /go/bin/grpc_health_probe /bin/grpc_health_probe
28+
COPY --from=builder /go/src/github.com/operator-framework/operator-registry/bin/linux/appregistry-server /bin/appregistry-server
29+
COPY --from=probe-builder /go/bin/grpc-health-probe /bin/grpc_health_probe
2730
EXPOSE 50051
2831
ENTRYPOINT ["/bin/appregistry-server"]

‎configmap-registry.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ FROM quay.io/operator-framework/upstream-registry-builder:latest as builder
22
FROM busybox as userspace
33

44
FROM scratch
5-
COPY --from=builder /build/bin/configmap-server /bin/configmap-server
6-
COPY --from=builder /build/bin/opm /bin/opm
5+
COPY --from=builder /build/bin/linux/configmap-server /bin/configmap-server
6+
COPY --from=builder /build/bin/linux/opm /bin/opm
77
COPY --from=userspace /bin/cp /bin/cp
88
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
99
EXPOSE 50051

‎docs/contributors/releases.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Releases
2+
3+
## opm
4+
5+
Releases of opm are built by travis, see the [travis.yml](../../.travis.yml) for details.
6+
7+
## Triggering a release
8+
9+
Releases are triggered via tags. Make a new release by tagging a commit with an appropriate semver tag.
10+
11+
## Checking the build
12+
13+
Builds for a release can be found [on travis](https://travis-ci.com/operator-framework/operator-registry). After triggering a build, watch for logs. If the build is successful, a new [release](https://github.com/operator-framework/operator-registry) should appear in GitHub.
14+
15+
## Docker images
16+
17+
Builds are also triggered for the following docker images. The tags in Quay.io will match the git tag:
18+
19+
- [quay.io/operator-framework/operator-registry-server](https://quay.io/repository/operator-framework/operator-registry-server)
20+
- [quay.io/operator-framework/configmap-operator-registry](https://quay.io/repository/operator-framework/configmap-operator-registry)
21+
- [quay.io/operator-framework/upstream-registry-builder](https://quay.io/repository/operator-framework/upstream-registry-builder?tab=tags)
22+
23+
Images are also built to track master with `latest` tags. It is recommended that you always pull by digest, and only use images that are tagged with a version.

‎opm-example.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM quay.io/operator-framework/upstream-registry-builder AS builder
33
FROM scratch
44
LABEL operators.operatorframework.io.index.database.v1=./index.db
55
COPY database ./
6-
COPY --from=builder /build/bin/opm /opm
6+
COPY --from=builder /build/bin/linux/opm /opm
77
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
88
EXPOSE 50051
99
ENTRYPOINT ["/opm"]

‎registry.Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM golang:1.12-alpine as builder
1+
FROM golang:1.13-alpine as builder
22

3-
RUN apk update && apk add sqlite build-base git mercurial
3+
RUN apk update && apk add sqlite build-base git mercurial bash
44
WORKDIR /build
55

66
COPY vendor vendor
@@ -14,7 +14,7 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
1414
chmod +x /bin/grpc_health_probe
1515

1616
FROM scratch
17-
COPY --from=builder /build/bin/registry-server /registry-server
17+
COPY --from=builder /build/bin/linux/registry-server /registry-server
1818
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
1919
EXPOSE 50051
2020
ENTRYPOINT ["/registry-server"]

‎upstream-builder.Dockerfile

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM golang:1.12-alpine
1+
FROM golang:1.13-alpine
22

3-
RUN apk update && apk add sqlite build-base git mercurial
3+
RUN apk update && apk add sqlite build-base git mercurial bash
44
WORKDIR /build
55

66
COPY vendor vendor
@@ -12,3 +12,8 @@ RUN make static
1212
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
1313
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
1414
chmod +x /bin/grpc_health_probe
15+
RUN cp /build/bin/linux/opm /bin/opm && \
16+
cp /build/bin/linux/initializer /bin/initializer && \
17+
cp /build/bin/linux/appregistry-server /bin/appregistry-server && \
18+
cp /build/bin/linux/configmap-server /bin/configmap-server && \
19+
cp /build/bin/linux/registry-server /bin/registry-server

‎upstream-example.Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM quay.io/operator-framework/upstream-registry-builder as builder
22

33
COPY manifests manifests
4-
RUN ./bin/initializer -o ./bundles.db
4+
RUN /bin/initializer -o ./bundles.db
55

66
FROM scratch
77
COPY --from=builder /build/bundles.db /bundles.db
8-
COPY --from=builder /build/bin/registry-server /registry-server
8+
COPY --from=builder /bin/registry-server /registry-server
99
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
1010
EXPOSE 50051
1111
ENTRYPOINT ["/registry-server"]

0 commit comments

Comments
 (0)
Please sign in to comment.