Skip to content

Commit 8c47b67

Browse files
committed
Build utility image for using osc
python-openstackclient currently has a non-zero number of dependencies, so for admins who would like to run it on laptops or similar it can get tricky. In opendev, for instance, admins have it installed into a venv on a jump host, but it's really wonky to keep up with. Use the opendev/python-builder opendev/python-base pair to make a minimal image that contains an install of python-openstackclient and publish it to the osclient org on dockerhub. There is an overall policy against having binary artifacts such as this appear to be official deliverables of the OpenStack project, which this is not. It's also only publishing images based on master, so no warranties should be implied. But if this makes life easier for a user somewhere, cool. Change-Id: I9a8bfc27c127e92b6856cb6a3e45b32c818db16c
1 parent 0699df9 commit 8c47b67

3 files changed

Lines changed: 117 additions & 0 deletions

File tree

.zuul.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,59 @@
152152
tox_envlist: functional
153153
tox_install_siblings: true
154154

155+
- secret:
156+
name: osc-dockerhub
157+
data:
158+
username: osclientzuul
159+
password: !encrypted/pkcs1-oaep
160+
- qQ0O7bXUWBhkygjSKcPHogWvR2ax67EgHZcYd27zgg6KvpdK9GsNTRTIeD5yeBb9Dzr/K
161+
RcAf+0pQT3fRIsKyEx2odHNevGpePjmUZENd5vHTIvTuZWq+X5ehpXgkEYvw3jwYJg78F
162+
ids1igEaHsE86OMHjWauyc1QUzYfwkf+ziK7TIOZ6RpVRHgq5Bf9S+Hz/QnVdxOLaIlO0
163+
VC/bchKX/36vOQKd20KkNhBQAnUlDBQWMnZocvZKZYtkDs2w2vqlnUPRlzEppBWm5Yae6
164+
5acyIHEEAIbECd/wC/OT8YndoeOUiqOZY0uSWtv4JgEKl6AexP+54VxPrsz7LayRMDJ4B
165+
jVCZK6y1sss9mF6mNXvZipPEVgklGcGM76GfGdqTeuQ3i8CqaKmCTBo1IKlEmcslXR/5T
166+
vjibWzvNHPpFcpYEEM6GLGg2K6nja1MCE1s/L76pN3FtxCZHdl8rZXU+mJH37uQk9zvdR
167+
Y6qtWJ+3o5sbgYfjgdp/nPs1xXMUvuG83qykuzYgtOYvlEw51eqwd2SPXd3op/KApAhKR
168+
Zlu8fBUkm/FyXToOpCl0s/eR4w1d+Spv0A+UhrS5pmV18+NlpNs0Krj5wS9KWMUIec0ae
169+
opgPkQrFfj/zD45rrIUJRzT+alZlZeK+WQfeNOXt2i6MLtOPesHMukTc6ksXtA=
170+
171+
- job:
172+
name: osc-build-image
173+
parent: opendev-build-docker-image
174+
description: Build Docker images.
175+
allowed-projects: openstack/python-openstackclient
176+
requires:
177+
- python-builder-container-image
178+
- python-base-container-image
179+
provides: osc-container-image
180+
vars: &osc_image_vars
181+
docker_images:
182+
- context: .
183+
repository: osclient/python-openstackclient
184+
185+
- job:
186+
name: osc-upload-image
187+
parent: opendev-upload-docker-image
188+
description: Build Docker images and upload to Docker Hub.
189+
allowed-projects: openstack/python-openstackclient
190+
requires:
191+
- python-builder-container-image
192+
- python-base-container-image
193+
provides: osc-container-image
194+
vars: *osc_image_vars
195+
secrets: &osc_image_secrets
196+
- name: docker_credentials
197+
secret: osc-dockerhub
198+
pass-to-parent: true
199+
200+
- job:
201+
name: osc-promote-image
202+
parent: opendev-promote-docker-image
203+
allowed-projects: openstack/python-openstackclient
204+
description: Promote previously uploaded Docker images.
205+
vars: *osc_image_vars
206+
secrets: *osc_image_secrets
207+
155208
- project-template:
156209
name: osc-tox-unit-tips
157210
check:
@@ -174,6 +227,7 @@
174227
- lib-forward-testing-python3
175228
check:
176229
jobs:
230+
- osc-build-image
177231
- osc-functional-devstack
178232
# - osc-functional-devstack-n-net:
179233
# voting: false
@@ -187,4 +241,8 @@
187241
branches: ^(?!stable)
188242
gate:
189243
jobs:
244+
- osc-upload-image
190245
- osc-functional-devstack
246+
promote:
247+
jobs:
248+
- osc-promote-image

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) 2020 Red Hat, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12+
# implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
FROM docker.io/opendevorg/python-builder as builder
17+
18+
COPY . /tmp/src
19+
RUN assemble
20+
21+
FROM docker.io/opendevorg/python-base
22+
23+
COPY --from=builder /output/ /output
24+
RUN /output/install-from-bindep
25+
26+
CMD ["/usr/local/bin/openstack"]

examples/openstack.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Copyright (c) 2020 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
# implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This is an example script that can be installed somewhere, such as
18+
# /usr/local/bin/openstack, that will allow using python-openstackclient
19+
# via the container image instead of via a direct installation. It
20+
# bind-mounts in clouds.yaml files, so it should behave like a directly
21+
# installed osc.
22+
23+
if type podman 2>/dev/null ; then
24+
RUNTIME=podman
25+
else
26+
RUNTIME=docker
27+
fi
28+
29+
exec $RUNTIME run -it --rm \
30+
-v/etc/openstack:/etc/openstack \
31+
-v$HOME/.config/openstack:/root/.config/openstack \
32+
osclient/openstackclient \
33+
openstack $@

0 commit comments

Comments
 (0)