axectl

command module
v0.0.0-...-0281767 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

axectl

+--------------------------------------------------+
|                                                  |
|              .dx:.                               |
|             cO00Ok;                              |
|           .x00OOOkkx.                            |
|          .d00OOOkkkxl                            |
|         :kOOOOkkkxl;'                            |
|      .l00OOOkkkxd:;cc'                           |
|    'd00OOOOkkkdc',:lol,                          |
|  ,d000OOOkkkxd,..',:loo:                         |
|.d000OOOkkkxxxl   ..,:codl.                       |
|xO0OOOkkkxxxxd,      .;cldo;                      |
|:kkOOkkkxxxddo.        ':codl'                    |
| ;xxkkxxxdddd:          .,:lddl.                  |
|  .cxddddddoo.            .;codd;                 |
|    .:ddooooc               ':lddl'               |
|       .,clo,                .,coddc.             |
|                               .:lddo,.           |
|                                 ,clddl,          |
|                                  .;lodo:.        |
|                                    ,clddl,       |
|                                     .;codoc.     |
|                                       ':lddo:.   |
|                                        .;codoc,  |
|                                         .,:lool:.|
|                                           .;cloo:|
|                                            .,:c;.|
|                                                  |
|                                                  |
+--------------------------------------------------+

Index

  1. Description
  2. Build project
  3. Sonar
    1. What it does?
  4. Examples
  5. Sconar Scanner
  6. Add to path
  7. TODO

This is the introduction

Some introduction text, formatted in heading 2 style

Some paragraph

The first paragraph text

Description

axectl is a set of DevOps/SRE tools for developers, we can create different commands to abstract manual tasks.

This tool is written in Go with the cobra framework.

As result of the project, we obtain a binary which can be compiled for the different platforms and architectures.


Build project

To build the project from your side, you need Go installed in your computer, and execute:

Remember to check your OS and your architecture.

mkdir -p ./bin
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./bin/axectl ./

Or you can go to the releases page.


Sonar

axectl has the command sonar which allows you to setup and configure a SonarQube in your local dev env.

This command is an abstraction to setup and configure the project in SonarQube.

What it does?

The CLI with the command sonar uses docker and docker-compose to create the resources needed.

Some features are:

  • Use three docker containers:SonarQube, PostgreSQL and sonar-scanner.
    • SonarQube -> server
    • PostgreSQL -> database engine
    • sonar-scanner -> tool from Sonar to analyse the code
  • The tool axectl communicates to the SonarQube API to create the projects and the tokens automatically, the tokens are store in the path ~/.axectl/sonar/token
  • axectl has the flag -i which install the needed requirements for you, the requirements are:
    • docker
    • docker-compose
  • The flag -i also add your user to the Docker group.
  • It asks you to restart your computer for changes to take effect.
Examples
  • Install requirements, this step install all the requirements to run Docker and the sonar-scanner in your computer. features
  • After the installation, you will be prompt to restart your computer, this is because is needed after add your user to the Docker group source
axectl sonar -i
  • Start the service, creating the projects and scan them
axectl sonar -s -c --scan -p "someProject" -o "someOrganization"
  • Start the service
axectl sonar -s -p "someProject" -o "someOrganization"
  • Start the service creating the projects
axectl sonar -s -c -p "someProject" -o "someOrganization"
  • Check the status of the service
axectl sonar --status 
  • Start the SonarQube service
axectl sonar -s

Sonar-scanner Docker

You can execute the following command in order to run the analysis directly.

docker run \
      --rm \
      --network=host \
      -e SONAR_HOST_URL="http://sonarqube:9000" \
      -v $PWD:/usr/src sonarsource/sonar-scanner-cli \
      -Dsonar.projectKey=axectl \
      -Dsonar.sonar.projectName=axectl \
      -Dsonar.sonar.projectVersion=1.0 \
      -Dsonar.scm.disabled=true \
      -Dsonar.sources=./ \
      -Dsonar.sonar.host.url=http://sonarqube:9000 \
      -Dsonar.login=`+token

Add to path

You can easily execute axectl anywhere adding the binary to some path that you have configured in your $PATH.

You can use for instance the path: /usr/bin/

Execute the command:

sudo cp ./axectl /usr/bin/

TODO

  • Install dependencies
  • Start all the containers
  • Check containers status
  • Generate project in Sonar
  • Generate token for project
  • Create config path
    • Create tokens inside the config path
    • List tokens
    • Delete tokens
    • Delete all resources created
  • Setup debug argument
  • Update release from the CLI
  • Remove installation packages for sonar-scanner
  • Refactor
  • Flag to specify the code coverage file

Jose Ramon Mañes

Documentation

Overview

Copyright © 2021 Jose Ramon Mañes jr.mb47@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL