How to publish to GitLab Pages using Renkulab

How to publish to GitLab Pages using Renkulab

Problem: the GitLab instance behind Renkulab does not currently have a GitLab Pages publishing functionality set up.

We will use repository mirroring to get around this. The idea is to push renkulab to the usual gitlab instance and have pages served from there.

(It is also possible through pulling, however, since it is not reliably available for free: see link, we have altered this tutorial.)

Steps:

  1. create a renku project
  2. alter the .gitlab-ci.yml file slightly
  3. create an empty gitlab.com project
  4. set the renkulab project to push to the gitlab.com 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 interpretation is as such: the CI will build the image_build stage except when the $CI_PROJECT_URL points to the gitlab.com instance. That is, only on renkulab. Conversely, the deploy stage will only run when the project is the one from gitlab.com.

The ‘pages:’ section is taken 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 PUSH mirroring in renkulab.

Enter the gitlab Git URL. Make sure to include the namespace as @gitlab.com.

The default direction should be PUSH. The password needs to be generated as a Personal Access Token.

Navigate to https://gitlab.com/-/profile/personal_access_tokens to set up a token. Give at least read and write access. Generate the token and copy it to your clipboard. Enter it as the password in renkulab.

The mirroring should begin to push the renkulab contents into the empty repository. If it doesn’t start, click the “Update now” button to force start.

You should then view the GitLab Pages result!

Credits: @cchoirat

2 Likes