forked from willzhang/kolla-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkolla-publish.yml
75 lines (68 loc) · 2.49 KB
/
kolla-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# This workflow will pull kolla ansible docker images from dockerhub, push it to aliyun container registry.
#
# To configure this workflow:
#
# 1. Set up secrets in your workspace:
# - ALIYUN_USERNAME with aliyun registry username
# - ALIYUN_PASSWORD with aliyun registry password
#
# 2. Change the values for the ALIYUN_REGISTRY, ALIYUN_NAMESPACE environment variables (below).
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
DOCKER_NAMESPACE: kolla
KOLLA_BASE_DISTRO: centos
INSTALL_TYPE: binary
OPENSTACK_RELEASE: train
ALIYUN_REGISTRY: registry.cn-hangzhou.aliyuncs.com
ALIYUN_NAMESPACE: bzh-kolla
jobs:
get-kolla-images:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Log into aliyun registry
- name: Log into aliyun registry
run: docker login -u ${{ secrets.ALIYUN_USERNAME }} -p ${{ secrets.ALIYUN_PASSWORD }} $ALIYUN_REGISTRY
# clone kolla repo
- name: clone kolla repo
run: git clone https://github.com/openstack/kolla.git -b stable/$OPENSTACK_RELEASE
# get images list
- name: get images list
run: |
first_index=($(ls -l kolla/docker | grep "^d" | awk '{print $NF}'))
for first_file in ${first_index[@]}
do
#check if subdirectory exits
second_files=($(ls -l kolla/docker/$first_file | grep "^d" | awk '{print $NF}'))
if [ ${#second_files[@]} -eq 0 ]
then
echo $first_file >> images.txt
else
for second_file in ${second_files[@]}
do
echo $second_file >> images.txt
done
fi
done
echo "Images count is $(cat images.txt | wc -l)"
echo -e "All images is:\n$(cat images.txt)"
# pull and push images
- name: pull and push images
run: |
images=$(cat images.txt)
count=$(echo "$images" |wc -l)
icount=1
for image in $images
do
echo [$icount/$count]: $image
docker pull $DOCKER_NAMESPACE/${KOLLA_BASE_DISTRO}-${INSTALL_TYPE}-$image:$OPENSTACK_RELEASE || true
docker tag $DOCKER_NAMESPACE/${KOLLA_BASE_DISTRO}-${INSTALL_TYPE}-$image:$OPENSTACK_RELEASE $ALIYUN_REGISTRY/$ALIYUN_NAMESPACE/${KOLLA_BASE_DISTRO}-${INSTALL_TYPE}-$image:$OPENSTACK_RELEASE || true
docker push $ALIYUN_REGISTRY/$ALIYUN_NAMESPACE/${KOLLA_BASE_DISTRO}-${INSTALL_TYPE}-$image:$OPENSTACK_RELEASE || true
((icount++))
done