This is an old revision of the document!
This is mainly a wrapper for mborne/satis-gitlab inteded to make it easy to use with minimal and simple configuration. Best used together with Gitlab. I'm using Gitlab Pages behind Apache, nginx is the default/recommended way to use Gitlab Pages with.
Idea
Features
basic-auth
is set)build-dir
to configure target folderoptions
is passed to satis-gitlab
as –option
arguments
is passed to satis-gitlab
as argument–ignore
to exclude certain repos
The image ochorocho/gitlab-pages-satis provides gitlab-pages-satis
command which reads the environment variable GITLAB_SATIS_CONFIG
first. Fallback is ./config.yml
or the configured file e.g. gitlab-pages-satis /path/to/config.yml
stages: - deploy pages: stage: deploy image: ochorocho/gitlab-pages-satis:latest script: - mkdir public - gitlab-pages-satis artifacts: paths: - public/ only: - master
In Gitlab go to Project → Settings → CI / CD → Variables and create variable named $GITLAB_SATIS_CONFIG
and add your config to the “input variable value” field.
Add a config file to your repository. By default the script is looking for config.yml
file. If you want to change that simply call the script this way gitlab-pages-satis /path/to/custom_config.yml
arguments: gitlab-url: "https://gitlab.example.org" gitlab-token: "GITLAB_TOKEN" options: ignore: "(^namespace_name|^namespace\/project)" homepage: "https://satis.example.org" output: "satis.json" basic-auth: auth-name: "Satis Repository" auth-file: "/path/to/.htpasswd" # Absolute path required username: "admin" password: "password"
Make sure Gitlab Pages is activated for your project.
Trigger the Pipeline, that's it!
Want to trigger your satis projects pipeline each time a Tag is created/deleted ?
/opt/gitlab/embedded/service/gitlab-rails/plugins/gitlab_pages_satis.rb
chmod +x gitlab_pages_satis.rb
)sudo gitlab-rake plugins:validate
to make sure its running#!/usr/bin/env ruby require 'json' require 'tmpdir' payload = JSON.parse(STDIN.read) # Only run this code in case we are dealing with tag_push event if payload['event_name'] == 'tag_push' temp = Dir.tmpdir() shaFile = "#{temp}/gitlab-trigger.sha" # Get hash values to compare payloadHash = "#{payload['before']} #{payload['after']}" payloadHashBefore = File.read(shaFile) if File.exist?(shaFile) # Save before and after hash to compare File.delete(shaFile) if File.exist?(shaFile) File.write(shaFile, "#{payload['before']} #{payload['after']}") # Trigger Pipeline if payloadHashBefore != payloadHash exec('curl --request POST --form "token=XXXXXXX" --form ref=master https://gitlab.example.org/api/v4/projects/36/trigger/pipeline') end end