This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
gitlab_satis [2018/08/21 19:02] – admin | gitlab_satis [2018/11/14 15:54] (current) – [Optional] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using Gitlab and Satis to generate private composer Repository ====== | ====== Using Gitlab and Satis to generate private composer Repository ====== | ||
- | [[https:// | + | [[https:// |
**Idea** | **Idea** | ||
Line 9: | Line 9: | ||
* < | * < | ||
* < | * < | ||
+ | * FIXME Run pipeline only if it is not already running, pile up all requests and run it only once. | ||
**Features** | **Features** | ||
Line 31: | Line 32: | ||
image: ochorocho/ | image: ochorocho/ | ||
script: | script: | ||
- | - mkdir public | + | - mkdir satis-build |
- gitlab-pages-satis | - gitlab-pages-satis | ||
+ | - mv satis-build public | ||
artifacts: | artifacts: | ||
paths: | paths: | ||
Line 42: | Line 44: | ||
===== Configuration ===== | ===== Configuration ===== | ||
- | Go to User Settings -> Access Tokens, give it a name and allow api scope. Hit "Create personal access token" and copy it to your configuration (arguments -> gitlab-token). See below ... | + | Go to Project -> Settings -> CI/CD -> Pipeline Triggers, give it a name and allow api scope. Hit "Add Trigger" and copy it to your configuration (arguments -> gitlab-token). See below ... |
==== Using Environment variable ==== | ==== Using Environment variable ==== | ||
Line 61: | Line 63: | ||
homepage: " | homepage: " | ||
output: " | output: " | ||
- | | + | |
template: '/ | template: '/ | ||
archive: true | archive: true | ||
Line 69: | Line 71: | ||
username: " | username: " | ||
password: " | password: " | ||
+ | build-dir: " | ||
</ | </ | ||
Line 79: | Line 82: | ||
=== Satis example template === | === Satis example template === | ||
- | Use this template if you want to modify ... | + | Use this template |
* the Twig template | * the Twig template | ||
Line 110: | Line 113: | ||
<code ruby gitlab_pages_satis.rb> | <code ruby gitlab_pages_satis.rb> | ||
# | # | ||
+ | |||
+ | #### Config begin | ||
+ | |||
+ | # Trigger Token, see Project -> Settings -> CI/CD -> Pipeline triggers | ||
+ | trigger_token=" | ||
+ | |||
+ | # Private Token, see User -> Access Tokens -> Personal Access Tokens | ||
+ | auth_token=" | ||
+ | |||
+ | # GitLab install | ||
+ | gitlab_url=" | ||
+ | |||
+ | # Satis Project id (integer, not the project name) | ||
+ | satis_project_id=" | ||
+ | |||
+ | #### Config end | ||
require ' | require ' | ||
Line 122: | Line 141: | ||
shaFile = "# | shaFile = "# | ||
- | # Get hash values | + | # Get refs to compare |
- | payloadHash | + | payloadCurrent |
- | payloadHashBefore | + | payloadBefore |
- | # Save before and after hash to compare | + | # Save refs to compare |
File.delete(shaFile) if File.exist? | File.delete(shaFile) if File.exist? | ||
- | File.write(shaFile, | + | File.write(shaFile, |
+ | |||
+ | # Check if composer files exists in project | ||
+ | project_id=" | ||
+ | composerExists = `curl -o /dev/null -s -w \" | ||
# Trigger Pipeline | # Trigger Pipeline | ||
- | | + | |
- | | + | |
end | end | ||
+ | |||
end | end | ||
</ | </ |