Add publish jobs for AIAP

Change-Id: I23ea662d4354cdb8ee11d82aeeedf4a5282963db
This commit is contained in:
Ian Howell 2021-07-16 14:17:03 -05:00
parent 0c36a47ee3
commit f9411f40f7
7 changed files with 138 additions and 22 deletions

View File

@ -0,0 +1,17 @@
# 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:
- docker-install
- aiap-build-images

View File

@ -0,0 +1,17 @@
# 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:
- docker-install
- aiap-publish-images

View File

@ -0,0 +1,19 @@
# 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: Build airship-in-a-pod Images
make:
chdir: "{{ zuul.project.src_dir }}/tools/airship-in-a-pod"
target: images
params:
DOCKER_REGISTRY: "{{ image_repo }}"
DOCKER_IMAGE_TAG: "{{ zuul.change }}"

View File

@ -0,0 +1,41 @@
# 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: Install python3-docker and python3-requests Modules
package:
name:
- python3-docker
- python3-requests
state: present
- name: List Docker Images
shell: docker image ls
- name: Push Images
block:
- name: Login to Image Registry
docker_login:
username: "{{ airshipctl_image_repo_credentials.username }}"
password: "{{ airshipctl_image_repo_credentials.password }}"
registry_url: "{{ image_repo }}"
- name: Push Image with Tags
make:
chdir: "{{ zuul.project.src_dir }}/tools/airship-in-a-pod"
target: images
params:
DOCKER_REGISTRY: "{{ image_repo }}"
DOCKER_IMAGE_TAG: "{{ item }}"
PUBLISH: "true"
loop:
- "latest"
- "{{ zuul.newrev }}"

View File

@ -1,10 +1,10 @@
IMAGE_REGISTRY ?= quay.io/airshipit
IMAGES := infra-builder artifact-setup runner
IMAGE_TAG ?= latest
DOCKER_REGISTRY ?= quay.io
DOCKER_IMAGE_PREFIX ?= airshipit
DOCKER_IMAGE_TAG ?= latest
IMAGES ?= infra-builder artifact-setup runner
PUBLISH ?= false
PUSH_IMAGES ?= false
.PHONY: help base libvirt $(IMAGES) build test
.PHONY: help base libvirt $(IMAGES) images test
SHELL:=/bin/bash
.ONESHELL:
@ -12,34 +12,34 @@ SHELL:=/bin/bash
help: ## This help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
build: base
build: libvirt
build: $(IMAGES) ## Build the containers.
images: base
images: libvirt
images: $(IMAGES) ## Build the containers.
base:
docker build --tag $(IMAGE_REGISTRY)/aiap-base:$(IMAGE_TAG) --build-arg BASE_IMAGE=ubuntu:20.04 ./base
ifeq (true, $(PUSH_IMAGES))
docker push $(IMAGE_REGISTRY)/aiap-base:$(IMAGE_TAG)
docker build --tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/aiap-base:$(DOCKER_IMAGE_TAG) --build-arg BASE_IMAGE=ubuntu:20.04 ./base
ifeq (true, $(PUBLISH))
docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/aiap-base:$(DOCKER_IMAGE_TAG)
endif
libvirt:
docker build --tag $(IMAGE_REGISTRY)/libvirt:$(IMAGE_TAG) ./libvirt
ifeq (true, $(PUSH_IMAGES))
docker push $(IMAGE_REGISTRY)/libvirt:$(IMAGE_TAG)
docker build --tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/libvirt:$(DOCKER_IMAGE_TAG) ./libvirt
ifeq (true, $(PUBLISH))
docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/libvirt:$(DOCKER_IMAGE_TAG)
endif
$(IMAGES):
docker build --tag $(IMAGE_REGISTRY)/aiap-$@:$(IMAGE_TAG) ./$@
ifeq (true, $(PUSH_IMAGES))
docker push $(IMAGE_REGISTRY)/aiap-$@:$(IMAGE_TAG)
docker build --tag $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/aiap-$@:$(DOCKER_IMAGE_TAG) ./$@
ifeq (true, $(PUBLISH))
docker push $(DOCKER_REGISTRY)/$(DOCKER_IMAGE_PREFIX)/aiap-$@:$(DOCKER_IMAGE_TAG)
endif
test: test-airshipctl test-treasuremap
test-airshipctl: build
test-airshipctl: images
kubectl delete pod airship-in-a-pod || true
kustomize build ./examples/airshipctl | kubectl apply -f -
test-treasuremap: build
test-treasuremap: images
kubectl delete pod airship-in-a-pod || true
kustomize build ./examples/airshipctl | kubectl apply -f -

View File

@ -59,6 +59,13 @@
- ^.*\.md$
- ^\.github/.*$
- job:
name: airship-aiap-build-image
nodeset: airship-airshipctl-single-node
run: playbooks/airship-aiap-build-images.yaml
files:
- ^tools/airship-in-a-pod/.*$
- job:
name: airship-airshipctl-validate-site-docs
timeout: 6600
@ -239,3 +246,15 @@
pass-to-parent: true
vars:
image: quay.io/airshipit/airshipctl
- job:
name: airship-aiap-publish-image
nodeset: airship-airshipctl-single-node
run: playbooks/airship-aiap-publish-images.yaml
files:
- ^tools/airship-in-a-pod/.*$
secrets:
- name: airshipctl_image_repo_credentials
secret: airshipctl_image_repo_credentials
pass-to-parent: true
vars:
image: quay.io/airshipit/airshipctl

View File

@ -40,6 +40,7 @@
- airship-airshipctl-validate-site-docs
# - airship-airshipctl-functional-existing-k8s TODO: Enable this when functional tests exist, and a cluster is up
- airship-airshipctl-gate-script-runner-docker
- airship-aiap-build-image
experimental:
jobs:
- airship-airshipctl-docker-kubebench-conformance
@ -53,11 +54,13 @@
- airship-airshipctl-build-image
- airship-airshipctl-validate-site-docs
- airship-airshipctl-gate-script-runner
- airship-aiap-build-image
# - airship-airshipctl-functional-existing-k8s TODO: Enable this when functional tests exist, and a cluster is up
post:
jobs:
- airship-airshipctl-publish-image
- airship-aiap-publish-image
- airship-airshipctl-upload-git-mirror
promote:
jobs: