feat: Publish skyline-console to opendev tarballs

1. add tox.ini file
2. add playbooks for python tarball
3. add publish-skyline-console-python-branch-tarball job

Change-Id: I12124e65ffd67f18442bb4ff9ffb398c0d65114c
This commit is contained in:
zhu.boxiang 2021-12-24 14:03:50 +08:00
parent 5b288e6daa
commit 7a78dac501
5 changed files with 112 additions and 0 deletions

View File

@ -522,6 +522,17 @@
node_version: 14
js_build_command: test:unit
- job:
name: publish-skyline-console-python-branch-tarball
parent: publish-openstack-artifacts
description: |
Publish the results tar.gz and whl packages to tarballs.openstack.org.
pre-run: playbooks/python-tarball/pre.yaml
run: playbooks/python-tarball/run.yaml
post-run: playbooks/python-tarball/post.yaml
vars:
release_python: python3
- project:
check:
jobs:
@ -649,3 +660,6 @@
irrelevant-files: *e2etests-other-irrelevant-files
- skyline-console-devstack-e2etests-storage:
irrelevant-files: *e2etests-storage-irrelevant-files
post:
jobs:
- publish-skyline-console-python-branch-tarball

View File

@ -0,0 +1,35 @@
- hosts: all
tasks:
- name: Find tarballs and wheels in dist folder
find:
file_type: file
paths: "src/{{ zuul.project.canonical_name }}/dist"
patterns: "*.tar.gz,*.whl"
register: result
- name: Display stat for tarballs and wheels
stat:
path: "{{ zj_tarball_wheel.path }}"
with_items: "{{ result.files }}"
loop_control:
loop_var: zj_tarball_wheel
- name: Ensure artifacts directory exists
file:
path: "{{ zuul.executor.work_root }}/artifacts"
state: directory
mode: 0755
delegate_to: localhost
- name: Collect artifacts
synchronize:
dest: "{{ zuul.executor.work_root }}/artifacts/"
mode: pull
src: "{{ zj_artifact.path }}"
verify_host: true
owner: no
group: no
with_items: "{{ result.files }}"
loop_control:
loop_var: zj_artifact

View File

@ -0,0 +1,5 @@
- hosts: all
roles:
# We use ensure-pip to make sure the wheel module is installed
- ensure-pip
- revoke-sudo

View File

@ -0,0 +1,38 @@
- hosts: all
tasks:
- name: Install tox, nvm, nodejs and yarn
shell:
executable: /bin/bash
cmd: |
# nvm
wget -P $HOME --tries=10 --retry-connrefused --waitretry=60 --no-dns-cache --no-cache https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh
bash $HOME/install.sh
. $HOME/.nvm/nvm.sh
# nodejs
NODE_VERSION=erbium
nvm install --lts=$NODE_VERSION
nvm alias default lts/$NODE_VERSION
nvm use default
# yarn
npm install -g yarn
# tox
pip3 install tox
- name: Build tarball and wheel
shell:
executable: /bin/bash
cmd: |
. $HOME/.nvm/nvm.sh
$HOME/.local/bin/tox -e package
args:
chdir: "src/{{ zuul.project.canonical_name }}"
- name: Rename whl files to branch specific name
shell: "mv skyline_console*.whl skyline_console-{{ zuul.branch | replace('/', '-') }}.whl"
args:
chdir: "src/{{ zuul.project.canonical_name }}/dist"
- name: Rename tar.gz files to branch specific name
shell: "mv skyline-console*.tar.gz skyline-console-{{ zuul.branch | replace('/', '-') }}.tar.gz"
args:
chdir: "src/{{ zuul.project.canonical_name }}/dist"

20
tox.ini Normal file
View File

@ -0,0 +1,20 @@
[tox]
minversion = 3.18.0
# python runtimes: https://governance.openstack.org/tc/reference/runtimes/ussuri.html
envlist = package
skipsdist=true
# this allows tox to infer the base python from the environment name
# and override any basepython configured in this file
ignore_basepython_conflict=true
isolated_build=true
[testenv]
# Set default python version
basepython = python3
whitelist_externals =
make
deps = poetry != 1.1.8
[testenv:package]
commands =
make package