Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
vultj committed Jul 10, 2024
0 parents commit 19471eb
Show file tree
Hide file tree
Showing 3,715 changed files with 1,539,404 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: gomod # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
26 changes: 26 additions & 0 deletions .github/workflows/go-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Checks

on:
push:
pull_request:

jobs:
Golangci-Lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.22"
- run: go version

- name: Install dependencies
run: |
go version
go install github.com/golangci/golangci-lint/cmd/[email protected]
- name: Run golangci-lint
run: |
golangci-lint run cmd/...
golangci-lint run metrics/...
18 changes: 18 additions & 0 deletions .github/workflows/notify-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: notify-issue

on:
issues:
types: [opened]

jobs:
issue:
runs-on: ubuntu-latest
name: New Issue Notification
steps:
- run: |
echo "{\"text\":\"v-agent : New Issue https://github.com/vultr/v-agent/issues/${{ github.event.issue.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
16 changes: 16 additions & 0 deletions .github/workflows/notify-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: notify-pr

on: pull_request_target

jobs:
pr:
runs-on: ubuntu-latest
name: Pull Request Notification
steps:
- run: |
echo "{\"text\":\"v-agent : PR https://github.com/vultr/v-agent/pull/${{ github.event.number }} \"}" > mattermost.json
- uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON: ${{ secrets.MATTERMOST_ICON }}
88 changes: 88 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "Automatic Releaser"

on:
push:
branches:
- master

permissions:
contents: write

jobs:
check-commit:
runs-on: ubuntu-latest
outputs:
msg_check: ${{ steps.check-msg.outputs.match }}
steps:
- name: Check Message
id: check-msg
run: |
pattern="^Release v[0-9]+.[0-9]+.[0-9]+ #(minor|major|patch)( \(#[0-9]+\))?$"
if [[ "${{ github.event.head_commit.message }}" =~ ${pattern} ]]; then
echo match=true >> $GITHUB_OUTPUT
fi
create-tag:
runs-on: ubuntu-latest
if: needs.check-commit.outputs.msg_check == 'true'
needs: check-commit
outputs:
new_tag: ${{ steps.tagger.outputs.new_tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Bump version and push tag
id: tagger
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: "none"

goreleaser:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22

- name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login https://ewr.vultrcr.com/vagent -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
distribution: goreleaser
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.CR_PAT }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

release:
runs-on: ubuntu-latest
needs: ["goreleaser", "create-tag"]
name: Release Notification
steps:
- uses: mattermost/[email protected]
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON_URL: ${{ secrets.MATTERMOST_ICON }}
TEXT: "${{ github.repository }} : Release https://github.com/${{ github.repository }}/releases/tag/${{ needs.create-tag.outputs.new_tag }}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/v-agent
/v-proxy
/dist
71 changes: 71 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
issues:
exclude-use-default: false

linters-settings:
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
golint:
min-confidence: 0
gomnd:
checks:
- argument
- case
- condition
- return
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
maligned:
suggest-new: true
misspell:
locale: US

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- bodyclose
- dogsled
- errcheck
- exportloopref
- gochecknoinits
- gocritic
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

run:
timeout: 5m
83 changes: 83 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
version: 2

before:
hooks:
- go mod download
- go generate ./...

builds:
- id: v-agent
main: ./cmd/v-agent/main.go
binary: v-agent
env:
- CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath #removes all file system paths from the compiled executable
goos:
- linux
goarch:
- amd64
- arm64

dockers:
- dockerfile: cmd/v-agent/Dockerfile.goreleaser
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
image_templates:
- "ewr.vultrcr.com/vagent/v-agent:latest-amd64"
- "ewr.vultrcr.com/vagent/v-agent:{{ .Tag }}-amd64"
extra_files:
- "cmd/v-agent/config.yaml"
- dockerfile: cmd/v-agent/Dockerfile.goreleaser
use: buildx
goarch: arm64
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"
image_templates:
- "ewr.vultrcr.com/vagent/v-agent:latest-arm64"
- "ewr.vultrcr.com/vagent/v-agent:{{ .Tag }}-arm64"
extra_files:
- "cmd/v-agent/config.yaml"

docker_manifests:
- name_template: 'ewr.vultrcr.com/vagent/v-agent:latest'
image_templates:
- 'ewr.vultrcr.com/vagent/v-agent:latest-amd64'
- 'ewr.vultrcr.com/vagent/v-agent:latest-arm64'
- name_template: 'ewr.vultrcr.com/vagent/v-agent:{{ .Tag }}'
image_templates:
- 'ewr.vultrcr.com/vagent/v-agent:{{ .Tag }}-amd64'
- 'ewr.vultrcr.com/vagent/v-agent:{{ .Tag }}-arm64'

archives:
- id: v-agent
builds:
- v-agent
format: zip
files:
- README.md
- src: cmd/v-agent/config.yaml
strip_parent: true
name_template: "v-agent_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"

checksum:
name_template: "checksums.txt"
algorithm: sha256
ids:
- v-agent

blobs:
- provider: s3
endpoint: https://tartarus.vultr.dev
region: us-midwest-1
bucket: vke-bins
ids:
- v-agent
directory: "v-agent/v{{.Version}}/"

release:
draft: false
Loading

0 comments on commit 19471eb

Please sign in to comment.