Publish static HTML to GitLab pages (no build, no CI/CD)

210 views Asked by At

I have a collection of static HTML pages that I want to publish to GitLab Pages. These HTML documents were rendered as part of a computationally intensive snakemake workflow running on a HPC. The workflow "knits" HTML reports from Rmarkdown as part of its final steps.

For simplicity, let's assume that I have a single HTML file called index.html and that it contains only "Hello world!!!". Publishing this to GitHub pages is very easy. See this repo which gets published here.

GitLab, on the other hand, seems to insist that I set up CI/CD, even when the static HTML files are already available. I can see the advantages of using CI/CD but in this particular case this will involve setting up a runner and then getting the runner to run the snakemake workflow on the HPC, which could take a couple of days to complete. So I would prefer to solve the simple case first.

Is there a way to bypass the CI/CD? Or can I set up a kind of "null" CI/CD that simply takes the existing static HTML files and places them in public/, for example? What might such a "null" .gitlab-ci.yml file look like?

I tried to create a simple CI/CD pipeline that just copied index.html into public/. The GitLab repo is here. The pipeline fails for reasons that are completely opaque to me. How can I check error logs for the pipeline?

1

There are 1 answers

0
Peter On

When creating a new GitLab project, GitLab allows you to start with a template instead of a blank project.
One of the templates is is the Pages/Plain HTML

This template uses a minimal CI workflow that does nothing.
All files in the public directory of the project will end up in the root of the web page.

For your use case, you just need to put your web page files (like index.html) into the public directory and run the CI pipeline once.
If your repository is on gitlab.com, one of the public runners can be used with your project without setting up any custom runners.

For more details, see the Create a GitLab Pages website from a project template documentation.

To view the logs of a GitLab Pipeline/Jobs go to Build -> Jobs
and click the latest Job with a red X symbol and Failed text.

The problem in your CI script is:

$ cp index.html public/
cp: cannot create regular file 'public/': Not a directory