mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-06-22 12:04:57 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
362920bccf
|
|||
|
571b8069e2
|
|||
|
55f3901e0d
|
|||
|
e1e852cece
|
|||
|
3a6bc59683
|
|||
|
576b795f5f
|
|||
|
a09e3e799e
|
@@ -2,7 +2,6 @@
|
||||
!cmd
|
||||
!nginx
|
||||
!pkg
|
||||
!templates
|
||||
!web
|
||||
!go.mod
|
||||
!go.sum
|
||||
|
||||
@@ -22,26 +22,22 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Install cosign
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: sigstore/cosign-installer@main
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
@@ -74,24 +70,19 @@ jobs:
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: .
|
||||
build-args: |
|
||||
APP_VERSION=${{ steps.calver.outputs.current }}
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Sign the published Docker image
|
||||
if: ${{ github.event_name != 'pull_request' && !github.event.repository.private }}
|
||||
env:
|
||||
COSIGN_EXPERIMENTAL: "true"
|
||||
run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Trigger release job
|
||||
if: ${{ success() && github.ref_name == 'main' && github.event_name != 'pull_request' && !github.event.repository.private }}
|
||||
if: false
|
||||
# if: ${{ success() && github.ref_name == 'main' && github.event_name != 'pull_request' && !github.event.repository.private }}
|
||||
uses: toptal/jenkins-job-trigger-action@master
|
||||
with:
|
||||
jenkins_url: ${{ secrets.JENKINS_URL }}
|
||||
|
||||
Vendored
+5
-3
@@ -1,10 +1,10 @@
|
||||
def HELM_DOWNLOAD_URL = "https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz"
|
||||
def HELM_DOWNLOAD_URL = "https://get.helm.sh/helm-v3.14.0-linux-amd64.tar.gz"
|
||||
def WS_DIST = ".dist"
|
||||
def WS_BIN = ".bin"
|
||||
def WS_SCM = ".scm"
|
||||
|
||||
pipeline {
|
||||
agent { label "k8s" }
|
||||
agent { label "kube0" }
|
||||
|
||||
parameters {
|
||||
string(
|
||||
@@ -40,7 +40,8 @@ pipeline {
|
||||
dir("${WS_DIST}") {
|
||||
sh """
|
||||
curl -fsSL -O "${HELM_DOWNLOAD_URL}";
|
||||
tar xfz -C "${env.WORKSPACE}/${WS_BIN}" *;
|
||||
mkdir -p "${env.WORKSPACE}/${WS_BIN}";
|
||||
tar xfz * -C "${env.WORKSPACE}/${WS_BIN}";
|
||||
ls -lah "${env.WORKSPACE}/${WS_BIN}/linux-amd64/helm";
|
||||
"""
|
||||
deleteDir()
|
||||
@@ -73,6 +74,7 @@ pipeline {
|
||||
sh """
|
||||
"${env.WORKSPACE}/${WS_BIN}/linux-amd64/helm" upgrade ${params.RELEASE_NAME} * \
|
||||
--namespace ${params.RELEASE_NAMESPACE} \
|
||||
--install \
|
||||
--create-namespace \
|
||||
--dependency-update \
|
||||
--reset-values \
|
||||
|
||||
@@ -9,8 +9,6 @@ RUN dnf install -yq golang
|
||||
|
||||
COPY go.mod .
|
||||
COPY go.sum .
|
||||
COPY templates/go.mod templates/go.mod
|
||||
COPY templates/go.sum templates/go.sum
|
||||
|
||||
RUN --mount=type=cache,id=gopath,target=${GOPATH} \
|
||||
go mod \
|
||||
@@ -20,7 +18,6 @@ ARG APP_VERSION=containerized
|
||||
|
||||
COPY cmd cmd
|
||||
COPY pkg pkg
|
||||
COPY templates templates
|
||||
|
||||
RUN --mount=type=cache,id=gopath,target=${GOPATH} \
|
||||
go build \
|
||||
|
||||
@@ -9,11 +9,10 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/templates"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/config"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/ghost/v4api/httpclient"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/routes"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/templates"
|
||||
)
|
||||
|
||||
var Version = "nightly"
|
||||
@@ -53,7 +52,7 @@ func main() {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
templateFuncs := &templates.Funcs{Version: Version, YandexKey: config.Site.YandexKey}
|
||||
templateFuncs := &templates.Funcs{Version: Version, Site: config.Site}
|
||||
err = templates.Load(templateFuncs)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
|
||||
@@ -2,10 +2,7 @@ module code.tokarch.uk/mainnika/nikita-tokarch-uk
|
||||
|
||||
go 1.17
|
||||
|
||||
replace code.tokarch.uk/mainnika/nikita-tokarch-uk/templates => ./templates
|
||||
|
||||
require (
|
||||
code.tokarch.uk/mainnika/nikita-tokarch-uk/templates v0.0.0-00010101000000-000000000000
|
||||
github.com/jackwhelpton/fasthttp-routing/v2 v2.0.0
|
||||
github.com/mailru/easyjson v0.7.7
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
|
||||
+1
-2
@@ -6,10 +6,9 @@ import (
|
||||
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/templates"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/content"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/ghost/params"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/templates"
|
||||
)
|
||||
|
||||
// relativeRedirectBytes makes a relative redirect by using http Location header
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/templates"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/templates"
|
||||
)
|
||||
|
||||
var _ routing.DataWriter = (*TemplateWriter)(nil)
|
||||
|
||||
@@ -6,10 +6,9 @@ import (
|
||||
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
||||
"github.com/valyala/fasthttp"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/templates"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/config"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/ghost"
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/templates"
|
||||
)
|
||||
|
||||
// Routes is the main handler that contains all routes handlers
|
||||
|
||||
@@ -4,12 +4,13 @@ import (
|
||||
"html/template"
|
||||
"net/url"
|
||||
"sync"
|
||||
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/pkg/config"
|
||||
)
|
||||
|
||||
type Funcs struct {
|
||||
Version string
|
||||
|
||||
YandexKey string
|
||||
Site config.Site
|
||||
|
||||
compiledJSAppURL string
|
||||
|
||||
@@ -57,7 +58,7 @@ func (f *Funcs) getBlogURL() string {
|
||||
}
|
||||
|
||||
func (f *Funcs) getYaKey() string {
|
||||
return f.YandexKey
|
||||
return f.Site.YandexKey
|
||||
}
|
||||
|
||||
// Use returns a func map with template helpers functions
|
||||
@@ -21,10 +21,10 @@ import (
|
||||
//go:embed analytics.go.tmpl
|
||||
var content embed.FS
|
||||
|
||||
// Templates is a container of compiled templates
|
||||
// List of compiled go-templates
|
||||
var Templates *template.Template = template.New("")
|
||||
|
||||
// Load embedded templates
|
||||
// Load embeded templates
|
||||
func Load(funcs *Funcs) (err error) {
|
||||
|
||||
Templates.Funcs(funcs.Use())
|
||||
@@ -1,7 +0,0 @@
|
||||
module code.tokarch.uk/mainnika/nikita-tokarch-uk/templates
|
||||
|
||||
go 1.17
|
||||
|
||||
require github.com/sirupsen/logrus v1.8.1
|
||||
|
||||
require golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect
|
||||
@@ -1,10 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
Reference in New Issue
Block a user