-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add circleci config Signed-off-by: Justin Kolberg <[email protected]> * trigger ci Signed-off-by: Justin Kolberg <[email protected]> * add job for rhel7 builder Signed-off-by: Justin Kolberg <[email protected]> * finalize Signed-off-by: Justin Kolberg <[email protected]> * update job names Signed-off-by: Justin Kolberg <[email protected]> * publish images to sensu/sensu-release Signed-off-by: Justin Kolberg <[email protected]>
- Loading branch information
1 parent
f9761be
commit 1a21afa
Showing
4 changed files
with
85 additions
and
101 deletions.
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,28 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
docker: circleci/[email protected] | ||
|
||
workflows: | ||
docker: | ||
jobs: | ||
- docker/publish: | ||
name: "linux-builder" | ||
image: sensu/sensu-release | ||
tag: ${CIRCLE_TAG:-$CIRCLE_SHA1}-linux-builder | ||
dockerfile: dockerfiles/linux-builder/Dockerfile | ||
- docker/publish: | ||
name: "rhel7-builder" | ||
image: sensu/sensu-release | ||
tag: ${CIRCLE_TAG:-$CIRCLE_SHA1}-redhat7-builder | ||
dockerfile: dockerfiles/rhel7-builder/Dockerfile | ||
- docker/publish: | ||
name: "rhel8-builder" | ||
image: sensu/sensu-release | ||
tag: ${CIRCLE_TAG:-$CIRCLE_SHA1}-redhat8-builder | ||
dockerfile: dockerfiles/rhel8-builder/Dockerfile | ||
- docker/publish: | ||
name: "packagecloud-pruner" | ||
image: sensu/sensu-release | ||
tag: ${CIRCLE_TAG:-$CIRCLE_SHA1}-packagecloud-pruner | ||
dockerfile: dockerfiles/packagecloud-pruner/Dockerfile |
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 |
---|---|---|
@@ -1,33 +1,28 @@ | ||
### Building & Publishing Dockerfiles | ||
|
||
#### Logging in to registry.redhat.io | ||
Docker images are automatically built and published for every commit. The images | ||
are tagged differently depending on whether or not it was built from a git | ||
commit or a git tag. | ||
|
||
**NOTE:** This may not be necessary. | ||
#### Git Commits | ||
|
||
1. Go to https://access.redhat.com/terms-based-registry/ and create an account. | ||
2. Login and create a service account. | ||
3. After receiving a token, run: | ||
A git commit with the sha `f412c9cd4181f2b25d4db946914c8096cb25ccbd`will | ||
generate the following Docker tags: | ||
|
||
``` shell | ||
docker login registry.redhat.io | ||
``` | ||
|
||
#### Building images for testing | ||
|
||
``` shell | ||
# use one of the directory names in the dockerfiles directory (e.g. linux-builder) | ||
export IMAGE_NAME="image_name" | ||
export DOCKERHUB_USERNAME="your_dockerhub_username_here" | ||
export TAG_NAME="${IMAGE_NAME}-${DOCKERHUB_USERNAME}" | ||
docker build . -f dockerfiles/linux-publisher/Dockerfile -t sensu/sensu-release:${TAG_NAME} | ||
docker push sensu/sensu-release:${TAG_NAME} | ||
sensu/sensu-release:f412c9cd4181f2b25d4db946914c8096cb25ccbd-linux-builder | ||
sensu/sensu-release:f412c9cd4181f2b25d4db946914c8096cb25ccbd-rhel7-builder | ||
sensu/sensu-release:f412c9cd4181f2b25d4db946914c8096cb25ccbd-rhel8-builder | ||
sensu/sensu-release:f412c9cd4181f2b25d4db946914c8096cb25ccbd-packagecloud-pruner | ||
``` | ||
|
||
#### Building images for release | ||
#### Git Tags | ||
|
||
``` shell | ||
# use one of the directory names in the dockerfiles directory (e.g. linux-builder) | ||
export IMAGE_NAME="image_name" | ||
docker build . -f dockerfiles/linux-publisher/Dockerfile -t sensu/sensu-release:${IMAGE_NAME} | ||
docker push sensu/sensu-release:${IMAGE_NAME} | ||
A git tag with the name `v1.2.3` will generate the following Docker tags: | ||
|
||
``` | ||
sensu/sensu-release:v1.2.3-linux-builder | ||
sensu/sensu-release:v1.2.3-rhel7-builder | ||
sensu/sensu-release:v1.2.3-rhel8-builder | ||
sensu/sensu-release:v1.2.3-packagecloud-pruner | ||
``` |
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 |
---|---|---|
@@ -1,6 +1,23 @@ | ||
FROM golang:1.13.15-alpine3.12 as golang | ||
FROM sensu/sensu-release@sha256:bcd0e081ae40111c305a8e401dbafac64abad40b52bbbfefe06d4f419ea8ccd9 as publishing-tools | ||
FROM alpine:3.12.0 | ||
ARG ALPINE_VERSION=3.12 | ||
ARG GO_VERSION=1.13.15 | ||
ARG GOMPLATE_VERSION=3.7.0 | ||
ARG GORELEASER_VERSION=0.141.0 | ||
ARG PYTHON_VERSION=3.8.5 | ||
ARG PACKAGECLOUDGO_VERSION=0.1.2 | ||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} as golang | ||
|
||
# Build circleci-logs | ||
COPY go.mod /tmp/sensu-release/ | ||
COPY go.sum /tmp/sensu-release/ | ||
ADD cmd /tmp/sensu-release/cmd | ||
RUN cd /tmp/sensu-release && go build ./cmd/circleci-logs | ||
|
||
FROM hairyhenderson/gomplate:v${GOMPLATE_VERSION}-alpine as gomplate | ||
FROM goreleaser/goreleaser:v${GORELEASER_VERSION} as goreleaser | ||
FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} as python | ||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} | ||
|
||
ARG PACKAGECLOUDGO_VERSION | ||
|
||
LABEL name="sensu/sensu-release" \ | ||
maintainer="[email protected]" | ||
|
@@ -23,7 +40,7 @@ RUN mkdir -p $TOOLS_PATH | |
|
||
# Install packages | ||
ENV BUILD_TIME_PKGS="tar gcc g++ py3-setuptools" | ||
ENV RUN_TIME_PKGS="cmake python3 openssh-client git make rpm dpkg dpkg-dev aws-cli bash sudo curl" | ||
ENV RUN_TIME_PKGS="cmake openssh-client git make rpm dpkg dpkg-dev aws-cli bash sudo curl" | ||
|
||
RUN apk add --no-cache $BUILD_TIME_PKGS $RUN_TIME_PKGS | ||
|
||
|
@@ -33,30 +50,30 @@ ENV PATH="/usr/local/go/bin:$PATH" | |
ENV GO111MODULE="on" | ||
ENV GOPROXY="https://proxy.golang.org" | ||
|
||
# Install python | ||
COPY --from=python /usr/local/bin/python /usr/local/bin/python | ||
COPY --from=python /usr/local/bin/python3 /usr/local/bin/python3 | ||
COPY --from=python /usr/local/bin/python3.8 /usr/local/bin/python3.8 | ||
COPY --from=python /usr/local/lib/python3.8 /usr/local/lib/python3.8 | ||
|
||
# Install publishing tools | ||
COPY ci-common-functions.sh $TOOLS_PATH | ||
COPY post-packages-s3.sh $TOOLS_PATH | ||
|
||
# Install circleci-logs | ||
COPY --from=golang /tmp/sensu-release/circleci-logs /usr/local/bin/ | ||
|
||
# Install goreleaser | ||
RUN curl -Lo /tmp/goreleaser.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v0.136.0/goreleaser_Linux_x86_64.tar.gz | ||
RUN tar -C /tmp -zxf /tmp/goreleaser.tar.gz | ||
RUN mv /tmp/goreleaser /usr/bin/ | ||
COPY --from=goreleaser /bin/goreleaser /usr/local/bin/goreleaser | ||
|
||
# Install gomplate | ||
RUN curl -Lo /usr/bin/gomplate https://github.com/hairyhenderson/gomplate/releases/download/v3.7.0/gomplate_linux-amd64-slim | ||
RUN chmod +x /usr/bin/gomplate | ||
COPY --from=gomplate /bin/gomplate /usr/local/bin/gomplate | ||
|
||
# Install the packagecloud-go cli tool | ||
RUN curl -Lo /tmp/packagecloud-go.tar.gz https://github.com/amdprophet/packagecloud-go/releases/download/0.1.2/packagecloud-go_0.1.2_linux_amd64.tar.gz | ||
RUN curl -Lo /tmp/packagecloud-go.tar.gz \ | ||
https://github.com/amdprophet/packagecloud-go/releases/download/${PACKAGECLOUDGO_VERSION}/packagecloud-go_${PACKAGECLOUDGO_VERSION}_linux_amd64.tar.gz | ||
RUN tar -C /tmp -zxf /tmp/packagecloud-go.tar.gz | ||
RUN mv /tmp/packagecloud /usr/bin/ | ||
|
||
# Symlink python to python3 | ||
RUN ln -s /usr/bin/python3 /usr/bin/python | ||
|
||
# Install publishing tools | ||
COPY --from=publishing-tools /usr/lib/python3.8 /usr/lib/python3.8 | ||
COPY --from=publishing-tools /usr/bin/python3.8 /usr/bin/python3.8 | ||
COPY --from=publishing-tools /usr/bin/python3 /usr/bin/python3 | ||
COPY --from=publishing-tools $TOOLS_PATH/ci-common-functions.sh $TOOLS_PATH/ci-common-functions.sh | ||
COPY --from=publishing-tools $TOOLS_PATH/circleci-logs $TOOLS_PATH/circleci-logs | ||
COPY --from=publishing-tools $TOOLS_PATH/post-packages-s3.sh $TOOLS_PATH/post-packages-s3.sh | ||
RUN mv /tmp/packagecloud /usr/local/bin/ | ||
|
||
# Cleanup | ||
RUN rm -rf /tmp/* | ||
|
This file was deleted.
Oops, something went wrong.