mirror of
https://github.com/dragonheim/gagent.git
synced 2025-01-17 23:06:27 -08:00
Rework of the actions.
Some checks failed
Some checks failed
This commit is contained in:
parent
f2b2cc705c
commit
9e167cdefe
3 changed files with 72 additions and 28 deletions
|
@ -1,5 +1,14 @@
|
|||
name: G'Agent Scan, Build, and Test
|
||||
# on: [push]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/**
|
||||
tags:
|
||||
- v*
|
||||
|
||||
env:
|
||||
SEMVAR: 0.0.11
|
||||
jobs:
|
||||
scan:
|
||||
runs-on: docker
|
||||
|
@ -8,26 +17,56 @@ jobs:
|
|||
steps:
|
||||
- run: apk add --no-cache nodejs npm
|
||||
- uses: actions/checkout@v4
|
||||
- run: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
- run: curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b /usr/local/bin
|
||||
- run: /usr/local/bin/trivy fs --no-progress --severity CRITICAL --exit-code 1 .
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: .cache/trivy
|
||||
key: tmp.woDBBj4Baw
|
||||
|
||||
- run: /usr/local/bin/trivy fs --no-progress --severity CRITICAL --cache-dir .cache/trivy --exit-code 1 .
|
||||
- run: /usr/local/bin/gosec -quiet ./...
|
||||
|
||||
build:
|
||||
|
||||
build_simple:
|
||||
needs: scan
|
||||
runs-on: docker
|
||||
container:
|
||||
image: dragonheim/golang:latest
|
||||
steps:
|
||||
- run: apk add --no-cache zeromq-dev build-base git
|
||||
- run: apk add --no-cache nodejs npm
|
||||
- run: apk add --no-cache zeromq-dev nodejs npm
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: go build -o gagent cmd/gagent/main.go
|
||||
- run: ./gagent --version
|
||||
- run: go build -o test_artifact cmd/hello/main.go
|
||||
- run: ./test_artifact --version
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: gagent
|
||||
path: gagent
|
||||
name: test_artifact
|
||||
path: test_artifact
|
||||
|
||||
test_simple:
|
||||
needs: build_simple
|
||||
runs-on: docker
|
||||
container:
|
||||
image: dragonheim/golang:latest
|
||||
steps:
|
||||
- run: apk add --no-cache nodejs npm
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: test_artifact
|
||||
|
||||
- run: chmod a+x test_artifact
|
||||
- run: ./test_artifact --version
|
||||
|
||||
build_image:
|
||||
needs: test_simple
|
||||
runs-on: docker
|
||||
container:
|
||||
image: dragonheim/golang:latest
|
||||
steps:
|
||||
- run: apk add --no-cache zeromq-dev nodejs npm
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: echo "${{ secrets.DOCKER_LOGIN }}" | docker login -u dragonheim2024 --password-stdin
|
||||
- run: docker buildx build --push -t dragonheim/gagent:test -f assets/docker/Dockerfile --build-arg SEMVER=${{ env.SEMVAR }} .
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
[![Go Report Card](https://goreportcard.com/badge/github.com/dragonheim/gagent)](https://goreportcard.com/report/github.com/dragonheim/gagent)
|
||||
[![Docker Pulls](https://img.shields.io/docker/pulls/dragonheim/gagent)](https://hub.docker.com/r/dragonheim/gagent/tags?page=1&ordering=last_updated)
|
||||
|
||||
A Golang based mobile agent system loosely inspired by the [Agent Tcl / D'Agents](http://www.cs.dartmouth.edu/~dfk/agents/) system created by Robert S. Gray of Dartmouth college.
|
||||
A Golang based mobile agent system loosely inspired by the [Agent Tcl / D'Agents](https://digitalcommons.dartmouth.edu/dissertations/62/) system created by Robert S. Gray of Dartmouth college.
|
||||
|
||||
Please note that this program is mostly meant to be used as a tool for me to learn software development in Go, and is not meant to be used in production environments.
|
||||
|
||||
|
|
|
@ -37,16 +37,17 @@ import (
|
|||
/*
|
||||
* Exit Codes
|
||||
* 0 Success
|
||||
* 1 Configuration file is missing or unreadable
|
||||
* 2 Setup failed
|
||||
* 3 Invalid mode of operation
|
||||
* 4 Agent file is missing or unreadable
|
||||
* 5 Agent is missing tags
|
||||
* 6 No routers defined
|
||||
* 7 No workers defined
|
||||
* 8 Agent not defined
|
||||
* 9 Agent hints / tags not defined
|
||||
* 10 Router not connected
|
||||
* 1 Environment variable parsing failed
|
||||
* 2 Configuration file is missing or unreadable
|
||||
* 3 Setup failed
|
||||
* 4 Invalid mode of operation
|
||||
* 5 Agent file is missing or unreadable
|
||||
* 6 Agent is missing tags
|
||||
* 7 No routers defined
|
||||
* 8 No workers defined
|
||||
* 9 Agent not defined
|
||||
* 10 Agent hints / tags not defined
|
||||
* 11 Router not connected
|
||||
*/
|
||||
|
||||
var environment struct {
|
||||
|
@ -80,7 +81,7 @@ func main() {
|
|||
|
||||
if len(config.Routers) == 0 {
|
||||
log.Printf("[ERROR] No routers defined.\n")
|
||||
os.Exit(6)
|
||||
os.Exit(7)
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
|
@ -116,7 +117,7 @@ func main() {
|
|||
|
||||
default:
|
||||
log.Printf("[ERROR] Unknown operating mode, exiting.\n")
|
||||
os.Exit(3)
|
||||
os.Exit(4)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
|
@ -132,7 +133,11 @@ func init() {
|
|||
versioninfo.AddFlag(nil)
|
||||
flag.Parse()
|
||||
cfg := environment
|
||||
env.Parse(&cfg)
|
||||
err := env.Parse(&cfg)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed to parse environment variables: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
filter := &logutils.LevelFilter{
|
||||
Levels: []logutils.LogLevel{"DEBUG", "INFO", "WARN", "ERROR"},
|
||||
|
@ -251,10 +256,10 @@ func init() {
|
|||
config.File = opts["--config"].(string)
|
||||
}
|
||||
|
||||
err := hclsimple.DecodeFile(config.File, nil, &config)
|
||||
err = hclsimple.DecodeFile(config.File, nil, &config)
|
||||
if err != nil && opts["setup"] == false {
|
||||
log.Printf("[ERROR] Failed to load configuration file: %s.\n", config.File)
|
||||
os.Exit(1)
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue