Skip to content

Commit

Permalink
Bugfixes mainly
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristoffer Grönlund committed Dec 17, 2019
1 parent e285ebb commit 2c11133
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 26 deletions.
15 changes: 15 additions & 0 deletions create-srs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/bash
doit() {
if [ -d wip/home:KGronlund:branches:$1 ]; then
cd wip/home:KGronlund:branches:$1
osc sr -m "$2"
cd ../../..
fi
}

for project in ceph-image rook-ceph-image ceph-csi-image; do
for repo in filesystems:ceph filesystems:ceph:octopus filesystems:ceph:nautilus Devel:Storage:6.0 Devel:Storage:7.0; do
doit "$repo/$project" "$(cat entry.txt | head -1)"
done
done

6 changes: 3 additions & 3 deletions templates/ceph-csi-image/leap15_1.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<param>
<image>obsrepositories:/filesystems/ceph/nautilus/images/ceph/ceph#leap15.1.nautilus</image>
<image>obsrepositories:/ceph/ceph#leap15.1.nautilus</image>
<tags>leap15.1.nautilus</tags>
<name>cephcsi/cephcsi</name>
<prefix>org.opensuse.cephcsi</prefix>
<title>Ceph CSI driver container</title>
<url>https://registry.opensuse.org/filesystems/ceph/nautilus/images/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/filesystems/ceph/nautilus/images/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<url>https://registry.opensuse.org/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<packages_image>
<package>
<name>openSUSE-build-key</name>
Expand Down
6 changes: 3 additions & 3 deletions templates/ceph-csi-image/leap15_2.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<param>
<image>obsrepositories:/filesystems/ceph/octopus/images/ceph/ceph#leap15.2.octopus</image>
<image>obsrepositories:/ceph/ceph#leap15.2.octopus</image>
<tags>leap15.2.octopus</tags>
<name>cephcsi/cephcsi</name>
<prefix>org.opensuse.cephcsi</prefix>
<title>Ceph CSI driver container</title>
<url>https://registry.opensuse.org/filesystems/ceph/octopus/images/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/filesystems/ceph/octopus/images/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<url>https://registry.opensuse.org/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/cephcsi/cephcsi:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<packages_image>
<package>
<name>openSUSE-build-key</name>
Expand Down
4 changes: 2 additions & 2 deletions templates/ceph-image/leap15_1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<name>ceph/ceph</name>
<prefix>org.opensuse.ceph</prefix>
<title>Ceph container image</title>
<url>https://registry.opensuse.org/filesystems/ceph/nautilus/images/ceph/ceph:%PKG_VERSION%.%RELEASE%</url>
<reference>registry.opensuse.org/filesystems/ceph/nautilus/images/ceph/ceph:%PKG_VERSION%.%RELEASE%</reference>
<url>https://registry.opensuse.org/ceph/ceph:%PKG_VERSION%.%RELEASE%</url>
<reference>registry.opensuse.org/ceph/ceph:%PKG_VERSION%.%RELEASE%</reference>
<packages_image>
<package>
<name>patterns-ceph-containers-ceph_base</name>
Expand Down
4 changes: 2 additions & 2 deletions templates/ceph-image/leap15_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<name>ceph/ceph</name>
<prefix>org.opensuse.ceph</prefix>
<title>Ceph container image</title>
<url>https://registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph:%PKG_VERSION%.%RELEASE%</url>
<reference>registry.opensuse.org/filesystems/ceph/octopus/images/ceph/ceph:%PKG_VERSION%.%RELEASE%</reference>
<url>https://registry.opensuse.org/ceph/ceph:%PKG_VERSION%.%RELEASE%</url>
<reference>registry.opensuse.org/ceph/ceph:%PKG_VERSION%.%RELEASE%</reference>
<packages_image>
<package>
<name>patterns-ceph-containers-ceph_base</name>
Expand Down
36 changes: 30 additions & 6 deletions templates/map.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
{
"images": ["ceph-image", "ceph-csi-image", "rook-ceph-image"],
"repositories": {
"obs://filesystems:ceph": "tumbleweed",
"obs://filesystems:ceph:nautilus": "leap15_1",
"obs://filesystems:ceph:octopus": "leap15_2",
"obs://filesystems:ceph:upstream:master": "leap15_2",
"ibs://Devel:Storage:6.0": "ses6",
"ibs://Devel:Storage:7.0": "ses7"
"obs://filesystems:ceph": {
"variant": "tumbleweed",
"registry": "registry.opensuse.org",
"name_prefix": "/"
},
"obs://filesystems:ceph:nautilus": {
"variant": "leap15_1",
"registry": "registry.opensuse.org",
"name_prefix": "/filesystems/ceph/nautilus/images/"
},
"obs://filesystems:ceph:octopus": {
"variant": "leap15_2",
"registry": "registry.opensuse.org",
"name_prefix": "/filesystems/ceph/octopus/images/"
},
"obs://filesystems:ceph:master:upstream": {
"variant": "leap15_2",
"registry": "registry.opensuse.org",
"name_prefix": "/filesystems/ceph/master/upstream/images/"
},
"ibs://Devel:Storage:6.0": {
"variant": "ses6",
"registry": "registry.suse.com",
"name_prefix": "/"
},
"ibs://Devel:Storage:7.0": {
"variant": "ses7",
"registry": "registry.suse.com",
"name_prefix": "/"
}
}
}
6 changes: 3 additions & 3 deletions templates/rook-ceph-image/leap15_1.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<param>
<image>obsrepositories:/filesystems/ceph/nautilus/images/ceph/ceph#leap15.1.nautilus</image>
<image>obsrepositories:/ceph/ceph#leap15.1.nautilus</image>
<tags>leap15.1.nautilus</tags>
<name>rook/ceph</name>
<prefix>org.opensuse.rook-ceph</prefix>
<title>Rook container for Ceph</title>
<url>https://registry.opensuse.org/filesystems/ceph/nautilus/images/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/filesystems/ceph/nautilus/images/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<url>https://registry.opensuse.org/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<packages_image>
<package>
<name>openSUSE-build-key</name>
Expand Down
6 changes: 3 additions & 3 deletions templates/rook-ceph-image/leap15_2.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<param>
<image>obsrepositories:/filesystems/ceph/octopus/images/ceph/ceph#leap15.2.octopus</image>
<image>obsrepositories:/ceph/ceph#leap15.2.octopus</image>
<tags>leap15.2.octopus</tags>
<name>rook/ceph</name>
<prefix>org.opensuse.rook-ceph</prefix>
<title>Rook container for Ceph</title>
<url>https://registry.opensuse.org/filesystems/ceph/octopus/images/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/filesystems/ceph/octopus/images/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<url>https://registry.opensuse.org/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</url>
<reference>registry.opensuse.org/rook/ceph:%PKG_VERSION%.%PKG_COMMIT_NUM%.%RELEASE%</reference>
<packages_image>
<package>
<name>openSUSE-build-key</name>
Expand Down
18 changes: 18 additions & 0 deletions update-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/bash
chf="$(pwd)/entry.txt"

doit() {
if [ -d wip/home:KGronlund:branches:$1 ]; then
cd wip/home:KGronlund:branches:$1
osc vc -F $chf
osc commit -m "$(cat $chf | head -1)"
cd ../../..
fi
}

for project in ceph-image rook-ceph-image ceph-csi-image; do
for repo in filesystems:ceph filesystems:ceph:octopus filesystems:ceph:nautilus Devel:Storage:6.0 Devel:Storage:7.0; do
doit "$repo/$project"
done
done

18 changes: 14 additions & 4 deletions update-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
BRANCHBASE = obsscripts.obs_branchbase(OBS)


def update_repo(name, repo, variant):
def update_repo(name, repo, variant, registry, prefix):
"""
1. generate the kiwi file
2. pull down kiwi file from server
Expand Down Expand Up @@ -47,12 +47,14 @@ def update_repo(name, repo, variant):
rq = sh.xsltproc(os.path.join(tmpl_dir, name, "{}.xsl".format(name)),
os.path.join(tmpl_dir, name, "{}.xml".format(variant)))
new_kiwi = rq.stdout.decode('utf-8')
new_kiwi = new_kiwi.replace("{}/".format(registry), "{}{}".format(registry, prefix))
new_kiwi = new_kiwi.replace("obsrepositories:/ceph/ceph", "obsrepositories:{}ceph/ceph".format(prefix))
if curr_kiwi == new_kiwi:
print("Skipping {}/{}: no difference".format(repo, name))
return
except sh.ErrorReturnCode as err:
print(err)
print("Skipping {}/{}...".format(err.exit_code, repo, name))
print("Skipping {}/{}...".format(repo, name))
return

try:
Expand All @@ -65,6 +67,11 @@ def update_repo(name, repo, variant):
os.chdir(os.path.join(wip_dir, BRANCHBASE.format(repo), name))
with open("{}.kiwi".format(name), "w") as f:
f.write(new_kiwi)
# copy updated template files as well
for f in os.listdir(os.path.join(tmpl_dir, name)):
shutil.copyfile(os.path.join(tmpl_dir, name, f),
os.path.join(wip_dir, BRANCHBASE.format(repo), name, f))
osc.ar()
finally:
os.chdir(curr)

Expand All @@ -79,8 +86,11 @@ def main():
cfg = json.load(open(os.path.join(TEMPLATES_DIR, MAP_FILE)))

for image in cfg["images"]:
for repo, variant in cfg["repositories"].items():
update_repo(image, repo, variant)
for repo, data in cfg["repositories"].items():
variant = data["variant"]
registry = data["registry"]
prefix = data["name_prefix"]
update_repo(image, repo, variant, registry, prefix)

if __name__ == "__main__":
main()

0 comments on commit 2c11133

Please sign in to comment.