Skip to content

Commit

Permalink
fix codeclimate issues
Browse files Browse the repository at this point in the history
adds gitlab tutorial for users
  • Loading branch information
prasadtalasila committed Dec 19, 2024
1 parent 7e35af6 commit e0055f9
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ exclude_patterns:
- "client/config/"
- "deploy/config/client/env*.js"
- "files/"
- "CODE_OF_CONDUCT.md"
- "CONTRIBUTING.md"
- "LICENSE.md"
- ".github/ISSUE_TEMPLATE/"
- "docs/developer/conduct.md"
3 changes: 1 addition & 2 deletions docs/admin/gitlab/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ should be available at <https://foo.com/gitlab>.

**NOTE**: The GitLab instance operates with the `dtaas-frontend` network, which
requires the DTaaS server to be running before you start it. You may refer to secure
installation scenarios
(../overview.md) for the same.
[installation scenarios](../overview.md) for the same.

The commands to start and stop the instance are:

Expand Down
3 changes: 3 additions & 0 deletions docs/admin/gitlab/runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ A list of advanced configuration options is provided on the
You may use the following commands to start and stop the `gitlab-runner`
container respectively, depending on your installation scenario:

1. Go to the DTaaS home directory (`DTaaS_DIR`) and execute one of
the following commands.

1. Localhost Installation

```bash
Expand Down
4 changes: 2 additions & 2 deletions docs/developer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ environment.

### DevContainers

There is a [devcontainer configuration](.devcontainer/devcontainer.json)
There is a devcontainer configuration (`.devcontainer/devcontainer.json`)
for the project. Please use it to get a dockerized development environment.
DevContainer is the easiest way to get started.

Expand All @@ -35,7 +35,7 @@ DevContainer is the easiest way to get started.
The code base has been developed for most part on
Ubuntu/Linux Operating System.Thus certain parts of the code base might
have bugs when run on Windows. At the moment, only
[runner](./servers/execution/runner/DEVELOPER.md) has problems running
[runner](../user/servers/execution/runner/README.md) has problems running
on non-Linux OS.

The development environment can be installed by using the following
Expand Down
13 changes: 7 additions & 6 deletions docs/user/digital-twins/devops/file-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,19 @@ looks like this:

```text
hello_world/
├── lifecycle/
├── lifecycle/ (at least one lifecycle script)
│ ├── clean
│ ├── create
│ ├── execute
│ └── terminate
├── .gitlab-ci.yml
└── description.md
├── .gitlab-ci.yml (Gitlab DevOps config for executing lifecycle scripts)
└── description.md (optional but is recommended)
└── README.md (optional but is recommended)
```

The `lifecycle` directory contains four files - `clean`, `create`, `execute`
and `terminate`, which are executable scripts. The `hello-world` example uses
simple [BASH scripts](https://www.gnu.org/software/bash/).
The `lifecycle` directory here contains four files - `clean`, `create`,
`execute` and `terminate`, which are simple
[BASH scripts](https://www.gnu.org/software/bash/).
These correspond to stages in a digital twin's lifecycle.
Further explanation of digital twin is available on
[lifecycle stages](../lifecycle.md).
Binary file added docs/user/gitlab/create-PAT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/gitlab/create-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/gitlab/repo-ownership.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 78 additions & 0 deletions docs/user/gitlab/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Working with Gitlab

The DTaaS relies on Gitlab for two purposes.

1. OAuth2 authorisation service
1. DevOps service

The [admin](../../admin/overview.md) documentation covers
the OAuth2 authorisation configuration.
This guide covers the use of git commands and project structure
for Gitlab DevOps service inside the DTaaS.

## Preparation

The first step is to create a gitlab project with *username*
in gitlab user group named *dtaas*.

![Gitlab project create](./create-repo.png)

This user needs to have ownership permissions over the project.

![Project ownership](./repo-ownership.png)

## Git commands

The usual git commands and workflows should be used. There are two ways to
use Gitlab project as a remote git server.

1. Over SSH using personal SSH key
1. Over HTTPS using
[personal access tokens (PAT)](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)

This tutorial shows use of PAT for working with Gitlab server.

First step is to create PAT.

![Create PAT](create-PAT.png)

Copy this token and use it to clone the git repository.

## Library Assets

The Gitlab is used to store the reusable **Library**
assets of all users.
There is a [mandatory structure](../servers/lib/assets.md) for storing and
using Library assets including digital twins. A properly initialised
gitlab project should have the following structure.

![Project structure](./user-repo.png)

Please pay special attention to `.gitlab-ci.yml`. It must be a valid
Gitlab DevOps configuration. You can also check
[example repo](https://gitlab.com/dtaas/user1) for a sample structure.

For example, with `PAT1` as PAT of
`dtaas/user1` repository, the command to clone the repository is

```sh
$git clone https://user1:[email protected]/gitlab/dtaas/user1.git
$cd user1
```

Add the required Library assets and then

```sh
$git push origin
```

## Next Steps

Remember to have a [gitlab runner](../../admin/gitlab/runner.md) integrated
with your project repository. There might already be some runners installed
with your DTaaS application. You can check them on the runners page.
In addition, you can install your
[own runners](../../admin/gitlab/runner.md) integrated into your repository.

Now, the [Digital Twins Preview](../digital-twins/devops/ui.md) can be used
to access the DevOps features of the DTaaS platform.
Binary file added docs/user/gitlab/user-repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nav:
- DevOps Preview:
- Digital Twin Structure: user/digital-twins/devops/file-structure.md
- User Interface: user/digital-twins/devops/ui.md
- Gitlab Tutorial: user/gitlab/tutorial.md
- Runner: user/servers/execution/runner/README.md
- Examples:
- Overview: user/examples/index.md
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nav:
- DevOps Preview:
- Digital Twin Structure: user/digital-twins/devops/file-structure.md
- User Interface: user/digital-twins/devops/ui.md
- Gitlab Tutorial: user/gitlab/tutorial.md
- Runner: user/servers/execution/runner/README.md
- Examples:
- Overview: user/examples/index.md
Expand Down
12 changes: 6 additions & 6 deletions servers/lib/DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ apollo-path: '/lib'
graphql-playground: 'true'
git-repos: #only used in git mode
- user1:
- user1:
repo-url: 'https://gitlab.com/dtaas/user1.git'
- user2:
- user2:
repo-url: 'https://gitlab.com/dtaas/user2.git'
- common:
- common:
repo-url: 'https://gitlab.com/dtaas/common.git'
```

Expand All @@ -97,11 +97,11 @@ A fragment of the config for `git` mode is:
```yaml
...
git-repos:
- user1:
- user1:
repo-url: 'https://gitlab.com/dtaas/user1.git'
- user2:
- user2:
repo-url: 'https://gitlab.com/dtaas/user2.git'
- common:
- common:
repo-url: 'https://gitlab.com/dtaas/common.git'
```

Expand Down
12 changes: 6 additions & 6 deletions servers/lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ apollo-path: '/lib'
graphql-playground: 'true'

git-repos: #only used in git mode
- user1:
- user1:
repo-url: 'https://gitlab.com/dtaas/user1.git'
- user2:
- user2:
repo-url: 'https://gitlab.com/dtaas/user2.git'
- common:
- common:
repo-url: 'https://gitlab.com/dtaas/common.git'
```
Expand All @@ -80,11 +80,11 @@ A fragment of the config for `git` mode is:
```yaml
...
git-repos:
- user1:
- user1:
repo-url: 'https://gitlab.com/dtaas/user1.git'
- user2:
- user2:
repo-url: 'https://gitlab.com/dtaas/user2.git'
- common:
- common:
repo-url: 'https://gitlab.com/dtaas/common.git'
```

Expand Down
2 changes: 1 addition & 1 deletion servers/lib/config/libms.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ git-repos: #only used in git mode
repo-url: 'https://gitlab.com/dtaas/user1.git'
- user2:
repo-url: 'https://gitlab.com/dtaas/user2.git'
- common:
- common:
repo-url: 'https://gitlab.com/dtaas/common.git'
2 changes: 1 addition & 1 deletion servers/lib/config/libms.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ git-repos: #only used in git mode
repo-url: 'https://gitlab.com/dtaas/user1.git'
- user2:
repo-url: 'https://gitlab.com/dtaas/user2.git'
- common:
- common:
repo-url: 'https://gitlab.com/dtaas/common.git'

0 comments on commit e0055f9

Please sign in to comment.