Compare commits
3 commits
243aaf1a53
...
486d616def
Author | SHA1 | Date | |
---|---|---|---|
![]() |
486d616def | ||
![]() |
250435256d | ||
802b93bdaf |
13 changed files with 213 additions and 126 deletions
|
@ -7,10 +7,6 @@ steps:
|
|||
- go fmt $(go list ./... | grep -v /vendor/)
|
||||
- go vet $(go list ./... | grep -v /vendor/)
|
||||
- go test -race $(go list ./... | grep -v /vendor/)
|
||||
when:
|
||||
- event: [push, cron]
|
||||
branch: [main, develop]
|
||||
- event: pull_request
|
||||
|
||||
- name: check-sec
|
||||
image: golang
|
||||
|
@ -18,7 +14,12 @@ steps:
|
|||
- go install github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
- go get -v -d .
|
||||
- gosec ./...
|
||||
when:
|
||||
|
||||
|
||||
|
||||
when:
|
||||
- event: [push, cron]
|
||||
branch: [main, develop]
|
||||
- event: pull_request
|
||||
- event: tag
|
||||
branch: main
|
48
.woodpecker/1-build-check.yml
Normal file
48
.woodpecker/1-build-check.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
steps:
|
||||
- name: test/build-binary/linux-amd64
|
||||
image: golang:1.24.2
|
||||
environment:
|
||||
GOOS: "linux"
|
||||
GOARCH: "amd64"
|
||||
I_PACKAGE: "git.hackmi.ch/Phil/goshorly/utils"
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app-amd64 .
|
||||
|
||||
- name: test/build-binary/linux-arm64
|
||||
image: golang:1.24.2
|
||||
environment:
|
||||
GOOS: "linux"
|
||||
GOARCH: "arm64"
|
||||
I_PACKAGE: "git.hackmi.ch/Phil/goshorly/utils"
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app-arm64 .
|
||||
|
||||
- name: test/build-docker/linux-amd64
|
||||
image: woodpeckerci/plugin-docker-buildx:5.2.2
|
||||
settings:
|
||||
platforms: linux/amd64
|
||||
dry-run: true
|
||||
repo: git.hackmi.ch/phil/goshorly
|
||||
registry: git.hackmi.ch
|
||||
depends_on:
|
||||
- test/build-binary/linux-amd64
|
||||
|
||||
- name: test/build-docker/linux-arm64
|
||||
image: woodpeckerci/plugin-docker-buildx:5.2.2
|
||||
settings:
|
||||
platforms: linux/arm64
|
||||
dry-run: true
|
||||
repo: git.hackmi.ch/phil/goshorly
|
||||
registry: git.hackmi.ch
|
||||
depends_on:
|
||||
- test/build-binary/linux-arm64
|
||||
|
||||
when:
|
||||
- event: [push, cron]
|
||||
branch: [main, develop]
|
||||
- event: pull_request
|
||||
|
||||
depends_on:
|
||||
- 0-pre
|
42
.woodpecker/10-build-dev.yml
Normal file
42
.woodpecker/10-build-dev.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
steps:
|
||||
- name: dev/build-binary/linux-amd64
|
||||
image: golang:1.24.2
|
||||
environment:
|
||||
GOOS: "linux"
|
||||
GOARCH: "amd64"
|
||||
I_PACKAGE: "git.hackmi.ch/Phil/goshorly/utils"
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app-linux-amd64 .
|
||||
|
||||
- name: dev/build-binary/linux-arm64
|
||||
image: golang:1.24.2
|
||||
environment:
|
||||
GOOS: "linux"
|
||||
GOARCH: "arm64"
|
||||
I_PACKAGE: "git.hackmi.ch/Phil/goshorly/utils"
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app-linux-arm64 .
|
||||
|
||||
- name: dev/build-docker/linux-multiarch
|
||||
image: woodpeckerci/plugin-docker-buildx:5.2.2
|
||||
settings:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
repo: git.hackmi.ch/phil/goshorly
|
||||
registry: git.hackmi.ch
|
||||
tags: dev
|
||||
username:
|
||||
from_secret: reg-user
|
||||
password:
|
||||
from_secret: reg-pass
|
||||
depends_on:
|
||||
- dev/build-binary/linux-amd64
|
||||
- dev/build-binary/linux-arm64
|
||||
|
||||
when:
|
||||
- event: [push, cron]
|
||||
branch: main
|
||||
|
||||
depends_on:
|
||||
- 0-pre
|
|
@ -1,41 +0,0 @@
|
|||
steps:
|
||||
- name: build-binary
|
||||
image: golang:1.24.2
|
||||
commands:
|
||||
- export CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHA:0:10}
|
||||
- go build -ldflags="-X main.CommitSHA=${CI_COMMIT_SHORT_SHA}" -o linux-amd64 .
|
||||
when:
|
||||
- event: [push, cron]
|
||||
branch: main
|
||||
|
||||
- name: build-and-push-docker-dev
|
||||
image: woodpeckerci/plugin-docker-buildx:5.2.2
|
||||
settings:
|
||||
platforms: linux/amd64,linux/arm/v6,linux/arm64/v8
|
||||
repo: git.hackmi.ch/phil/goshorly
|
||||
registry: git.hackmi.ch
|
||||
tags: dev
|
||||
username:
|
||||
from_secret: reg-user
|
||||
password:
|
||||
from_secret: reg-pass
|
||||
build_args:
|
||||
- CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH}
|
||||
- CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHA:0:10}
|
||||
depends_on:
|
||||
- build-binary
|
||||
when:
|
||||
- event: [push, cron]
|
||||
branch: main
|
||||
|
||||
services:
|
||||
docker-daemon:
|
||||
image: docker:28.0-dind-rootless
|
||||
commands:
|
||||
- dockerd --tls=false --host=tcp://0.0.0.0:2376
|
||||
privileged: true
|
||||
when:
|
||||
- event: [push, cron]
|
||||
|
||||
depends_on:
|
||||
- 0-pre
|
41
.woodpecker/20-build-tag.yml
Normal file
41
.woodpecker/20-build-tag.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
steps:
|
||||
- name: prod/build-binary/linux-amd64
|
||||
image: golang:1.24.2
|
||||
environment:
|
||||
GOOS: "linux"
|
||||
GOARCH: "amd64"
|
||||
I_PACKAGE: "git.hackmi.ch/Phil/goshorly/utils"
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app-linux-amd64 .
|
||||
|
||||
- name: prod/build-binary/linux-arm64
|
||||
image: golang:1.24.2
|
||||
environment:
|
||||
GOOS: "linux"
|
||||
GOARCH: "arm64"
|
||||
I_PACKAGE: "git.hackmi.ch/Phil/goshorly/utils"
|
||||
CGO_ENABLED: 0
|
||||
commands:
|
||||
- go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app-linux-arm64 .
|
||||
|
||||
- name: prod/build-docker/linux-multiarch
|
||||
image: woodpeckerci/plugin-docker-buildx:5.2.2
|
||||
settings:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
repo: git.hackmi.ch/phil/goshorly
|
||||
registry: git.hackmi.ch
|
||||
auto_tag: true
|
||||
username:
|
||||
from_secret: reg-user
|
||||
password:
|
||||
from_secret: reg-pass
|
||||
depends_on:
|
||||
- prod/build-binary/linux-amd64
|
||||
- prod/build-binary/linux-arm64
|
||||
|
||||
when:
|
||||
- event: tag
|
||||
|
||||
depends_on:
|
||||
- 0-pre
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,16 +1,24 @@
|
|||
# Changelog
|
||||
|
||||
## [0.2.0](https://git.hackmi.ch/Phil/goshorly/releases/tag/v0.2.0) - 2025-04-06
|
||||
## [1.0.0](https://git.hackmi.ch/Phil/goshorly/releases/tag/v1.0.0) - 2025-04-07
|
||||
|
||||
### ❤️ Thanks to all contributors! ❤️
|
||||
|
||||
@Phil, @renovate-bot
|
||||
|
||||
### 💥 Breaking changes
|
||||
|
||||
- [CI Workflow] Improvments for next releses and logic [[#11](https://git.hackmi.ch/Phil/goshorly/pulls/11)]
|
||||
|
||||
### 🔒 Security
|
||||
|
||||
- [CI-Build] Changed DIND to DIND rootless [[#10](https://git.hackmi.ch/Phil/goshorly/pulls/10)]
|
||||
- Update docker Docker tag to v28 [[#5](https://git.hackmi.ch/Phil/goshorly/pulls/5)]
|
||||
|
||||
### ✨ Features
|
||||
|
||||
- Configure Renovate [[#1](https://git.hackmi.ch/Phil/goshorly/pulls/1)]
|
||||
|
||||
### 📦️ Dependency
|
||||
|
||||
- Update dependency go to v1.24.2 [[#8](https://git.hackmi.ch/Phil/goshorly/pulls/8)]
|
||||
|
@ -18,7 +26,3 @@
|
|||
- Update dependency font-awesome to v6.7.2 [[#4](https://git.hackmi.ch/Phil/goshorly/pulls/4)]
|
||||
- Update woodpeckerci/plugin-docker-buildx Docker tag to v5 [[#7](https://git.hackmi.ch/Phil/goshorly/pulls/7)]
|
||||
- Update module github.com/gofiber/fiber/v2 to v2.52.6 [[#2](https://git.hackmi.ch/Phil/goshorly/pulls/2)]
|
||||
|
||||
### Misc
|
||||
|
||||
- Configure Renovate [[#1](https://git.hackmi.ch/Phil/goshorly/pulls/1)]
|
||||
|
|
18
Dockerfile
18
Dockerfile
|
@ -1,26 +1,18 @@
|
|||
FROM golang:alpine as builder
|
||||
|
||||
RUN apk add --no-cache git make build-base
|
||||
|
||||
ARG CI_COMMIT_BRANCH
|
||||
ARG CI_COMMIT_SHORT_SHA
|
||||
ARG CI_COMMIT_TAG
|
||||
|
||||
ENV CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH
|
||||
ENV CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA
|
||||
ENV CI_COMMIT_TAG=$CI_COMMIT_TAG
|
||||
FROM golang:1.24.2-alpine AS builder
|
||||
|
||||
ENV I_PACKAGE="git.hackmi.ch/Phil/goshorly/utils"
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
RUN apk add --no-cache git make build-base
|
||||
|
||||
WORKDIR /go/src/git.hackmi.ch/goshorly
|
||||
COPY . .
|
||||
|
||||
RUN go get -d -v ./...
|
||||
|
||||
RUN go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app .
|
||||
RUN go build -a -installsuffix cgo -ldflags=" -X $I_PACKAGE.CI_COMMIT_SHA=$CI_COMMIT_SHA -X $I_PACKAGE.CI_COMMIT_BRANCH=$CI_COMMIT_BRANCH -X $I_PACKAGE.CI_COMMIT_TAG=$CI_COMMIT_TAG" -o app .
|
||||
|
||||
FROM scratch as production
|
||||
FROM scratch AS production
|
||||
WORKDIR /
|
||||
COPY --from=builder /go/src/git.hackmi.ch/goshorly/app /app
|
||||
ENTRYPOINT [ "/app" ]
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func Gethome(c *fiber.Ctx) error {
|
||||
return c.Render("views/home", fiber.Map{
|
||||
"CI_COMMIT_SHORT_SHA": utils.CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": utils.CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": utils.CI_COMMIT_BRANCH,
|
||||
"CI_COMMIT_TAG": utils.CI_COMMIT_TAG,
|
||||
"CI_TAGGED": utils.CI_TAGGED,
|
||||
|
|
|
@ -29,7 +29,7 @@ func Posthome(c *fiber.Ctx) error {
|
|||
|
||||
return c.Status(500).Render("views/home", fiber.Map{
|
||||
"ERR": "Parsing Error",
|
||||
"CI_COMMIT_SHORT_SHA": utils.CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": utils.CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": utils.CI_COMMIT_BRANCH,
|
||||
"CI_COMMIT_TAG": utils.CI_COMMIT_TAG,
|
||||
"CI_TAGGED": utils.CI_TAGGED,
|
||||
|
@ -50,7 +50,7 @@ func Posthome(c *fiber.Ctx) error {
|
|||
|
||||
return c.Status(424).Render("views/home", fiber.Map{
|
||||
"ERR": "Invalid URL, please check and try again.",
|
||||
"CI_COMMIT_SHORT_SHA": utils.CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": utils.CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": utils.CI_COMMIT_BRANCH,
|
||||
"CI_COMMIT_TAG": utils.CI_COMMIT_TAG,
|
||||
"CI_TAGGED": utils.CI_TAGGED,
|
||||
|
@ -73,7 +73,7 @@ func Posthome(c *fiber.Ctx) error {
|
|||
|
||||
return c.Status(500).Render("views/home", fiber.Map{
|
||||
"ERR": err.Error(),
|
||||
"CI_COMMIT_SHORT_SHA": utils.CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": utils.CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": utils.CI_COMMIT_BRANCH,
|
||||
"CI_COMMIT_TAG": utils.CI_COMMIT_TAG,
|
||||
"CI_TAGGED": utils.CI_TAGGED,
|
||||
|
@ -95,7 +95,7 @@ func Posthome(c *fiber.Ctx) error {
|
|||
|
||||
return c.Status(500).Render("views/home", fiber.Map{
|
||||
"ERR": err.Error(),
|
||||
"CI_COMMIT_SHORT_SHA": utils.CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": utils.CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": utils.CI_COMMIT_BRANCH,
|
||||
"CI_COMMIT_TAG": utils.CI_COMMIT_TAG,
|
||||
"CI_TAGGED": utils.CI_TAGGED,
|
||||
|
@ -123,7 +123,7 @@ func Posthome(c *fiber.Ctx) error {
|
|||
|
||||
return c.Status(201).Render("views/home", fiber.Map{
|
||||
"URL": fURL,
|
||||
"CI_COMMIT_SHORT_SHA": utils.CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": utils.CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": utils.CI_COMMIT_BRANCH,
|
||||
"CI_COMMIT_TAG": utils.CI_COMMIT_TAG,
|
||||
"CI_TAGGED": utils.CI_TAGGED,
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
CI_COMMIT_SHORT_SHA string
|
||||
CI_COMMIT_SHA string
|
||||
CI_COMMIT_BRANCH string
|
||||
CI_COMMIT_TAG string
|
||||
CI_TAGGED bool
|
||||
|
@ -14,7 +14,7 @@ var (
|
|||
)
|
||||
|
||||
func Init_build_vars() {
|
||||
CI_BUILD = CI_COMMIT_SHORT_SHA != "" || CI_COMMIT_BRANCH != ""
|
||||
CI_BUILD = CI_COMMIT_SHA != "" || CI_COMMIT_BRANCH != ""
|
||||
CI_TAGGED = CI_COMMIT_TAG != ""
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ func Print_Starting_Screen() {
|
|||
if CI_TAGGED {
|
||||
version = CI_COMMIT_TAG
|
||||
} else if CI_BUILD {
|
||||
version = CI_COMMIT_SHORT_SHA
|
||||
version = CI_COMMIT_SHA
|
||||
}
|
||||
fmt.Println("---- Starting goshorly " + version + " ----")
|
||||
time.Sleep(1 * time.Second)
|
||||
|
|
|
@ -19,7 +19,7 @@ var ConfigLimiter limiter.Config = limiter.Config{
|
|||
}
|
||||
return c.Render("views/home", fiber.Map{
|
||||
"ERR": "You have reached the limit of requests! Please check back later. (1 minute)",
|
||||
"CI_COMMIT_SHORT_SHA": CI_COMMIT_SHORT_SHA,
|
||||
"CI_COMMIT_SHA": CI_COMMIT_SHA,
|
||||
"CI_COMMIT_BRANCH": CI_COMMIT_BRANCH,
|
||||
"CI_BUILD": CI_BUILD,
|
||||
})
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
{{ if .CI_COMMIT_TAG }}
|
||||
| {{ .CI_COMMIT_TAG }}
|
||||
{{ else }}
|
||||
| {{ .CI_COMMIT_SHORT_SHA }}/{{ .CI_COMMIT_BRANCH }}
|
||||
| {{ .CI_COMMIT_SHA }}/{{ .CI_COMMIT_BRANCH }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</center>
|
||||
|
|
Loading…
Add table
Reference in a new issue