Skip to content

Commit

Permalink
Merge pull request #4 from mesosphere/kjoshi/d2iq-build-env-fixes
Browse files Browse the repository at this point in the history
fix: D2iQ Build Environment Fixes.
  • Loading branch information
kaiwalyajoshi authored Jan 9, 2024
2 parents 93bb5ad + ab89577 commit 9d707c8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Reference: https://help.github.com/en/articles/about-code-owners
# Order is important: later rules override preceding rules
* @mesosphere/kommander
21 changes: 17 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI

# on events
on:
workflow_dispatch:
push:
branches:
- master
Expand All @@ -16,7 +17,8 @@ on:
# jobs to run
jobs:
build:
runs-on: ubuntu-latest
runs-on:
- ubuntu-latest
steps:
- name: Set up Go 1.21
uses: actions/setup-go@v2
Expand All @@ -35,8 +37,9 @@ jobs:
run: make check
- name: unit tests
run: make test
- name: Codecov
uses: codecov/[email protected]
# This fails
# - name: Codecov
# uses: codecov/[email protected]
- name: Set env
run: |
echo "KUBERNETES_VERSION=v1.23.1" >> $GITHUB_ENV
Expand Down Expand Up @@ -67,10 +70,20 @@ jobs:
run: sudo make test-e2e
publish:
name: Publish docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
runs-on:
- ubuntu-latest
needs: build
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pushing docker images
run: sudo make push
- name: Uploading binary files
Expand Down
36 changes: 13 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ CRD_OPTIONS ?= "crd"
PROJECT_NAME=zookeeper-operator
EXPORTER_NAME=zookeeper-exporter
APP_NAME=zookeeper
RELEASE_REGISTRY ?= ghcr.io
REPO=mesosphere/$(PROJECT_NAME)
TEST_REPO=testzkop/$(PROJECT_NAME)
APP_REPO=pravega/$(APP_NAME)
ALTREPO=emccorp/$(PROJECT_NAME)
APP_ALTREPO=emccorp/$(APP_NAME)
APP_REPO=mesosphere/$(APP_NAME)
VERSION=$(shell git describe --always --tags --dirty | tr -d "v" | sed "s/\(.*\)-g`git rev-parse --short HEAD`/\1/")
GIT_SHA=$(shell git rev-parse --short HEAD)
TEST_IMAGE=$(TEST_REPO)-testimages:$(VERSION)
Expand Down Expand Up @@ -49,7 +48,6 @@ deploy: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image pravega/zookeeper-operator=$(TEST_IMAGE)
$(KUSTOMIZE) build config/default | kubectl apply -f -


# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy-test: manifests kustomize
cd config/test
Expand Down Expand Up @@ -107,7 +105,7 @@ generate:
echo '{{- end }}' >> charts/zookeeper-operator/templates/zookeeper.pravega.io_zookeeperclusters_crd.yaml


build: test build-go build-image
build: test build-go build-image build-zk-image

build-go:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
Expand All @@ -130,17 +128,17 @@ build-go:
-o bin/$(EXPORTER_NAME)-windows-amd64.exe cmd/exporter/main.go

build-image:
docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg DISTROLESS_DOCKER_REGISTRY=$(DISTROLESS_DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(REPO):$(VERSION) .
docker tag $(REPO):$(VERSION) $(REPO):latest
docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg DISTROLESS_DOCKER_REGISTRY=$(DISTROLESS_DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(RELEASE_REGISTRY)/$(REPO):$(VERSION) .
docker tag $(RELEASE_REGISTRY)/$(REPO):$(VERSION) $(RELEASE_REGISTRY)/$(REPO):latest

build-zk-image:

docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(APP_REPO):$(VERSION) ./docker
docker tag $(APP_REPO):$(VERSION) $(APP_REPO):latest
docker build --build-arg VERSION=$(VERSION) --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) -t $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION) ./docker
docker tag $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION) $(RELEASE_REGISTRY)/$(APP_REPO):latest

build-zk-image-swarm:
docker build --build-arg VERSION=$(VERSION)-swarm --build-arg DOCKER_REGISTRY=$(DOCKER_REGISTRY) --build-arg GIT_SHA=$(GIT_SHA) \
-f ./docker/Dockerfile-swarm -t $(APP_REPO):$(VERSION)-swarm ./docker
-f ./docker/Dockerfile-swarm -t $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION)-swarm ./docker

test:
go test $$(go list ./... | grep -v /vendor/ | grep -v /test/e2e) -race -coverprofile=coverage.txt -covermode=atomic
Expand Down Expand Up @@ -169,19 +167,11 @@ login:
test-login:
echo "$(DOCKER_TEST_PASS)" | docker login -u "$(DOCKER_TEST_USER)" --password-stdin

push: build-image build-zk-image login
docker push $(REPO):$(VERSION)
docker push $(REPO):latest
docker push $(APP_REPO):$(VERSION)
docker push $(APP_REPO):latest
docker tag $(REPO):$(VERSION) $(ALTREPO):$(VERSION)
docker tag $(REPO):$(VERSION) $(ALTREPO):latest
docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):$(VERSION)
docker tag $(APP_REPO):$(VERSION) $(APP_ALTREPO):latest
docker push $(ALTREPO):$(VERSION)
docker push $(ALTREPO):latest
docker push $(APP_ALTREPO):$(VERSION)
docker push $(APP_ALTREPO):latest
push: build-image build-zk-image
docker push $(RELEASE_REGISTRY)/$(REPO):$(VERSION)
docker push $(RELEASE_REGISTRY)/$(REPO):latest
docker push $(RELEASE_REGISTRY)/$(APP_REPO):$(VERSION)
docker push $(RELEASE_REGISTRY)/$(APP_REPO):latest

clean:
rm -f bin/$(PROJECT_NAME)
Expand Down

0 comments on commit 9d707c8

Please sign in to comment.