Tags

GitLab

GitLab is the open-source version of GitHub. Both are web-based git repositories that come with a whole bunch of project management tools such as a web-based UI, issue trackers, task managers, and continuous integration (CI).

Documentation

Local GitLab Installation - https://gitlab01.classe.cornell.edu/

A local installation of the Community Edition (CE) of GitLab is available to use by anyone with a CLASSE account. Just log in with your CLASSE credentials and you will have a profile automatically set up. You can immediately begin creating projects or contributing to other projects.

https://gitlab01.classe.cornell.edu/

Create a Project

If you've already used GitHub, you know how to use GitLab. If you're new to GitLab, just go create a new project and you will immediately see the basic steps you need to get started.

Please see How To Create A Project for more information.

Issues

You can create issues in a project to keep track of feature requests, bug reports, or any other questions or problems you might have.

GitLab Issues documentation: https://gitlab01.classe.cornell.edu/help/user/project/issues/index.md
  1. Login to https://gitlab01.classe.cornell.edu/
  2. Click on your desired project
  3. Click the Issues tab
  4. Click the New Issue button
  5. Give the issue a title and if desired add details
  6. Click the Submit button

There are many other options for labelling the issue, etc. But the above steps are all that is required.

CLASSE-IT will receive an email notification every time an Issue is submitted and updated.

Depending on your settings, you will also receive email notifications when the issue is updated.

Screen Shot 2021-07-30 at 9.39.06 AM.pngScreen Shot 2021-07-30 at 9.43.30 AM.png

Continuous Integration (CI)

In its most basic sense, CI is an automated process of building, testing, (and if the tests pass) deploying code.

If you would like to use GitLab's Continuous Integration feature, add your project to the GitLab Runner. If you do not have permissions to do so, contact CLASSE-IT and we will assist you.

The project may also need permissions changed in order to use Pipelines. Within the project got to Settings -> Permissions and check that Pipelines is enabled.

.gitlab-ci.yml configuration file

The main thing you'll need to get CI running is a .gitlab-ci.yml configuration file committed to the root directory of your project. This file can be created right in GitLab itself. Once you create this file, GitLab will tell you if it's valid or not. Once it is, and this file has been committed the first Pipeline job should run.

Example file:
stages:
  - build
  - deploy

variables:
    APP_NAME: "CHESS Inventory DB"
    DEV_HOST: "glassfish-dev"
    DEV_URL: "https://testwww.classe.cornell.edu/chess-inventory-db/"
    PROD_HOST: "glassfish"
    PROD_URL: "https://www.classe.cornell.edu/chess-inventory-db/"
    USER: "gfish"
    CI_DEBUG_TRACE: "true"

build:
    stage: build
    script:
        - env
        - ./gradlew clean build --version
        - ./gradlew war
        - "echo workspace: $PWD"
        - ls $PWD/build/libs
    artifacts:
        paths:
        - build/libs/*.war
        expire_in: 1 week

deploy_staging:
    stage: deploy
    script:
        - "echo deploying $APP_NAME to Dev environment"
        - "echo host: $DEV_HOST"
        - "echo url: $DEV_URL"
        - /nfs/classe/glassfish/bin/asadmin --user $USER --passwordfile /nfs/classe/glassfish-dev/glassfish/domains/domain1/config/.passwordfile --host $DEV_HOST deploy --force=true $PWD/build/libs/chess-inventory-db.war
    environment:
        name: staging
        url: https://testwww.classe.cornell.edu/chess-inventory-db
    only:
    - master

GitLab Project Settings

You may need to change a project's CI/CD setting in order for the build to work correctly. Working projects have the following set to "blank":

From the project page: Settings -> CI/CD -> General Pipelines -> git fetch -> Git shallow clone

Resources

Topic revision: r6 - 30 Jul 2021, DevinBougie
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback