[PATCH wayland 1/2] gitlab-ci: Trigger site's project pipeline

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 23 22:07:25 UTC 2018


On Wed, Jul 18, 2018 at 09:47:51AM +1000, Peter Hutterer wrote:
> On Mon, Jul 16, 2018 at 02:08:34PM -0300, Matheus Santana wrote:
> > For automatically building and publishing docs.
> > 
> > It'll be necessary to
> > 
> > 1. create a pipeline trigger for the [site's project][trigger]
> > 2. create a variable within [wayland's CI][envar] whose key is
> >    WAYLAND_FREEDESKTOP_ORG_PIPELINE_TRIGGER_TOKEN and value is the token
> >    created in previous step
> > 
> > Also see https://gitlab.freedesktop.org/wayland/wayland/issues/48
> > 
> > Signed-off-by: Matheus Santana <embs at cin.ufpe.br>
> > 
> > [trigger]: https://gitlab.freedesktop.org/wayland/wayland.freedesktop.org/settings/ci_cd
> > [envar]: https://gitlab.freedesktop.org/wayland/wayland/settings/ci_cd
> > ---
> >  .gitlab-ci.yml | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> > index 2489665..c6840e6 100644
> > --- a/.gitlab-ci.yml
> > +++ b/.gitlab-ci.yml
> > @@ -2,6 +2,7 @@ image: debian:stretch
> >  
> >  stages:
> >    - build
> > +  - deploy
> >  
> >  before_script:
> >    - echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
> > @@ -10,7 +11,7 @@ before_script:
> >    - echo 'exit 101' >> /usr/sbin/policy-rc.d
> >    - chmod +x /usr/sbin/policy-rc.d
> >    - apt-get update
> > -  - apt-get -y --no-install-recommends install build-essential automake autoconf libtool pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl
> > +  - apt-get -y --no-install-recommends install build-essential automake autoconf libtool pkg-config libexpat1-dev libffi-dev libxml2-dev doxygen graphviz xmlto xsltproc docbook-xsl curl ca-certificates
> >  
> >  build-native:
> >    stage: build
> > @@ -34,3 +35,10 @@ build-native:
> >      - build-*/wayland*/_build/sub/*.log
> >      - build-*/*.log
> >      - prefix-*
> > +
> > +publish-docs:
> > +  stage: deploy
> > +  script:
> > +  - curl -X POST -F token=$WAYLAND_FREEDESKTOP_ORG_PIPELINE_TRIGGER_TOKEN -F ref=master https://gitlab.freedesktop.org/api/v4/projects/136/trigger/pipeline
> 
> fwiw, check out the libinput .gitlab-ci.yml for how to use the project name
> here instead of the number. Either will work though. You can also use 
>   image: registry.freedesktop.org/libinput/libinput/jq:latest
> that way you can skip the before_script stage and speed up everything
> significantly
> 
> > +  only:
> > +  - master
> 
> I'd prefer the more explicit:
>     only:
>       refs:
>       - master
> 
> but afaict yours will work just fine. However, 
> you probably want this here:
> 
>    only:
>        variables:
>           - $CI_PROJECT_PATH == "wayland/wayland"
> 
> otherwise your're trying to run the job on any push to wayland master in any
> personal project. They won't have the token set and thus not do anything but
> waste time.
> 
> also add a single line
>   dependencies:
> 
> to indicate you don't care about any dependencies from previous steps

correction: this needs to be dependencies: [] to indicate an empty array.

Cheers,
   Peter


More information about the wayland-devel mailing list