Skip to content

Commit

Permalink
Update release scripts (#24)
Browse files Browse the repository at this point in the history
Signed-off-by: Gao Hongtao <hanahmily@gmail.com>
  • Loading branch information
hanahmily authored Jan 20, 2021
1 parent 6a3ef52 commit 74f6b6b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,12 @@ update-templates: $(GO_BINDATA)
release-operator: generate
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o build/bin/manager-linux-amd64 cmd/manager/manager.go

release-adapter: generate
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o build/bin/adapter-linux-amd64 cmd/adapter/adapter.go

RELEASE_SCRIPTS := ./build/package/release.sh

release-binary: release-operator
release-binary: release-operator release-adapter
${RELEASE_SCRIPTS} -b

release-source:
Expand Down
6 changes: 3 additions & 3 deletions build/images/Dockerfile.adapter
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o adapter
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /tmp
COPY --from=builder --chown=nonroot:nonroot /workspace/adapter /bin/adapter-amd64
WORKDIR /
COPY --from=builder --chown=nonroot:nonroot /workspace/adapter .
USER nonroot:nonroot

ENTRYPOINT ["/bin/adapter-amd64"]
ENTRYPOINT ["/adapter"]
1 change: 1 addition & 0 deletions build/images/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ RUN set -eux; \
FROM gcr.io/distroless/static:nonroot
WORKDIR /tmp
COPY --from=builder --chown=nonroot:nonroot /swck/bin/manager-linux-amd64 /manager
COPY --from=builder --chown=nonroot:nonroot /swck/bin/adapter-linux-amd64 /adapter
USER nonroot:nonroot

ENTRYPOINT ["/manager"]
9 changes: 6 additions & 3 deletions build/package/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ binary(){
cp -Rfv ${ROOTDIR}/README.md ${bindir}
cp -Rfv ${ROOTDIR}/dist/* ${bindir}
# Generates CRDs and deployment manifests
kustomize build config/crd > ${bindir}/config/crds.yaml
pushd ${ROOTDIR}/config/manager
pushd ${ROOTDIR}/config/operator/manager
kustomize edit set image controller=apache/skywalking-swck:${RELEASE_TAG}
popd
kustomize build config/default > ${bindir}/config/deploy.yaml
kustomize build config/operator/default > ${bindir}/config/operator-bundle.yaml
pushd ${ROOTDIR}/config/adapter/namespaced/adapter
kustomize edit set image metrics-adapter=apache/skywalking-swck:${RELEASE_TAG}
popd
kustomize build config/adapter > ${bindir}/config/adapter-bundle.yaml
# Package
tar -czf ${BUILDDIR}/release/skywalking-swck-${RELEASE_TAG}-bin.tgz -C ${bindir} .
rm -rf ${bindir}
Expand Down
2 changes: 1 addition & 1 deletion config/adapter/namespaced/adapter/adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- name: adapter
image: metrics-adapter:latest
imagePullPolicy: IfNotPresent
command: ["/bin/adapter-amd64"]
command: ["/adapter"]
args:
- --secure-port=6443
- --logtostderr=true
Expand Down

0 comments on commit 74f6b6b

Please sign in to comment.