From d1bcf29c43b8d866ae83702dc70668d4a146144c Mon Sep 17 00:00:00 2001
From: Fredo Erxleben <f.erxleben@hzdr.de>
Date: Fri, 19 Jun 2020 10:30:37 +0200
Subject: [PATCH] Add gitlab-specific files

---
 .gitlab-ci.yml                                | 244 ++++++++++++++++++
 .../issue_templates/add_event_announcement.md |  98 +++++++
 .gitlab/issue_templates/add_team_member.md    | 113 ++++++++
 .gitlab/issue_templates/blog-post.md          |  38 +++
 4 files changed, 493 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 .gitlab/issue_templates/add_event_announcement.md
 create mode 100644 .gitlab/issue_templates/add_team_member.md
 create mode 100644 .gitlab/issue_templates/blog-post.md

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 000000000..1b9aaca8b
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,244 @@
+image: ruby:2.7
+
+stages:
+  - build
+  - test
+  - review
+  - deploy
+
+.artifacts_extension:
+  artifacts:
+    paths:
+      - public
+    expire_in: 1d
+
+.cache_latest: &cache_latest
+  cache:
+    key: latest
+    paths:
+      - vendor/bundle
+
+.cache_production: &cache_production
+  cache:
+    key: production
+    paths:
+      - vendor/bundle
+
+.only_extension:
+  only:
+    - master
+
+.common_production: &production_before_script
+  before_script:
+    - gem install bundler --no-document
+    - bundle install --jobs $(nproc) --without test "${FLAGS[@]}"
+  <<: *cache_production
+
+.common_latest: &latest_before_script
+  before_script:
+    - "[[ -f \"Gemfile.lock\" ]] && rm Gemfile.lock"
+    - bundle install --jobs $(nproc) --without test "${FLAGS[@]}"
+    - bundle update --jobs $(nproc) "${FLAGS[@]}"
+  <<: *cache_latest
+
+.common_variables: &common_variables
+  GIT_SUBMODULE_STRATEGY: recursive
+  SUBPATH: "/"
+  BUNDLE_PATH: vendor/bundle
+  NOKOGIRI_USE_SYSTEM_LIBRARIES: "1"
+
+.builds: &builds
+  stage: build
+  variables:
+    <<: *common_variables
+  script:
+    - "bundle exec jekyll build --future \
+        --config _config.yml \
+        -d public$SUBPATH \
+        --baseurl $SUBPATH"
+    - "bash ./scripts/copy_favicons.bash \"_favicons/\" \"public/\" $SUBPATH"
+  # https://docs.gitlab.com/ce/ci/yaml/#interruptible
+  interruptible: true
+
+.builds_reviewapps: &builds_reviewapps
+  stage: build
+  variables:
+    <<: *common_variables
+  script:
+    - "bundle exec jekyll build --future \
+        --config _config.yml,_config_reviewapps.yml \
+        -d public$SUBPATH \
+        --baseurl $SUBPATH"
+    - "bash ./scripts/copy_favicons.bash \"_favicons/\" \"public/\" $SUBPATH"
+  # https://docs.gitlab.com/ce/ci/yaml/#interruptible
+  interruptible: true
+
+.tests: &tests
+  stage: test
+  variables:
+    <<: *common_variables
+    HTMLPROOFER_VERSION: 3.13.0
+    YAMLLINT_VERSION: 0.0.7
+    GIT_STRATEGY: none
+  before_script:
+    # Installing, generating and exporting locale because htmlproofer needs it.
+    # Locale is not set in "standard" docker containers.
+    - "[[ -x \"$(command -v apt-get)\" ]] && \
+      apt-get update && \
+      apt-get install -y locales && \
+      echo \"en_US UTF-8\" > /etc/locale.gen && \
+      locale-gen en_US.UTF-8 && \
+      export LANG=en_US.UTF-8 && \
+      export LANGUAGE=en_US:en && \
+      export LC_ALL=en_US.UTF-8"
+    - gem install html-proofer -v $HTMLPROOFER_VERSION --no-document
+    - gem install yaml-lint -v $YAMLLINT_VERSION --no-document
+  script:
+    - "htmlproofer \
+        --internal-domains localhost:4000 \
+        --disable-external \
+        --assume-extension public/"
+    # Use yaml-lint tool to check yaml files.
+    - "yaml-lint _data/ _config.yml"
+  <<: *cache_production
+  # https://docs.gitlab.com/ce/ci/yaml/#interruptible
+  interruptible: true
+
+# Job runs jekyll build with latest dependencies.
+build:latest:
+  <<: *builds
+  <<: *latest_before_script
+  image: ruby:latest
+  allow_failure: true
+
+# Job runs jekyll build latest dependencies,
+# puts everything in a sub-directory while specifying baseurl.
+build:production:subpath:
+  <<: *builds
+  <<: *production_before_script
+  image: ruby:latest
+  variables:
+    <<: *common_variables
+    SUBPATH: /$CI_PROJECT_NAME
+  extends:
+    - .artifacts_extension
+
+# Job runs jekyll build with production dependencies,
+# puts everything in a sub-directory as required for review apps.
+build:production:review-apps:
+  <<: *builds_reviewapps
+  <<: *production_before_script
+  variables:
+    <<: *common_variables
+    SUBPATH: /review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
+  extends:
+    - .artifacts_extension
+
+# Job runs jekyll build with current production dependencies
+build:production:
+  <<: *builds
+  <<: *production_before_script
+  extends:
+    - .artifacts_extension
+
+# Job runs htmlproofer basing on production build.
+test:htmlproofer:
+  <<: *tests
+  dependencies:
+    - build:production
+  needs: ["build:production"]
+
+# Job runs htmlproofer basing on production build with subpath.
+test:htmlproofer:subpath:
+  <<: *tests
+  dependencies:
+    - build:production:subpath
+  needs: ["build:production:subpath"]
+
+# Job tests external links in addition to test:htmlproofer job.
+test:htmlproofer:external_links:
+  <<: *tests
+  dependencies:
+    - build:production
+  needs: ["build:production"]
+  script:
+    - "htmlproofer \
+        --internal-domains localhost:4000 \
+        --assume-extension public/"
+  only:
+    - schedules
+  tags:
+    - internal
+
+review:
+  stage: review
+  variables:
+    GIT_STRATEGY: none
+    REVIEW_APPS_PATH: review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
+  dependencies:
+    - build:production:review-apps
+  needs: ["build:production:review-apps"]
+  script:
+    - mkdir -p /var/www/html/gl-review-apps/$REVIEW_APPS_PATH
+    - rsync -a --delete ./public/$REVIEW_APPS_PATH/. /var/www/html/gl-review-apps/$REVIEW_APPS_PATH/.
+  environment:
+    name: review/$CI_COMMIT_REF_NAME
+    url: https://$APPS_DOMAIN/review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
+    on_stop: stop_review
+  only:
+    - branches
+  except:
+    - master
+  tags:
+    - review-apps
+
+stop_review:
+  stage: review
+  variables:
+    GIT_STRATEGY: none
+    REVIEW_APPS_PATH: review-apps/$CI_PROJECT_PATH_SLUG/$CI_COMMIT_REF_SLUG
+  script:
+    - rm -rf public /var/www/html/gl-review-apps/$REVIEW_APPS_PATH
+    - rmdir --ignore-fail-on-non-empty /var/www/html/gl-review-apps/review-apps/$CI_PROJECT_PATH_SLUG/
+  dependencies: []
+  when: manual
+  environment:
+    name: review/$CI_COMMIT_REF_NAME
+    action: stop
+  tags:
+    - review-apps
+
+production:
+  stage: deploy
+  image: debian:stable
+  dependencies:
+    - build:production
+  variables:
+    GIT_STRATEGY: none
+  before_script:
+    - apt-get -qy update && apt-get -qy install rsync 
+    # Install ssh-agent if not already installed, it is required by Docker.
+    # (change apt-get to yum if you use a CentOS-based image)
+    - 'which ssh-agent || ( apt-get -y install openssh-client )'
+
+    # Run ssh-agent (inside the build environment)
+    - eval $(ssh-agent -s)
+
+    # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
+    - ssh-add <(echo "$SSH_PRIVATE_KEY")
+
+    # In order to properly check the server's host key, assuming you created the
+    # SSH_SERVER_HOSTKEYS variable previously, uncomment the following two lines
+    # instead.
+    - mkdir -p ~/.ssh
+    - '[[ -f /.dockerenv ]] && echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts'
+  script:
+    - |
+        for server in $PRODUCTION_SERVERS
+        do
+          rsync --delete -a --chown gitlabci:www-data public/. $server:/var/www/html/software.hifis.net/.
+        done
+  tags:
+    - internal
+  extends:
+    - .only_extension
diff --git a/.gitlab/issue_templates/add_event_announcement.md b/.gitlab/issue_templates/add_event_announcement.md
new file mode 100644
index 000000000..2a276ed95
--- /dev/null
+++ b/.gitlab/issue_templates/add_event_announcement.md
@@ -0,0 +1,98 @@
+/assign @erxleb87
+/label ~"Progress::ToDo"
+/label ~"Topic::Events"
+
+@software-hifis-net, please process this
+
+# Request to add an Event Announcement
+>>>
+  This template can be used by people who want to announce an event
+  related to the HIFIS Software Cluster.
+  This Issue will be resolved by a merge request adding the event.
+>>>
+
+## Required Information
+
+### Title
+>>>
+  A short title for the event
+>>>
+
+### Type
+>>>
+    A short word describing what kind of event this is,
+    e.g. "workshop", "seminar", "lecture", "discussion"
+>>>
+
+### Organizers
+>>>
+  A list of team members or associates who are to be contacted for
+  organisational questions
+>>>
+
+### Instructors
+>>>
+  A list of team members or associates who hold the workshop and are
+  responsible for content and didactics.
+>>>
+
+### Timeframe
+* Start:    YYYY-MM-DD, hh:mm
+* End:      YYYY-MM-DD, hh:mm
+
+# Location
+>>>
+  Check one. If you are not located on a main campus, please provide the
+  address of the sub-campus.
+>>>
+
+* [ ] AWI
+* [ ] DESY
+* [ ] DKFZ
+* [ ] DLR
+* [ ] FZJ
+* [ ] GFZ
+* [ ] HIDA
+* [ ] HMGU
+* [ ] HZB
+* [ ] HZDR
+* [ ] KIT
+* [ ] UFZ
+
+>>>
+    Please also fill in the room
+>>>
+
+* Room:
+
+### Participants
+
+>>>
+    Please add any relevant information about the targeted participants, 
+    if required
+>>>
+
+* Maximum number of participants:
+
+### Registration Link
+>>>
+    Provide a link for the registration and a start and end date for the
+    registration period.
+    The link should include the protocol; `mailto` is also possible.
+>>>
+
+* Registration Link:        url.to.registration.page
+* Registration open from:   YYYY-MM-DD
+* Registration open to:     YYYY-MM-DD
+
+### Content Description
+>>>
+    What topic is the workshop about?
+    Do participants need prior knowledge?
+    Should something be prepared before participating?
+>>>
+
+### Additional Information
+>>>
+    Provide additional information
+>>>
diff --git a/.gitlab/issue_templates/add_team_member.md b/.gitlab/issue_templates/add_team_member.md
new file mode 100644
index 000000000..fcfce1a08
--- /dev/null
+++ b/.gitlab/issue_templates/add_team_member.md
@@ -0,0 +1,113 @@
+/assign @erxleb87
+/assign @hueser93
+/label ~"Progress::ToDo"
+
+>>>
+The following will trigger a notification to the software.hifis.net core team (just to make sure)
+>>>
+
+@software-hifis-net Please add me as a member.
+
+# Request to add Team Member
+>>>
+This template can be used by people who want to be added as HIFIS Software team
+members but do not feel comfortable with manipulating YAML themselves.
+Just fill at least the required information.
+>>>
+
+## Required Information
+### Family Name(s)
+
+### First Name(s)
+
+### Academic Title
+>>>
+  If applicable.
+>>>
+
+### Organization
+>>>
+  Check one. If you are not located on a main campus, please provide the 
+  address of the sub-campus.
+>>>
+
+* [ ] AWI
+* [ ] DESY
+* [ ] DKFZ
+* [ ] DLR
+* [ ] FZJ
+* [ ] GFZ
+* [ ] HMGU
+* [ ] HZB
+* [ ] HZDR
+* [ ] KIT
+* [ ] UFZ
+
+### Position 
+>>>
+Short job description, e.g. Research Engineer
+>>>
+
+### Rank
+0 
+>>>
+  Used for sorting. Increase for every hierarchy level below you. 
+  Rough Guideline:
+  Team Member = 0
+  Team Leader = 1
+  Cluster Coordinator = 2
+  Platform Coordinator = 3
+>>>
+
+## Optional Information
+
+### Image
+>>>
+  Please also provide an image to be put on the new team member page to the 
+  actual assignee of this issue.
+  These are our recommendations which we check before we put the suggested
+  image online:
+  1. File size should not be more than 40 KByte
+  2. Image should be square with a preferred resolution of 400px x 400px
+  3. Common web formats like _jpeg_ or _png_ are preferred
+>>>
+
+### Office Location 
+>>>
+  On campus, used to refine the visitors/postal address
+  e.g. Building C, Room 314.
+>>>
+
+## Contacts
+>>>
+  Providing any contacts is optional.
+  A postal address of your campus will be provided as fallback.
+>>>
+
+### Email
+
+### Phone
+
+>>>
+In case you would like to provide a phone number please add the
+international calling code as well.
+>>>
+
+### SMS
+
+>>>
+Mobile phone numbers given here are used to open an SMS client
+directly on users' mobile phones.
+>>>
+
+### Fax
+
+### Messengers
+>>>
+  List the messenger name and contact link
+>>>
+
+### Social Platforms
+>>>
+  List the platform name and contact link
+>>>
diff --git a/.gitlab/issue_templates/blog-post.md b/.gitlab/issue_templates/blog-post.md
new file mode 100644
index 000000000..3340a00d0
--- /dev/null
+++ b/.gitlab/issue_templates/blog-post.md
@@ -0,0 +1,38 @@
+/assign me
+/label ~"blog post"
+
+# Blog Post Suggestion
+
+## Authors
+
+> Name the involved authors here, maybe suggesting contributors.
+> If you know their GitLab aliases, use @username to keep them
+> involved.
+
+## Reviewers
+
+> Who do you want as reviewers of your Blog Post?
+
+## Topic and Content
+
+> Outline what you want to write about.
+> Specify the style of your post (e.g. report, user story, guide, etc.).
+
+## Target Audience
+
+> Who is your blog post aimed at?
+> Should these people have previous knowledge or skills?
+
+## Publishing Date
+
+> When is your preferred date to publish your Blog Post?
+> 1. Add the date as text in this section
+> 2. Replace <date> in the quick action below with the date to generate an
+> automated entry in the GitLab Issue
+
+/due <date>
+
+## Contribution
+
+> How does the content of your Blog Post contribute to the goals of
+> HIFIS Software-Services?
-- 
GitLab