Skip to content

Commit

Permalink
Release 2.13.2 (#1647)
Browse files Browse the repository at this point in the history
* add label to descriptor (#1625)

* Remove helm chart bundling of `KubeBuilder` projects (#1581)

* remove helm chart bundling of kubebuilder projectss

* update golang-ci version to latets

* go fmt

* rm unused code

* rm commented code

* go fmt

* fix error caps

* fix failing tests

* refactor project build signature

* fix linting

* fix linting

* fix linting ii

* fix linting iii

* fix linting

* fix linting

* fix linting

* fix linting

* fix linting

* Remove envtest logs for verbose mode (#1629)

* Support the installation of specific Garden Linux version for Gardener (#1630)

* Add gardenlinux flag for Gardener provisioning

* generate docs

* fix test

* fix test

* Add missing comment

Co-authored-by: Małgorzata Świeca <[email protected]>

* Fix indentation

---------

Co-authored-by: Małgorzata Świeca <[email protected]>

* Replace key parsing logic with ocm signing (#1633)

* replace public key parsing logic with what offered by ocm

* replace private key parsing logic with what offered by ocm

* change signature name and issuer

* Upgrade hydroform version (#1635)

* Configure creds for empty auth (#1634)

* Debug

* Fix for credentials

* Cleanup

* Updating goreleaser (#1642)

* cred selector label should save in layer before push to oci image. (#1643)

* bump reconciler (#1644)

* Release 2.13.2

---------

Co-authored-by: Xin Ruan <[email protected]>
Co-authored-by: Ali Khlifi <[email protected]>
Co-authored-by: Nesma Badr <[email protected]>
Co-authored-by: Małgorzata Świeca <[email protected]>
Co-authored-by: Tomasz Smelcerz <[email protected]>
Co-authored-by: Damian Badura <[email protected]>
  • Loading branch information
7 people authored May 2, 2023
1 parent e690232 commit 777d771
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 55 deletions.
14 changes: 7 additions & 7 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ builds:
- goos: darwin
goarch: 386
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
- id: foo
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip
Expand Down
4 changes: 2 additions & 2 deletions cmd/kyma/alpha/create/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (cmd *command) Run(ctx context.Context) error {

cmd.NewStep("Adding layers to archive...")

if err := module.AddResources(archive, modDef, l, osFS); err != nil {
if err := module.AddResources(archive, modDef, l, osFS, cmd.opts.RegistryCredSelector); err != nil {
cmd.CurrentStep.Failure()
return err
}
Expand Down Expand Up @@ -264,7 +264,7 @@ func (cmd *command) Run(ctx context.Context) error {
}

cmd.NewStep("Generating module template")
t, err := module.Template(componentVersionAccess, cmd.opts.Channel, cmd.opts.Target, modDef.DefaultCR, cmd.opts.RegistryCredSelector)
t, err := module.Template(componentVersionAccess, cmd.opts.Channel, cmd.opts.Target, modDef.DefaultCR)
if err != nil {
cmd.CurrentStep.Failure()
return err
Expand Down
2 changes: 1 addition & 1 deletion docs/gen-docs/kyma_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ kyma deploy [flags]
- Deploy a specific branch of the Kyma repository on kyma-project.org: "kyma deploy --source=<my-branch-name>"
- Deploy a commit (8 characters or more), for example: "kyma deploy --source=34edf09a"
- Deploy a pull request, for example "kyma deploy --source=PR-9486"
- Deploy the local sources: "kyma deploy --source=local" (default "2.13.0")
- Deploy the local sources: "kyma deploy --source=local" (default "2.13.1")
-t, --timeout duration Maximum time for the deployment. (default 20m0s)
--tls-crt string TLS certificate file for the domain used for installation.
--tls-key string TLS key file for the domain used for installation.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/go-logr/logr v1.2.3
github.com/go-logr/zapr v1.2.3
github.com/imdario/mergo v0.3.13
github.com/kyma-incubator/reconciler v0.0.0-20230414081633-01086c789985
github.com/kyma-incubator/reconciler v0.0.0-20230427062256-f255ae8d0053
github.com/kyma-project/hydroform/function v0.0.0-20230307104736-fc661e702543
github.com/kyma-project/hydroform/provision v0.0.0-20230418133637-1ea26b368bb6
github.com/kyma-project/lifecycle-manager v0.0.0-20230228084539-adc0e4a5f93a
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1172,8 +1172,8 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/kyma-incubator/reconciler v0.0.0-20230414081633-01086c789985 h1:P7dPx0nuYru8gv3hZmNsPS6tffbMyJGbk9W6Je5tukg=
github.com/kyma-incubator/reconciler v0.0.0-20230414081633-01086c789985/go.mod h1:Xgvl68xt2qKPKrzh73UbeHjmT4VdSNJPKXpozkMPUN0=
github.com/kyma-incubator/reconciler v0.0.0-20230427062256-f255ae8d0053 h1:w5U5uQFmsWXWYS+e/t8g7Ai/BNP9+FF2ToJ3jhWMb4Y=
github.com/kyma-incubator/reconciler v0.0.0-20230427062256-f255ae8d0053/go.mod h1:Xgvl68xt2qKPKrzh73UbeHjmT4VdSNJPKXpozkMPUN0=
github.com/kyma-project/hydroform/function v0.0.0-20230307104736-fc661e702543 h1:7xCxCkLYwwcl1zrhu65YQ5LkHzZYiCcM1tYhC/vNQ00=
github.com/kyma-project/hydroform/function v0.0.0-20230307104736-fc661e702543/go.mod h1:h6psCfFtd9Lo4AjiV2a9EYnG0yeNCR5TvSPbkZHL4qg=
github.com/kyma-project/hydroform/provision v0.0.0-20230418133637-1ea26b368bb6 h1:k8TsRKhbYr+uQ1Glpbwii9kBqMPSFEZdMSov9KJjgiA=
Expand Down
12 changes: 6 additions & 6 deletions hack/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ delete_stable_tag() {
get_new_release_version() {
# get the list of tags in a reverse chronological order
TAG_LIST=($(git tag --sort=-creatordate))
NEW_RELEASE_VERSION=${TAG_LIST[0]}
export GORELEASER_CURRENT_TAG=${TAG_LIST[0]}
}

get_current_release_version() {
get_previous_release_version() {
# get the list of tags in a reverse chronological order excluding release candidate tags
TAG_LIST_WITHOUT_RC=($(git tag --sort=-creatordate | grep -v -e "-rc"))
if [[ $NEW_RELEASE_VERSION == *"-rc"* ]]; then
CURRENT_RELEASE_VERSION=${TAG_LIST_WITHOUT_RC[0]}
export GORELEASER_PREVIOUS_TAG=${TAG_LIST_WITHOUT_RC[0]}
else
CURRENT_RELEASE_VERSION=${TAG_LIST_WITHOUT_RC[1]}
export GORELEASER_PREVIOUS_TAG=${TAG_LIST_WITHOUT_RC[1]}
fi
}

main() {
git remote add origin [email protected]:kyma-project/cli.git
delete_stable_tag
get_new_release_version
get_current_release_version
get_previous_release_version
# release CLI with release notes generated by goreleaser
curl -sL https://git.io/goreleaser | VERSION=v1.11.4 bash -s --
curl -sL https://git.io/goreleaser | VERSION=v1.17.2 bash -s --
}

main
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
package config

const (
DefaultKyma2Version = "2.13.0"
DefaultKyma2Version = "2.13.1"
)
38 changes: 35 additions & 3 deletions pkg/module/resources.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package module

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
Expand All @@ -13,12 +14,17 @@ import (
"github.com/mandelsoft/vfs/pkg/vfs"
"github.com/open-component-model/ocm/pkg/common/accessobj"
"github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc"
ocmv1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1"
"github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/comparch"
"github.com/pkg/errors"
"go.uber.org/zap"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)

//nolint:gosec
const OCIRegistryCredLabel = "oci-registry-cred"

// ResourceDescriptor contains all information to describe a resource
type ResourceDescriptor struct {
compdesc.Resource
Expand All @@ -33,10 +39,29 @@ type ResourceDescriptorList struct {
// AddResources adds the resources in the given resource definitions into the archive and its FS.
// A resource definition is a string with format: NAME:TYPE@PATH, where NAME and TYPE can be omitted and will default to the last path element name and "helm-chart" respectively
func AddResources(
archive *comparch.ComponentArchive, modDef *Definition, log *zap.SugaredLogger, fs vfs.FileSystem,
archive *comparch.ComponentArchive,
modDef *Definition,
log *zap.SugaredLogger,
fs vfs.FileSystem,
registryCredSelector string,
) error {
descriptor := archive.GetDescriptor()
resources, err := generateResources(log, modDef.Version, modDef.Layers...)
var matchLabels []byte
if registryCredSelector != "" {
selector, err := metav1.ParseToLabelSelector(registryCredSelector)
if err != nil {
return err
}
matchLabels, err = json.Marshal(selector.MatchLabels)
if err != nil {
return err
}
descriptor.SetLabels([]ocmv1.Label{{
Name: OCIRegistryCredLabel,
Value: matchLabels,
}})
}
resources, err := generateResources(log, modDef.Version, matchLabels, modDef.Layers...)
if err != nil {
return err
}
Expand All @@ -63,7 +88,7 @@ func AddResources(
// generateResources generates resources by parsing the given definitions.
// Definitions have the following format: NAME:TYPE@PATH
// If a definition does not have a name or type, the name of the last path element is used and it is assumed to be a helm-chart type.
func generateResources(log *zap.SugaredLogger, version string, defs ...Layer) ([]ResourceDescriptor, error) {
func generateResources(log *zap.SugaredLogger, version string, credLabel []byte, defs ...Layer) ([]ResourceDescriptor, error) {
res := []ResourceDescriptor{}
for _, d := range defs {
r := ResourceDescriptor{Input: &blob.Input{}}
Expand All @@ -86,6 +111,13 @@ func generateResources(log *zap.SugaredLogger, version string, defs ...Layer) ([
r.Input.Type = "file"
}

if len(credLabel) != 0 {
r.SetLabels([]ocmv1.Label{{
Name: OCIRegistryCredLabel,
Value: credLabel,
}})
}

log.Debugf("Generated resource:\n%s", r)
res = append(res, r)
}
Expand Down
33 changes: 1 addition & 32 deletions pkg/module/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ package module

import (
"bytes"
"encoding/json"
"fmt"
"strings"
"text/template"

"github.com/kyma-project/cli/pkg/module/oci"
"github.com/open-component-model/ocm/pkg/contexts/ocm"
"github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc"
ocmv1 "github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/yaml"
)

Expand All @@ -33,38 +30,10 @@ spec:
descriptor:
{{yaml .Descriptor | printf "%s" | indent 4}}
`

//nolint:gosec
OCIRegistryCredLabel = "oci-registry-cred"
)

func Template(
remote ocm.ComponentVersionAccess, channel, target string, data []byte, registryCredSelector string,
) ([]byte, error) {
func Template(remote ocm.ComponentVersionAccess, channel, target string, data []byte) ([]byte, error) {
descriptor := remote.GetDescriptor()
if registryCredSelector != "" {
selector, err := metav1.ParseToLabelSelector(registryCredSelector)
if err != nil {
return nil, err
}
matchLabels, err := json.Marshal(selector.MatchLabels)
if err != nil {
return nil, err
}
descriptor.SetLabels([]ocmv1.Label{{
Name: OCIRegistryCredLabel,
Value: matchLabels,
}})
for i := range descriptor.Resources {
resource := &descriptor.Resources[i]
resource.SetLabels(
[]ocmv1.Label{{
Name: OCIRegistryCredLabel,
Value: matchLabels,
}},
)
}
}
ref, err := oci.ParseRef(descriptor.Name)
if err != nil {
return nil, err
Expand Down

0 comments on commit 777d771

Please sign in to comment.