Skip to content

Commit

Permalink
[OP-1708, OP-1709] Add patch types: helmDepUpdate & yaml (#30)
Browse files Browse the repository at this point in the history
* Updated Go to 1.22.1

* go mod tidy

* Refactored to better allow multiple patch styles

* Moved file into regex

* Fixed tests by new abstractions

* Added YAML patch

* Added missing required tag

* Updated configs a little

* Added exec operation

* Added Helm to Dockerfile

* Added dry-run config page

* Removed exec in favor of domain specific helm patch

* Renamed

* Added validation

* Updated sample config

* go get -u

* Update to Go 1.22.2

* Updated packages

* Added whitespace-preserving patch

* Added comments explaining the filestores

* Refactored into multiple packages
  • Loading branch information
applejag authored Apr 8, 2024
1 parent 8a01468 commit 68349bb
Show file tree
Hide file tree
Showing 39 changed files with 1,556 additions and 827 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
// SPDX-License-Identifier: CC0-1.0
{
"cSpell.words": [
"filestore",
"fstore",
"gonic",
"jelease",
"newreleases",
"Templ",
"templating",
"tmpl",
"yamlpath",
"zerolog"
],
"files.exclude": {
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: CC0-1.0

FROM golang:1.21.5-alpine AS build
FROM golang:1.22.2-alpine AS build
WORKDIR /jelease
COPY go.mod go.sum ./
RUN go mod download
Expand All @@ -15,7 +15,7 @@ RUN go test -v ./... \
-o build/jelease main.go

FROM alpine
RUN apk add --no-cache ca-certificates git
RUN apk add --no-cache ca-certificates patch git git-lfs helm
COPY --from=build /jelease/build/jelease /usr/local/bin/
CMD ["jelease", "serve"]
USER 10000
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ config file:
repos:
- url: https://github.example.com/some-org/some-repo
patches:
- file: helm/charts/ri-neuvector/Chart.yaml
regex:
- regex:
file: helm/charts/ri-neuvector/Chart.yaml
match: '^appVersion: .*'
replace: 'appVersion: {{ .Version }}'
- file: helm/charts/ri-neuvector/Chart.yaml
regex:
- regex:
file: helm/charts/ri-neuvector/Chart.yaml
match: '^version: (.*)'
replace: 'version: {{ index .Groups 1 | versionBump "0.0.1" }}'

Expand Down
4 changes: 2 additions & 2 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package cmd
import (
"fmt"

"github.com/RiskIdent/jelease/pkg/patch"
"github.com/RiskIdent/jelease/pkg/config"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
)
Expand All @@ -42,7 +42,7 @@ var applyCmd = &cobra.Command{
}
log.Info().Str("package", pkgName).Msg("Found package config")

tmplCtx := patch.TemplateContext{
tmplCtx := config.TemplateContext{
Package: pkgName,
Version: version,
JiraIssue: applyFlags.jiraIssueKey,
Expand Down
56 changes: 25 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,76 @@

module github.com/RiskIdent/jelease

go 1.21.5
go 1.22.2

require (
github.com/a-h/templ v0.2.648
github.com/andygrunwald/go-jira v1.16.0
github.com/bradleyfalzon/ghinstallation/v2 v2.7.0
github.com/bradleyfalzon/ghinstallation/v2 v2.10.0
github.com/fatih/color v1.16.0
github.com/gin-gonic/gin v1.9.1
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-github/v48 v48.2.0
github.com/invopop/jsonschema v0.12.0
github.com/mitchellh/mapstructure v1.5.0
github.com/rs/zerolog v1.31.0
github.com/spf13/cobra v1.7.0
github.com/rs/zerolog v1.32.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0
github.com/spf13/viper v1.18.2
github.com/trivago/tgo v1.0.7
golang.org/x/oauth2 v0.13.0
github.com/vmware-labs/yaml-jsonpath v0.3.2
golang.org/x/oauth2 v0.19.0
gopkg.in/yaml.v3 v3.0.1
newreleases.io/newreleases v1.10.0
)

require (
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
github.com/a-h/parse v0.0.0-20240121214402-3caf7543159a // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.10.2 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/cli/browser v1.2.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.5 // indirect
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-github/v55 v55.0.0 // indirect
github.com/google/go-github/v60 v60.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Loading

0 comments on commit 68349bb

Please sign in to comment.