Gitlab include draftsman in golang

Gitlab include draftsman

WIP

Утилита, которая рисует graph include'ов из gitlab-ci

Как работает пока:

  • Считывает из app.env файла(который должен быть в корне) переменные в формате:
TMP_DIR="tmpСonfig"
GITLAB_HOST="gitlab.com"
GITLAB_TOKEN=""
PROJECT_PATH="project/gitlab-include"
REF="master"
GITLAB_CI_FILE=".gitlab-ci.yml"

Где всё понятно и только TOKEN нужно в gitlab'e создать, нужны ro права на gitlab api, переменные окружения тоже стягивает, они имеют приоритет

Билд приложения:

go build -a -o ./draftsman ./ 

Запуск приложения:

╭─~/go/src/draftsman ‹master*› 
╰─$ ./draftsman download --help          
Download gitlab-ci config files

Usage:
  draftsman download [flags]

Flags:
  -h, --help   help for download

Global Flags:
      --config string   config file (default is $HOME/.draftsman.yaml)
      
 
╭─~/go/src/draftsman ‹master*› 
╰─$ ./draftsman --config app.env download
Using config file: app.env
Downloading:  tmpСonfig/111/.gitlab-ci.yml
Start parse file: tmpСonfig/111/.gitlab-ci.yml
Downloading:  tmpСonfig/111/project_include.yml
Start parse file: tmpСonfig/111/project_include.yml
Downloading:  tmpСonfig/222/.gitlab-ci.yml
Start parse file: tmpСonfig/222/.gitlab-ci.yml
graph TD;
test-gitlab-include/.gitlab-ci.yml/master --> test-gitlab-include/project_include.yml/master;
test-gitlab-include/project_include.yml/master --> test-get-raw-job/.gitlab-ci.yml/master;
test-gitlab-include/project_include.yml/master --> iac/ci/envs.yml/master;
test-gitlab-include/project_include.yml/master --> infrastructure/terraform/ci/create-release.yml/master;
test-gitlab-include/.gitlab-ci.yml/master --> iac/ci/envs.yml/master;
test-gitlab-include/.gitlab-ci.yml/master --> infrastructure/terraform/ci/create-release.yml/master;

graph.png

Owner
Roman Mironov
DevOps at rabota.ru
Roman Mironov
Similar Resources

A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

TEMPORARY REPOSITORY This repo will exist only temporarily waiting for the PR has been merged.

Nov 5, 2021

🤖 Prune old images on GitHub (ghcr.io) and GitLab (registry.gitlab.com) container registry

🤖 Prune old images on GitHub (ghcr.io) and GitLab (registry.gitlab.com) container registry

✨ Prune container images in a CLI way ✨ Prune old images on GitHub (ghcr.io) and GitLab (registry.gitlab.com) Container Registry Getting Started | Des

Dec 15, 2022

Cfginterpolator is an interpolate library in golang allowing to include data from external sources in your configuration

cfginterpolator cfginterpolator is an interpolate library in golang allowing to include data from external sources in your configuration cfginterpolat

Dec 14, 2021

Include files in your binary the easy way

New Projects should use the official embed package instead, which was added in go 1.16. binclude binclude is a tool for including static files into Go

Dec 18, 2022

upload to gdrive include shared drive

gdrive_uploader upload to gdrive include shared drive How to get go get github.com/heat1024/gdrive_uploader About credential You must set your client

Oct 6, 2022

Tool to modify Snapmaker laser GCode for a rotary module to include z movements

lasery2z Tool to modify Snapmaker laser GCode for a rotary module to include z movements. Background Snapmaker's Luban tool to generate 4D laser proje

Sep 13, 2021

Simple tool that updates Visual Studio Code workspace(s) to include Go modules in gopath/src, then launches VSCode if only one modified.

Simple tool that updates Visual Studio Code workspace(s) to include Go modules in gopath/src, then launches VSCode if only one modified.

Jan 27, 2022

A general purpose golang CLI template for Github and Gitlab

golang-cli-template A general purpose project template for golang CLI applications This template serves as a starting point for golang commandline app

Dec 2, 2022

A CVE-2021-22205 Gitlab RCE POC written in Golang

Golang-CVE-2021-22205-POC A bare bones CVE-2021-22205 Gitlab RCE POC written in Golang which affects Gitlab CE/EE 13.10.3 Gitlab CE/EE 13.9.6 Gitl

Jul 4, 2022

Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more

Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more

ghorg ghorg allows you to quickly clone all of an orgs, or users repos into a single directory. This can be useful in many situations including Search

Jan 1, 2023

:fishing_pole_and_fish: Webhook receiver for GitHub, Bitbucket, GitLab, Gogs

Library webhooks Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket and GitLab Webhook Events Features: Parses the entire pay

Jan 4, 2023

MOVED TO GITLAB

MOVED TO GITLAB

blanket blanket is a tool that helps you catch functions which don't have direct unit tests in your Go packages. Installation go get -u gitlab.com/ver

Nov 27, 2022

Display last GitLab project git commit. Page is optimized for an e-paper device.

Display last GitLab project git commit. Page is optimized for an e-paper device.

git-on-epaper A gitlab webhook for push notifications on a project. The webhook serves a HTML that shows the last push on the project with the followi

Dec 12, 2022

An open source gitlab linting utility

gitlab-lint API and collector An open source gitlab linting utility Frontend https://github.com/globocom/gitlab-lint-react How to install Install depe

Oct 31, 2022

⚡️ A lightweight service that will build and store your go projects binaries, Integrated with Github, Gitlab, Bitbucket and Bitbucket Server.

⚡️ A lightweight service that will build and store your go projects binaries, Integrated with Github, Gitlab, Bitbucket and  Bitbucket Server.

Rabbit A lightweight service that will build and store your go projects binaries. Rabbit is a lightweight service that will build and store your go pr

Nov 19, 2022

Ah shhgit! Find secrets in your code. Secrets detection for your GitHub, GitLab and Bitbucket repositories: www.shhgit.com

Ah shhgit! Find secrets in your code. Secrets detection for your GitHub, GitLab and Bitbucket repositories: www.shhgit.com

shhgit helps secure forward-thinking development, operations, and security teams by finding secrets across their code before it leads to a security br

Dec 23, 2022

A command-line tool for gitlab

A command-line tool for gitlab

Lab A fuzzy finder command line tool for gitlab. 中文文档 Feature lab sync Sync gitlab projects lab browser Fuzzy find gitlab repo and open it

Nov 28, 2022

Small and easy server for web-hooks to deploy software on push from gitlab/github/hg and so on

Deployment mini-service This mini web-server is made to deploy your code without yaml-files headache. If you just need to update your code somewhere a

Dec 4, 2022

🏯 Monitor your (gitlab/github) CI/CD pipelines via command line interface with fortress

🏯 Monitor your (gitlab/github) CI/CD pipelines via command line interface with fortress

__ _ / _| | | | |_ ___ _ __| |_ _ __ ___ ___ ___ | _/ _ \| '__| __| '__/ _ \/ __/ _

Mar 31, 2022
Comments
  • Add support for list of simple includes

    Add support for list of simple includes

    Includes can be without any specification - whether it is local or remote or template. In this case it should work as local includes.

    ❯ head -n5 .gitlab/.gitlab-ci.yml
    include:
      - '.gitlab/.gitlab-ci-helm.yml'
      - '.gitlab/.gitlab-ci-ansible.yml'
      - '.gitlab/.gitlab-ci-terraform.yml'
      - '.gitlab/.gitlab-ci-docker.yml'
    
    ❯ ./draftsman generate
    Downloading:  113/.gitlab/.gitlab-ci.yml
    Start parse file: 113/.gitlab/.gitlab-ci.yml
    2021/10/11 15:52:31 parsing error: yaml: unmarshal errors:
      line 2: cannot unmarshal !!str `.gitlab...` into draftsman.IncludeLocation
      line 3: cannot unmarshal !!str `.gitlab...` into draftsman.IncludeLocation
      line 4: cannot unmarshal !!str `.gitlab...` into draftsman.IncludeLocation
      line 5: cannot unmarshal !!str `.gitlab...` into draftsman.IncludeLocation
    

    I think the best way is to create UnmarshalYAML method for the IncludeLocation struct to make decision which struct this include unmarshal to - https://github.com/go-yaml/yaml/blob/v2.4.0/yaml.go#L32

  • Add support for wildcard local includes

    Add support for wildcard local includes

    https://docs.gitlab.com/ee/ci/yaml/#includelocal-with-wildcard-file-paths

    I guess the only way to resolve is to clone whole repository and use filepath.Glob on the pattern

Related tags
A Git RPC service for handling all the git calls made by GitLab
A Git RPC service for handling all the git calls made by GitLab

Quick Links: Roadmap | Want to Contribute? | GitLab Gitaly Issues | GitLab Gitaly Merge Requests | Gitaly is a Git RPC service for handling all the gi

Nov 13, 2021
Sync tags in your git repository and a changelog in Keep a Changelog format with releases of your GitLab project.

Automatic GitLab releases Sync tags in your git repository and a changelog in Keep a Changelog format with releases of your GitLab project. Features:

Nov 12, 2022
Tfcmt-gitlab is a CLI command to parse and notify Terraform execution results

Tfcmt-gitlab is a CLI command to parse and notify Terraform execution results. This command supports GitLab as a CI and notification platform.

Dec 23, 2022
A really smart bot that connects with your email, discord, telegram and gitlab
A really smart bot that connects with your email, discord, telegram and gitlab

SmarttyBot The smartest multiplatform bot SmarttyBot is a multiplatform bot that uses natural language to execute functions using discord, telegram, e

Jun 2, 2022
CHANGELOG generator implemented in Go (Golang).
CHANGELOG generator implemented in Go (Golang).

git-chglog CHANGELOG generator implemented in Go (Golang). Anytime, anywhere, Write your CHANGELOG. Table of Contents git-chglog Table of Contents Fea

Jan 7, 2023
ReGit: A Tiny Git-Compatible Git Implementation written in Golang

ReGit is a tiny Git implementation written in Golang. It uses the same underlying file formats as Git. Therefore, all the changes made by ReGit can be checked by Git.

Oct 31, 2022
An open-source GitLab command line tool bringing GitLab's cool features to your command line
An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Dec 30, 2022
A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

go-gitlab A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way NOTE Release v0.6.0 (released on 25-08-2017) no

Jan 6, 2023
A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way

Dec 28, 2022
Gitlab Command to simplify some Gitlab Workflow

GitLabCommand - glc - README How to use ? ensure glc.yaml is configured with the valid token and url gitlab_token: <your valid token> gitlab_url: ht

Oct 14, 2021