Add support for unstable and stable branches.

master
Simon Quigley 5 years ago
parent 2b178685a0
commit 179887a432

@ -70,8 +70,10 @@ class Generator:
"""
metadata_conf = self.clone_metadata()
metadata_req_keys = ["name", "packaging_url", "packaging_branch",
"upload_target", "releases", "default_branch"]
metadata_req_keys = ["name", "packaging_url",
"packaging_branch_unstable",
"packaging_branch_stable", "upload_target",
"releases", "default_branch"]
metadata_opt_keys = ["upstream_url", "upstream_branch"]
for package in metadata_conf["repositories"]:
@ -122,13 +124,15 @@ class Generator:
template = Template(template)
url = data["packaging_url"]
branch = data["packaging_branch"]
u_branch = data["packaging_branch_unstable"]
s_branch = data["packaging_branch_stable"]
if job_type == "package":
if job_type.startswith("package"):
upstream = data["upstream_url"]
upload_target = data["upload_target"]
package_config = template.render(PACKAGING_URL=url,
PACKAGING_BRANCH=branch,
PACKAGING_BRANCH_U=u_branch,
PACKAGING_BRANCH_S=s_branch,
UPSTREAM_URL=upstream,
NAME=data["name"],
RELEASE=data["release"],
@ -136,7 +140,8 @@ class Generator:
elif job_type == "merger":
default_branch = data["default_branch"]
package_config = template.render(PACKAGING_URL=url,
PACKAGING_BRANCH=branch,
PACKAGING_BRANCH_U=u_branch,
PACKAGING_BRANCH_S=s_branch,
NAME=data["name"],
DEFAULT_BRANCH=default_branch)
else:
@ -187,24 +192,27 @@ class Generator:
view.add_job(job_name)
for release in package["releases"]:
job_name = release + "_" + package["name"]
# Load the config given the current data
package["release"] = release
package_config = self.load_config("package", package)
if job_name in jobs:
job = server.get_job(job_name)
job.update_config(package_config)
else:
job = server.create_job(job_name, str(package_config))
# With an existing job we can assume it's already in an
# appropriate view. With new jobs, we should see if the
# view exists, and if it doesn't, create it
if release in server.views:
view = server.views[release]
for jobtype in ["unstable", "stable"]:
job_name = release + "_" + jobtype + "_" + package["name"]
package_config = self.load_config("package-" + jobtype,
package)
if job_name in jobs:
job = server.get_job(job_name)
job.update_config(package_config)
else:
view = server.views.create(release)
view.add_job(job_name)
job = server.create_job(job_name, str(package_config))
# With an existing job we can assume it's already in an
# appropriate view. With new jobs, we should see if the
# view exists, and if it doesn't, create it
viewname = release + " " + jobtype
if viewname in server.views:
view = server.views[viewname]
else:
view = server.views.create(viewname)
view.add_job(job_name)
if __name__ == "__main__":

@ -13,7 +13,10 @@
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/{{ PACKAGING_BRANCH }}</name>
<name>*/{{ PACKAGING_BRANCH_U }}</name>
</hudson.plugins.git.BranchSpec>
<hudson.plugins.git.BranchSpec>
<name>*/{{ PACKAGING_BRANCH_S }}</name>
</hudson.plugins.git.BranchSpec>
<hudson.plugins.git.BranchSpec>
<name>*/{{ DEFAULT_BRANCH }}</name>
@ -53,9 +56,12 @@
<command>
cd {{ NAME }}
git checkout {{ DEFAULT_BRANCH }}
git checkout -b {{ PACKAGING_BRANCH }} || git checkout {{ PACKAGING_BRANCH }}
git checkout -b {{ PACKAGING_BRANCH_S }} || git checkout {{ PACKAGING_BRANCH_S }}
git merge --ff-only {{ DEFAULT_BRANCH }}
git push --set-upstream origin {{ PACKAGING_BRANCH }} || echo "cannot push"
git push --set-upstream origin {{ PACKAGING_BRANCH_S }} || echo "cannot push"
git checkout -b {{ PACKAGING_BRANCH_U }} || git checkout {{ PACKAGING_BRANCH_U }}
git merge --ff-only {{ PACKAGING_BRANCH_S }}
git push --set-upstream origin {{ PACKAGING_BRANCH_U }} || echo "cannot push"
</command>
</hudson.tasks.Shell>
</builders>

@ -0,0 +1,74 @@
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.9.3">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>{{ PACKAGING_URL }}</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/{{ PACKAGING_BRANCH_S }}</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
<relativeTargetDir>{{ NAME }}</relativeTargetDir>
</hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
</extensions>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>true</blockBuildWhenUpstreamBuilding>
<triggers>
<jenkins.triggers.ReverseBuildTrigger>
<spec></spec>
<upstreamProjects>merger_{{ NAME }}</upstreamProjects>
<threshold>
<name>SUCCESS</name>
<ordinal>0</ordinal>
<color>BLUE</color>
<completeBuild>true</completeBuild>
</threshold>
</jenkins.triggers.ReverseBuildTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>
export VERSION="$(head -1 {{ NAME }}/debian/changelog | sed -n '/(/,/)/{:a; $!N; /)/!{$!ba}; s/.*(\([^)]*\)).*/\1/p}' | cut -d '-' -f1)+git$(date +'%Y%m%d%H%M')~{{ RELEASE }}";
export DEBFULLNAME="Lugito"
export DEBEMAIL="info@lubuntu.me"
(cd {{ NAME }}; uscan --download-current-version; dch --distribution {{ RELEASE }} --package "{{ NAME }}" --newversion "$VERSION-0ubuntu1~ppa1" "CI upload."; debuild -S -d -sa -k959BC9B671870639A1AC6E2F7FE7CC578F23E4CA; dput {{ UPLOAD_TARGET }} ../{{ NAME }}_$VERSION-0ubuntu1~ppa1_source.changes)
sleep 2m;
git clone https://phab.lubuntu.me/source/ci-tooling.git tooling;
./tooling/ci/lp_check.py -p {{ NAME }} -v $VERSION-0ubuntu1~ppa1 -t lubuntu-ci -r stable-ci-proposed;
</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup@0.37">
<patterns class="empty-list"/>
<deleteDirs>false</deleteDirs>
<skipWhenFailed>false</skipWhenFailed>
<cleanWhenSuccess>true</cleanWhenSuccess>
<cleanWhenUnstable>true</cleanWhenUnstable>
<cleanWhenFailure>true</cleanWhenFailure>
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
<cleanWhenAborted>true</cleanWhenAborted>
<notFailBuild>false</notFailBuild>
<cleanupMatrixParent>false</cleanupMatrixParent>
<externalDelete></externalDelete>
<disableDeferredWipeout>false</disableDeferredWipeout>
</hudson.plugins.ws__cleanup.WsCleanup>
</publishers>
<buildWrappers/>
</project>

@ -0,0 +1,77 @@
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="git@3.9.3">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>{{ PACKAGING_URL }}</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/{{ PACKAGING_BRANCH_U }}</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions>
<hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
<relativeTargetDir>{{ NAME }}</relativeTargetDir>
</hudson.plugins.git.extensions.impl.RelativeTargetDirectory>
</extensions>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>true</blockBuildWhenUpstreamBuilding>
<triggers>
<jenkins.triggers.ReverseBuildTrigger>
<spec></spec>
<upstreamProjects>merger_{{ NAME }}</upstreamProjects>
<threshold>
<name>SUCCESS</name>
<ordinal>0</ordinal>
<color>BLUE</color>
<completeBuild>true</completeBuild>
</threshold>
</jenkins.triggers.ReverseBuildTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>
git clone {{ UPSTREAM_URL }} upstream;
export VERSION="$(head -1 {{ NAME }}/debian/changelog | sed -n '/(/,/)/{:a; $!N; /)/!{$!ba}; s/.*(\([^)]*\)).*/\1/p}' | cut -d '-' -f1)+git$(date +'%Y%m%d%H%M')~{{ RELEASE }}";
export DEBFULLNAME="Lugito"
export DEBEMAIL="info@lubuntu.me"
tar cvf {{ NAME }}_$VERSION.orig.tar upstream;
gzip {{ NAME }}_$VERSION.orig.tar;
(cd {{ NAME }}; dch --distribution {{ RELEASE }} --package "{{ NAME }}" --newversion "$VERSION-0ubuntu1~ppa1" "CI upload."; debuild -S -d -sa -k959BC9B671870639A1AC6E2F7FE7CC578F23E4CA; dput {{ UPLOAD_TARGET }} ../{{ NAME }}_$VERSION-0ubuntu1~ppa1_source.changes)
sleep 2m;
git clone https://phab.lubuntu.me/source/ci-tooling.git tooling;
./tooling/ci/lp_check.py -p {{ NAME }} -v $VERSION-0ubuntu1~ppa1 -t lubuntu-ci -r unstable-ci-proposed;
</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.plugins.ws__cleanup.WsCleanup plugin="ws-cleanup@0.37">
<patterns class="empty-list"/>
<deleteDirs>false</deleteDirs>
<skipWhenFailed>false</skipWhenFailed>
<cleanWhenSuccess>true</cleanWhenSuccess>
<cleanWhenUnstable>true</cleanWhenUnstable>
<cleanWhenFailure>true</cleanWhenFailure>
<cleanWhenNotBuilt>true</cleanWhenNotBuilt>
<cleanWhenAborted>true</cleanWhenAborted>
<notFailBuild>false</notFailBuild>
<cleanupMatrixParent>false</cleanupMatrixParent>
<externalDelete></externalDelete>
<disableDeferredWipeout>false</disableDeferredWipeout>
</hudson.plugins.ws__cleanup.WsCleanup>
</publishers>
<buildWrappers/>
</project>
Loading…
Cancel
Save