How to publish to GitLab Pages using Renkulab

How to publish to GitLab Pages using Renkulab

Problem: the GitLab instance behind Renkulab does not inherently have a GitLab Pages pushing functionality.

Solution: use conditional mirroring.

Steps:

  1. create a renku project
  2. alter the .gitlab-ci.yml file slightly
  3. create an empty gitlab.com project
  4. set that gitlab.com project to pull from the renkulab project

This example is based off GitLab Pages examples / plain-html · GitLab, which has the corresponding Pages site at Plain HTML site using GitLab Pages.

  1. Prototype repository: Create a plain renku project, such as Gavin Lee / my-pages · GitLab

  2. The .gitlab-ci.yml file has been altered: see .gitlab-ci.yml · master · Gavin Lee / my-pages · GitLab

In particular, there are two stages, ‘build’ and ‘deploy’, with variables which are tagged as exceptions. The $CI_PROJECT_URL specifies the gitlab.com project to push updates to.

The ‘pages:’ section is taken directly from the GitLab Pages examples / plain-html · GitLab example.

  1. Prototype repository: gavin-k-lee / my-book · GitLab. When first setting this up, you should create an EMPTY repository. I have named the renkulab project ‘my-pages’ and the gitlab.com project ‘my-book’ to distinguish the two. You can name them the same thing, but this is slightly confusing sometimes because the renku gitlab and native gitlab instances have the same user interfact in the browser!

  2. Set up mirroring in gitlab.com as shown. For the password, you need to set up a personal access token in renkulab with at least ‘read_repository’ permissions. Be sure to copy that token into your clipboard as it does not get shown after leaving that page.

The mirroring should begin to pull the renkulab contents into the empty repository.

mirror_result

You should then view the GitLab Pages result!

Credits: @cchoirat

2 Likes

The mirroring direction on gitlab.com should be PULL.