Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate #12: moving to golang #15

Merged
merged 42 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bcfb61e
migrate #12: moving to golang
donkeyx Aug 14, 2023
0a7bd17
migrate #12: moving to golang
donkeyx Aug 14, 2023
56d0622
migrate #12: adding github actions for auto build
Aug 15, 2023
3985175
migrate #12: comment out the go package push for the moment
Aug 15, 2023
76191b8
migrate #12: more cleanup still in progress though
Aug 15, 2023
fe312dd
Merge branch 'fix-12_move-to-golang' of github.com:donkeyx/docker_clu…
donkeyx Aug 15, 2023
9f1f6cc
migrate #12: adding readyz handlers
Aug 15, 2023
d382a53
migrate #12: adding write perms for releases
Aug 15, 2023
f98c2e2
migrate #12: adding more fixes/cleanup
donkeyx Aug 16, 2023
33f72d4
Merge branch 'fix-12_move-to-golang' of github.com:donkeyx/docker_clu…
donkeyx Aug 16, 2023
3ed78b8
fix #12: adding ignore for logs
donkeyx Sep 2, 2023
f84666a
fix #12: remove logs from vscode
donkeyx Sep 2, 2023
5ec965a
imp #12: added dockerfile for testing container
donkeyx Sep 2, 2023
1d4b8b4
fix #12: removed gobin not needed
donkeyx Sep 2, 2023
3db15e8
imp #12: added a logger and some more cleanup
donkeyx Sep 2, 2023
e5beda4
imp #12: logger changes to suger and middlewear
donkeyx Sep 2, 2023
ae3e96a
imp #12: removed the old js version ;)
donkeyx Sep 2, 2023
8273109
imp #12: ignore vscode debug
donkeyx Sep 6, 2023
5af8be5
imp #12: cleanup of the middlewar and loggers
donkeyx Sep 6, 2023
cd7a532
fix #12: added the logger to the gin config
donkeyx Sep 10, 2023
c7ca9ff
wip #12: not working but moved code and handlers
donkeyx Sep 11, 2023
e79f035
wip #12: mostly cleaned up but not working yet
donkeyx Sep 12, 2023
d813837
wip #12: working but still not fucking gin logging json
donkeyx Sep 13, 2023
824b20a
imp #12: added the /a/ to the auth group
donkeyx Sep 13, 2023
3041d24
wip #12: still messing with the gin logger
donkeyx Sep 13, 2023
6841e2a
wip #12: Still sorting the zap logger
donkeyx Sep 17, 2023
d1fc3da
fix #12: working with the middleware and json clean
donkeyx Sep 18, 2023
3b76608
fix #12: removed the json flipper, not needed atm
donkeyx Sep 18, 2023
8292812
imp #12: adding tests now...
donkeyx Sep 18, 2023
bc1a090
imp #12: added first health test
donkeyx Sep 18, 2023
37dedd5
imp #12: Added first test will do more shit later
donkeyx Sep 21, 2023
ae8226b
imp #12: adding the docker push now its working ok
donkeyx Sep 23, 2023
a1e0972
imp #12: adding bin links for node/cu-api
donkeyx Sep 23, 2023
3a407f6
imp #12: Added docker cache to the build
donkeyx Sep 23, 2023
3444ee1
fix #12: added correct dockerhub deets :(
donkeyx Sep 23, 2023
3ea32d2
imp #12: Added cache for the go packages as well
donkeyx Sep 23, 2023
3bf5de1
imp #12: added a cache step for docker+go
donkeyx Sep 23, 2023
ece2358
fix #12: fix docker again
donkeyx Sep 23, 2023
85bbd0f
imp #12: use the docker meta for both the dockerhub+github
donkeyx Sep 23, 2023
5e3b60c
wip #12: still tweaking hub/gcr push
Sep 25, 2023
6a80f80
fix #12: fix dodgy param
Sep 25, 2023
a5749b4
imp #12: allow alias for npm/node/go
Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 0 additions & 81 deletions .circleci/config.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '17 22 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

- name: Run tests
shell: bash
run: |
make test

90 changes: 90 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Docker build and push

on:
push:
tags:
- "v*"

jobs:
cache:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache Go packages and Docker layers
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
/tmp/.buildx-cache
key: go-docker-${{ runner.os }}-${{ hashFiles('**/*.go') }}
restore-keys: |
go-docker-${{ runner.os }}-

docker:
needs: cache
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.17

- name: Cache Go packages (reuse cache from 'cache' job)
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-${{ runner.os }}-${{ hashFiles('**/*.go') }}
restore-keys: |
go-${{ runner.os }}-

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta (GHCR)
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/donkeyx/cluster-utils-api
docker.io/donkeyx/cluster-utils-api
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
tags: ["v*.*.*"]

env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
environment: deployment # this gets the secrets for deployments

runs-on: ubuntu-latest
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

# ################################
# create release and push assets
# ################################
- name: Build go binaries
if: startsWith(github.ref, 'refs/tags/')
run: |
make build-all

- name: Release to github with Notes
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: false
generate_release_notes: true
files: |
bin/cu-api.arm64
bin/cu-api.darwin.amd64
bin/cu-api.linux.amd64
bin/cu-api.windows.amd64
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules
bin/*
*.log
*.log
__debug_bin
__debug_bin*
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}"
}
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"makefile.extensionOutputFolder": "./.vscode"
}
Loading