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

Add vendor for obs integration #198

Merged
merged 2 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ KUBE_VERSION?="v1.22.7"
CLUSTER_NAME?="operator-e2e"
RAWCOMMITDATE=$(shell git log -n1 --format="%at")
COMMITDATE?=$(shell date -d @"${RAWCOMMITDATE}" "+%FT%TZ")
GO_TPM_TAG?=$(shell grep google/go-tpm-tools go.mod | awk '{print $$2}')

LDFLAGS := -w -s
LDFLAGS += -X "github.com/rancher/elemental-operator/pkg/version.Version=${GIT_TAG}"
Expand Down Expand Up @@ -114,3 +115,11 @@ kind-e2e-tests: build-docker-operator chart setup-kind
reload-operator: build-docker-operator chart
kind load docker-image --name $(CLUSTER_NAME) ${REPO}:${TAG}
helm upgrade -n cattle-elemental-system elemental-operator $(CHART)

.PHONY: vendor
vendor:
go mod vendor
curl -L 'https://github.com/google/go-tpm-tools/archive/refs/tags/$(GO_TPM_TAG).tar.gz' --output go-tpm-tools.tar.gz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go mod vendor does not include CGO code, hence we need to get source tarball manually and include it. So in order to properly build a functional vendor folder make vendor is required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about about having a git submodule for the go-tpm-tools inside the vendor dir? Would that work or does the go mod vendor overwrite it?

I know we can replace the module in the go.mod to point to a local sir, so that would avoid having to download the tar on the makefile which is a bit yuck

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, this crap has been going on for 4 years! golang/go#26366

There is a couple of simple fixes but those need to go upstream.. I will check tonigth to see if there is a saner way to get this proper

Copy link
Contributor Author

@davidcassany davidcassany Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn, this crap has been going on for 4 years! golang/go#26366

lol, I've been there too 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦🏻‍♂️

tar xaf go-tpm-tools.tar.gz --strip-components=1 -C vendor/github.com/google/go-tpm-tools
rm go-tpm-tools.tar.gz

8 changes: 6 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
#!BuildTag: elemental/elemental-operator:latest
#!BuildTag: elemental/elemental-operator:0.0.0-noversion
#!BuildTag: elemental/elemental-operator:0.0.0-noversion-build%RELEASE%
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for OBS to support multiple tags

apiVersion: v2
name: elemental-operator
description: Rancher Elemental Operator
version: 0.0.0
appVersion: 0.0.0
version: 0.0.0-noversion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a valid helm version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, helm chart requires semver 2 and this is a valid version for semver2. It is a preversion of 0.0.0 😅 Yes I know it is not very nice... in any case having a version 0.0.0 is not much better 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me, as long as it's a valid version, nothing will break

appVersion: 0.0.0-noversion
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is done because the 0.0.0-noversion is used a needle in a regex for replacement at build time in OBS, using 0.0.0 alone is not safe as there could be other occurrences of this such a simple string.

annotations:
catalog.cattle.io/certified: rancher
catalog.cattle.io/experimental: "true"
Expand Down
5 changes: 3 additions & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
image:
empty: rancher/pause:3.1
# elemental-operator image is also build on registry.opensuse.org/isv/rancher/elemental/teal52/15.3/rancher/elemental-operator
repository: quay.io/costoolkit/elemental-operator
# elemental-operator image is also build on:
# registry.opensuse.org/isv/rancher/elemental/teal53/15.4/rancher/elemental-operator
repository: "quay.io/costoolkit/elemental-operator"
tag: latest
imagePullPolicy: IfNotPresent

Expand Down
20 changes: 20 additions & 0 deletions vendor/github.com/beorn7/perks/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading