Skip to content

Harbormaster-AI/gitlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Harbormaster Project Acceleration For GitLab

The contained GitLab configuration file (.gitlab-ci.yml) is a simple, yet powerful way to leverage Harbormaster and GitLab to automate the generation of an MVP-quality project built on, tested, contained and deployed through your GitLab CI/CD pipeline.

This repository also contains sample Harbormaster project generation YAML files. These instructions will reference the Django project file (django-project-as-code.yaml)

To take a quick test drive, follow the instructions in the Quick Start section or skip to the Step-By-Step section to generate an application using more customized inputs.

Quick Start

Use this section to make the least amount of changes to see Harbormaster project generation in action.

1.) Git Clone this project in one of two ways:

SSH - git@github.com:Harbormaster-AI/gitlab.git HTTPS - https://github.com/Harbormaster-AI/gitlab.git

2.) Edit the git section of /samples/yamls/project.as.code/django-project-as-code.yml to set your GitLab username and password. Leave the password blank if you assigned a Person Token and applied it to your account at platform.harbormaster.ai

3.) Create a GitLab repository by the name of django_repo.

4.) Create a GitLab pipeline that is connected to the GitLab django_repo

5.) Commit your changes to this project to the django_repo and observe the GitLab pipeline status.

6.) Once the job in the pipeline is complete, check its status. A project will have been generated using a default model and a Django tech stack.

The project will eventually be built and tested with results as below:

alt text

Step-By-Step Project Generation

Step 1 - Clone This Project

Clone this project in one of two ways:

SSH - git@github.com:Harbormaster-AI/gitlab.git HTTPS - https://github.com/Harbormaster-AI/gitlab.git

Step 2 - Make Changes

HARBORMASTER__API__TOKEN

It is important you register @ harbormaster.ai in order to obtain an API token.
Once you have this token, assign it to an environment variable named

HARBORMASTER__API__TOKEN

Learn more about assign environment variables here

PROJECT_YAML_FILE:

This YAML file contains the directives required to generate a project including:

  • model identifier (by name, id or file_path)
  • tech stack (by name or id),
  • application options (name, description, author, etc..)
  • GitLab repo settings,
  • Docker settings
  • and more....

See an example here

PROJECT_YAML_FILE: "samples/yamls/project.as.code/django-project-as-code.yml"

GitLab Credentials

Modify the git: section of the a Project-As-Code YAML file (e.g. django-project-as-code.yml) to assign your GitLab credentials

AWS Credentials

Note: If using one of the AWS Lambda stacks, you will have to assign the access key and secret key as project level environment variables. See https://gitlab.com/help/ci/variables/README#variables for more details. Be sure to name the accesskey USER_AWS_ACCESSKEY and name the secretkey USER_AWS_SECRETKEY. Equally important, make sure you have the correct policies assigned for the related user (AWSCodeDeployRoleForLambda, AWSLambdaExecute, AWSLambdaRole, etc..)

Step 3 - Create a Repository For Generated Project files

Create a GitLab project repository (Repo A) for the generated project files. This repository name must be the name you assigned in the GIT section of the PROJECT_YAML_FILE (e.g. django-project-as-code.yml).

Step 4 - Create a Project For This Cloned Project

Create another GitLab project repository (Repo B) and commit this project to it. Any name will do. You are committing the modified .gitlab-ci.yml file along with the PROJECT_YAML_FILE discussed above. Only the .gitlab-ci.yml must be in the root.

Step 5 - Commit Your Project

Upon committing this project to Repo B, the .gitlab-ci.yml should begin running within a bound GitLab pipeline. The project is now being generated by Harbormaster.

alt text

Step 6 - Watch Pipeline Execution

Upon completion of Step 5, Harbormaster will commit all generated project files to Repo A. This should cause a GitLab pipeline to run the generated .gitlab-ci.yml file. The generated project is now being built and tested.

alt text

Congratulations!

Using the power of GitLab and Harbormaster you just generated, built, tested, and (optionally) contained an entire application complete with core capabilities, build file, CI/CD config, and much more....

Best of luck in completing the application!

About

Run Harbormaster via Gitlab config YAML pipeline

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published