Commit 242db5c1 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

generated .gitlab-ci.yml handles multiple robotpkgs

parent 64a1d6c6
......@@ -263,6 +263,9 @@ class Project(Links, NamedModel, TimeStampedModel):
def open_pr(self):
return query_sum(self.repo_set, 'open_pr')
def gitlabciyml(self):
return get_template('rainboard/gitlab-ci.yml').render({'project': self})
class Repo(TimeStampedModel):
name = models.CharField(max_length=200)
......@@ -558,9 +561,6 @@ class Robotpkg(NamedModel):
def valid_images(self):
return self.image_set.filter(created__isnull=False)
def gitlabciyml(self):
return get_template('rainboard/gitlab-ci.yml').render({'robotpkg': self})
class RobotpkgBuild(TimeStampedModel):
robotpkg = models.ForeignKey(Robotpkg, on_delete=models.CASCADE)
......
......@@ -2,17 +2,19 @@ variables:
GIT_SSL_NO_VERIFY: "true"
GIT_SUBMODULE_STRATEGY: "recursive"
GIT_DEPTH: "3"
NAMESPACE: {{ robotpkg.project.main_namespace.slug }}
PROJECT: {{ robotpkg.project }}
ROBOTPKG: {{ robotpkg }}
CATEGORY: {{ robotpkg.category }}
NAMESPACE: {{ project.main_namespace.slug }}
PROJECT: {{ project }}
IMAGE: "${CI_REGISTRY}/${NAMESPACE}/${PROJECT}"
cache:
paths:
- build/ccache
{% for robotpkg in project.robotpkg_set.all %}
.robotpkg-{{ robotpkg }}: &robotpkg-{{ robotpkg }}
variables:
ROBOTPKG: {{ robotpkg }}
CATEGORY: {{ robotpkg.category }}
before_script:
- mkdir -p build/ccache
- cd build
......@@ -20,7 +22,7 @@ cache:
- export CCACHE_DIR=${PWD}/ccache
script:
- cd /root/robotpkg/${CATEGORY}/${ROBOTPKG}
- echo "REPOSITORY=git ${CI_PROJECT_DIR}" >> Makefile
- echo "MASTER_REPOSITORY=git ${CI_PROJECT_DIR}" >> Makefile
- make checkout
- make install
- cd work.*/${PROJECT}*/
......@@ -34,3 +36,5 @@ robotpkg-{{ image }}:
<<: *robotpkg-{{ robotpkg }}
image: ${IMAGE}:{{ image.get_target_display }}
{% endfor %}
{% endfor %}
......@@ -75,12 +75,13 @@
<dt>Build page</dt> <dd><a href="{{ rpkg.build_page }}">{{ rpkg.build_page }}</a></dd>
</dl>
<h4>generated .gitlab-ci.yml</h4>
{% endfor %}
<h3>generated .gitlab-ci.yml</h3>
<pre>
{{ rpkg.gitlabciyml }}
{{ project.gitlabciyml }}
</pre>
{% endfor %}
{% endif %}
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment