Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit d4dbddc

Browse files
committed
WIP: Update wercker to use Makefile for image build
Signed-off-by: Kashif Saadat <[email protected]>
1 parent 0510134 commit d4dbddc

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

Makefile

+9-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ endif
2323

2424
PKG := github.com/oracle/mysql-operator
2525
REGISTRY := iad.ocir.io
26+
IMAGE_PREFIX ?= $(REGISTRY)/$(TENANT)
2627
SRC_DIRS := cmd pkg test/examples
2728
CMD_DIRECTORIES := $(sort $(dir $(wildcard ./cmd/*/)))
2829
COMMANDS := $(CMD_DIRECTORIES:./cmd/%/=%)
@@ -71,13 +72,18 @@ build: dist build-dirs Makefile
7172
cp $(BINARIES) ./bin/$(OS)_$(ARCH)/
7273

7374
.PHONY: build-docker
74-
build-docker:
75+
build-docker: build-docker-mysql-operator build-docker-mysql-agent
76+
77+
.PHONY: build-docker-mysql-operator
78+
build-docker-mysql-operator:
7579
@docker build \
7680
--build-arg=http_proxy \
7781
--build-arg=https_proxy \
78-
-t $(REGISTRY)/$(TENANT)/mysql-operator:$(VERSION) \
82+
-t $(IMAGE_PREFIX)/mysql-operator:$(VERSION) \
7983
-f docker/mysql-operator/Dockerfile .
8084

85+
.PHONY: build-docker-mysql-agent
86+
build-docker-mysql-agent:
8187
# Retrieve the UID for the mysql user, passed in when building the mysql-agent image
8288
$(eval MYSQL_AGENT_IMAGE := $(shell sed -n 's/^FROM \(.*\)/\1/p' docker/mysql-agent/Dockerfile))
8389
$(eval MYSQL_UID=$(shell docker run --rm --entrypoint id ${MYSQL_AGENT_IMAGE} -u mysql))
@@ -86,7 +92,7 @@ build-docker:
8692
--build-arg=http_proxy \
8793
--build-arg=https_proxy \
8894
--build-arg=MYSQL_USER=${MYSQL_UID} \
89-
-t $(REGISTRY)/$(TENANT)/mysql-agent:$(VERSION) \
95+
-t $(IMAGE_PREFIX)/mysql-agent:$(VERSION) \
9096
-f docker/mysql-agent/Dockerfile .
9197

9298
# Note: Only used for development, i.e. in CI the images are pushed using Wercker.

wercker.yml

+26-28
Original file line numberDiff line numberDiff line change
@@ -36,105 +36,103 @@ build:
3636
cp -R mysql-operator ${WERCKER_OUTPUT_DIR}/
3737
cp -R .git ${WERCKER_OUTPUT_DIR}/
3838
39-
push-operator-image:
40-
box:
41-
id: oraclelinux:7.3
39+
build-image:
40+
base-path: "/go/src/github.com/oracle/mysql-operator"
4241
steps:
4342
- script:
4443
name: set environment variables
4544
code: |
45+
export IMAGE_PREFIX=wercker-build
4646
export VERSION=$(cat dist/version.txt)
47-
echo "Pushing operator version ${VERSION}"
47+
echo "Building mysql operator & agent images with version: ${VERSION}"
48+
49+
- script:
50+
name: build mysql-operator image
51+
code: make build-docker-mysql-operator
4852

4953
- script:
50-
name: prepare
54+
name: build mysql-agent image
55+
code: make build-docker-mysql-agent
56+
57+
push-operator-image:
58+
steps:
59+
- script:
60+
name: set environment variables
5161
code: |
52-
mv bin/mysql-operator /mysql-operator
53-
chmod +x /mysql-operator
62+
export IMAGE_PREFIX=wercker-build
63+
export VERSION=$(cat dist/version.txt)
5464
5565
- internal/docker-push:
66+
image-name: ${IMAGE_PREFIX}/mysql-operator:${VERSION}
5667
registry: https://iad.ocir.io/v2
5768
repository: iad.ocir.io/oracle/mysql-operator
5869
tag: $VERSION
59-
entrypoint: /mysql-operator
6070
username: $OCIRUSERNAME
6171
password: $OCIRPASSWORD
6272

6373
- internal/docker-push:
74+
image-name: ${IMAGE_PREFIX}/mysql-operator:${VERSION}
6475
registry: https://lhr.ocir.io/v2
6576
repository: lhr.ocir.io/oracle/mysql-operator
6677
tag: $VERSION
67-
entrypoint: /mysql-operator
6878
username: $OCIRUSERNAME
6979
password: $OCIRPASSWORD
7080

7181
- internal/docker-push:
82+
image-name: ${IMAGE_PREFIX}/mysql-operator:${VERSION}
7283
registry: https://phx.ocir.io/v2
7384
repository: phx.ocir.io/oracle/mysql-operator
7485
tag: $VERSION
75-
entrypoint: /mysql-operator
7686
username: $OCIRUSERNAME
7787
password: $OCIRPASSWORD
7888

7989
- internal/docker-push:
90+
image-name: ${IMAGE_PREFIX}/mysql-operator:${VERSION}
8091
registry: https://fra.ocir.io/v2
8192
repository: fra.ocir.io/oracle/mysql-operator
8293
tag: $VERSION
83-
entrypoint: /mysql-operator
8494
username: $OCIRUSERNAME
8595
password: $OCIRPASSWORD
8696

8797
push-agent-image:
88-
box:
89-
id: mysql/mysql-server:8.0.11
9098
steps:
9199
- script:
92100
name: set environment variables
93101
code: |
102+
export IMAGE_PREFIX=wercker-build
94103
export VERSION=$(cat dist/version.txt)
95-
echo "Pushing agent version ${VERSION}"
96-
97-
- script:
98-
name: prepare
99-
code: |
100-
mv bin/mysql-agent /mysql-agent
101-
chmod +x /mysql-agent
102104
103105
- internal/docker-push:
106+
image-name: ${IMAGE_PREFIX}/mysql-agent:${VERSION}
104107
registry: https://iad.ocir.io/v2
105108
username: $OCIRUSERNAME
106109
password: $OCIRPASSWORD
107110
repository: iad.ocir.io/oracle/mysql-agent
108111
tag: $VERSION
109-
entrypoint: /mysql-agent
110-
user: mysql
111112

112113
- internal/docker-push:
114+
image-name: ${IMAGE_PREFIX}/mysql-agent:${VERSION}
113115
registry: https://lhr.ocir.io/v2
114116
username: $OCIRUSERNAME
115117
password: $OCIRPASSWORD
116118
repository: lhr.ocir.io/oracle/mysql-agent
117119
tag: $VERSION
118-
entrypoint: /mysql-agent
119-
user: mysql
120120

121121
- internal/docker-push:
122+
image-name: ${IMAGE_PREFIX}/mysql-agent:${VERSION}
122123
registry: https://phx.ocir.io/v2
123124
username: $OCIRUSERNAME
124125
password: $OCIRPASSWORD
125126
repository: phx.ocir.io/oracle/mysql-agent
126127
tag: $VERSION
127-
entrypoint: /mysql-agent
128-
user: mysql
129128

130129
- internal/docker-push:
130+
image-name: ${IMAGE_PREFIX}/mysql-agent:${VERSION}
131131
registry: https://fra.ocir.io/v2
132132
username: $OCIRUSERNAME
133133
password: $OCIRPASSWORD
134134
repository: fra.ocir.io/oracle/mysql-agent
135135
tag: $VERSION
136-
entrypoint: /mysql-agent
137-
user: mysql
138136

139137
e2e-test:
140138
base-path: "/go/src/github.com/oracle/mysql-operator"

0 commit comments

Comments
 (0)