Browse Source

Add image build jobs

The images built from ViNO code are not currently stored in a public
registry, this change adds Zuul jobs to push the controller and
nodelabeler images to Quay.io where they can be consumed by the
community.

Signed-off-by: Alexander Hughes <Alexander.Hughes@pm.me>
Change-Id: I19d7b9954a20af07cb6ffd1f1e8f17f3ed6e754c
changes/59/770459/11
Alexander Hughes 2 years ago
parent
commit
00125cbdef
  1. 4
      Dockerfile
  2. 24
      Makefile
  3. 2
      README.md
  4. 2
      nodelabeler/Dockerfile
  5. 16
      playbooks/airship-vino-build-images.yaml
  6. 16
      playbooks/airship-vino-publish-images.yaml
  7. 2
      playbooks/test-vino.yaml
  8. 43
      roles/vino-build-images/tasks/main.yaml
  9. 61
      roles/vino-publish-images/tasks/main.yaml
  10. 2
      tools/deployment/deploy-vino.sh
  11. 37
      zuul.d/jobs.yaml
  12. 24
      zuul.d/projects.yaml
  13. 37
      zuul.d/secrets.yaml

4
Dockerfile

@ -13,8 +13,8 @@ RUN go mod download
# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY api api/
COPY controllers controllers/
# Build

24
Makefile

@ -1,6 +1,7 @@
# Image URL to use all building/pushing image targets
# IMG ?= controller:latest
IMG ?= quay.io/airshipit/vino
CONTROLLER_IMG ?= quay.io/airshipit/vino
NODE_LABELER_IMG ?= quay.io/airshipit/nodelabeler
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
@ -64,14 +65,23 @@ vet:
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
# Build the docker image
# Build the controller docker image
# If DOCKER_PROXY_FLAGS values are empty, we are fine with that
docker-build:
docker build ${DOCKER_PROXY_FLAGS} . -t ${IMG}
docker-build-controller:
docker build ${DOCKER_PROXY_FLAGS} . -t ${CONTROLLER_IMG}
# Push the docker image
docker-push:
docker push ${IMG}
# Build the nodelabeler docker image
# If DOCKER_PROXY_FLAGS values are empty, we are fine with that
docker-build-nodelabeler:
docker build -f nodelabeler/Dockerfile . ${DOCKER_PROXY_FLAGS} -t ${NODE_LABELER_IMG}
# Push the controller docker image
docker-push-controller:
docker push ${CONTROLLER_IMG}
# Push the node_labeler docker image
docker-push-node-labeler:
docker push ${NODE_LABELER_IMG}
# find or download controller-gen
# download controller-gen if necessary

2
README.md

@ -91,7 +91,7 @@ Once your cluster is up and running, you'll need to build the ViNO image to use,
operator on your cluster:
```
# make docker-build
# make docker-build-controller
# make deploy
```

2
nodelabeler/Dockerfile

@ -1,4 +1,4 @@
# Default base images for builder and release images, can be overriden during build
# Default base images for builder and release images, can be overridden during build
ARG BUILDER_IMAGE=gcr.io/gcp-runtimes/go1-builder:1.13
ARG RELEASE_IMAGE=scratch

16
playbooks/airship-vino-build-images.yaml

@ -0,0 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- hosts: all
become: yes
roles:
- vino-build-images

16
playbooks/airship-vino-publish-images.yaml

@ -0,0 +1,16 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- hosts: all
become: yes
roles:
- vino-publish-images

2
playbooks/test-vino.yaml

@ -66,4 +66,4 @@
- name: Build Docker image
make:
chdir: "{{ zuul.project.src_dir }}"
target: docker-build
target: docker-build-controller

43
roles/vino-build-images/tasks/main.yaml

@ -0,0 +1,43 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Run ensure-docker
include_role:
name: ensure-docker
- name: Buid vino controller image
make:
chdir: "{{ zuul.project.src_dir }}"
target: docker-build-controller
params:
PROXY: "{{ proxy.http }}"
NO_PROXY: "{{ proxy.noproxy }}"
USE_PROXY: "{{ proxy.enabled | lower }}"
- name: Verify controller image exists
shell: docker image inspect quay.io/airshipit/vino
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Buid vino nodelabeler image
make:
chdir: "{{ zuul.project.src_dir }}"
target: docker-build-nodelabeler
params:
PROXY: "{{ proxy.http }}"
NO_PROXY: "{{ proxy.noproxy }}"
USE_PROXY: "{{ proxy.enabled | lower }}"
- name: Verify nodelabeler image exists
shell: docker image inspect quay.io/airshipit/nodelabeler
args:
chdir: "{{ zuul.project.src_dir }}"

61
roles/vino-publish-images/tasks/main.yaml

@ -0,0 +1,61 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Run ensure-docker
include_role:
name: ensure-docker
- name: Install python3-docker and python3-requests Modules
package:
name:
- python3-docker
- python3-requests
state: present
- name: Push Images
block:
- name: Build images
include_role:
name: vino-build-images
- name: List Docker Images
shell: docker image ls
- name: Login to Image Registry
docker_login:
username: "{{ airship_vino_airshipit_quay_secret.username }}"
password: "{{ airship_vino_airshipit_quay_secret.password }}"
registry_url: "{{ image_repo }}"
- name: Push Image with Latest Tag
make:
chdir: "{{ zuul.project.src_dir }}"
params:
DOCKER_IMAGE_TAG: latest
PUBLISH: "true"
PROXY: "{{ proxy.http }}"
NO_PROXY: "{{ proxy.noproxy }}"
USE_PROXY: "{{ proxy.enabled | lower }}"
DOCKER_REGISTRY: "{{ image_repo }}"
target: images
- name: Push Image with Commit Tag
make:
chdir: "{{ zuul.project.src_dir }}"
params:
DOCKER_IMAGE_TAG: "{{ zuul.newrev }}"
PUBLISH: "true"
PROXY: "{{ proxy.http }}"
NO_PROXY: "{{ proxy.noproxy }}"
USE_PROXY: "{{ proxy.enabled | lower }}"
DOCKER_REGISTRY: "{{ image_repo }}"
target: images

2
tools/deployment/deploy-vino.sh

@ -2,7 +2,7 @@
set -xe
sudo snap install kustomize && sudo snap install go --classic
make docker-build
make docker-build-controller
make deploy
kubectl get po -A
#Wait for vino controller manager Pod.

37
zuul.d/jobs.yaml

@ -1,3 +1,15 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- job:
name: airship-vino-upload-git-mirror
parent: upload-git-mirror
@ -8,13 +20,36 @@
- name: git_mirror_credentials
secret: airship_vino_airshipit_github_secret
pass-to-parent: true
- job:
name: airship-deploy-vino
run: playbooks/integration-test.yaml
description: Deploys kubernetes and vino
timeout: 9600
- job:
name: airship-vino-test-suite
description: Install kube-builder and tests make functionality.
run: playbooks/test-vino.yaml
timeout: 9600
timeout: 9600
- job:
name: airship-vino-build-images
run: playbooks/airship-vino-build-images.yaml
irrelevant-files: &noncodefiles
- ^certs/.*$
- ^docs/.*$
- ^.*\.md$
- ^\.github/.*$
- job:
name: airship-vino-publish-images
parent: airship-vino-build-images
post-run: playbooks/airship-vino-publish-images.yaml
irrelevant-files: *noncodefiles
secrets:
- name: airship_vino_airshipit_quay_secret
secret: airship_vino_airshipit_quay_secret
pass-to-parent: true
vars:
image: quay.io/airshipit/vino

24
zuul.d/projects.yaml

@ -1,14 +1,36 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- project:
vars:
proxy:
enabled: false
http: ""
https: ""
noproxy: ""
image_repo: quay.io
check:
jobs:
- airship-deploy-vino
- airship-vino-test-suite
- airship-vino-build-images
gate:
jobs:
- airship-deploy-vino
- airship-vino-test-suite
- airship-vino-build-images
post:
jobs:
- airship-vino-upload-git-mirror
- airship-deploy-vino
- airship-vino-test-suite
- airship-vino-test-suite
- airship-vino-publish-images

37
zuul.d/secrets.yaml

@ -1,3 +1,15 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- secret:
name: airship_vino_airshipit_github_secret
data:
@ -45,3 +57,28 @@
DK1FwrUBmFikF5ThEfjAQsmZGQBLB78nB5FcLCyLQQaKemYnLqgxQHya2nmMBKmhYoF58
Oqm1FFeUq7LuZq6Xh9KCW2eAeJtLOZxV33rhhL2vEudkN0C185AF0MfxAEo5NgIvPTxWP
TpPOlwUtH6DHi+VoT4fI4Qqc5AdFTRvXF1vQkokfbQos5GrtuN4zD5YwCQf1QM=
- secret:
name: airship_vino_airshipit_quay_secret
data:
username: !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