Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ x_base_steps:
# that it can properly exit the test early with success
- source hack/ci/check-doc-only-update.sh
- travis_retry make tidy
- git fetch origin --unshallow --tags
install:
- make install
- make setup-k8s
Expand All @@ -63,10 +64,8 @@ x_base_steps:
- &deploy
before_install:
- travis_retry make tidy
- git fetch origin --unshallow --tags
install: make install
before_script:
- git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch --unshallow --tags
after_success:
- echo "Image build succeeded, and docker image tagged and pushed to repository"
after_failure:
Expand All @@ -77,8 +76,7 @@ x_base_steps:
# Manifest list deploy job
- &manifest-deploy
before_script:
- git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch --unshallow --tags
- git fetch origin --unshallow --tags
# TODO: remove the chmod command when docker-ce on travis is upgraded to 18.09.0+.
# We need /etc/docker to be accessible to non-root users.
# See https://github.com/moby/moby/pull/37847.
Expand Down Expand Up @@ -106,6 +104,8 @@ jobs:
# Run the sanity tests
- stage: check
name: Sanity Tests
before_install:
- git fetch origin --unshallow --tags
script:
- make test-sanity

Expand Down
36 changes: 19 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ else
Q = @
endif

VERSION = $(shell git describe --dirty --tags --always)
SIMPLE_VERSION=$(shell (test "$(shell git describe)" = "$(shell git describe --abbrev=0)" && echo $(shell git describe)) || echo $(shell git describe --abbrev=0)+git)
GIT_VERSION = $(shell git describe --dirty --tags --always)
GIT_COMMIT = $(shell git rev-parse HEAD)
K8S_VERSION = v1.18.2
GOLANGCI_LINT_VER = "1.30.0"
Expand All @@ -22,7 +23,8 @@ GO_BUILD_ARGS = \
-gcflags "all=-trimpath=$(shell go env GOPATH)" \
-asmflags "all=-trimpath=$(shell go env GOPATH)" \
-ldflags " \
-X '$(REPO)/internal/version.GitVersion=$(VERSION)' \
-X '$(REPO)/internal/version.Version=$(SIMPLE_VERSION)' \
-X '$(REPO)/internal/version.GitVersion=$(GIT_VERSION)' \
-X '$(REPO)/internal/version.GitCommit=$(GIT_COMMIT)' \
-X '$(REPO)/internal/version.KubernetesVersion=$(K8S_VERSION)' \
" \
Expand Down Expand Up @@ -119,21 +121,21 @@ gen-changelog: ## Generate CHANGELOG.md and migration guide updates
.PHONY: release_builds release

release_builds := \
build/operator-sdk-$(VERSION)-aarch64-linux-gnu \
build/operator-sdk-$(VERSION)-x86_64-linux-gnu \
build/operator-sdk-$(VERSION)-x86_64-apple-darwin \
build/operator-sdk-$(VERSION)-ppc64le-linux-gnu \
build/operator-sdk-$(VERSION)-s390x-linux-gnu \
build/ansible-operator-$(VERSION)-aarch64-linux-gnu \
build/ansible-operator-$(VERSION)-x86_64-linux-gnu \
build/ansible-operator-$(VERSION)-x86_64-apple-darwin \
build/ansible-operator-$(VERSION)-ppc64le-linux-gnu \
build/ansible-operator-$(VERSION)-s390x-linux-gnu \
build/helm-operator-$(VERSION)-aarch64-linux-gnu \
build/helm-operator-$(VERSION)-x86_64-linux-gnu \
build/helm-operator-$(VERSION)-x86_64-apple-darwin \
build/helm-operator-$(VERSION)-ppc64le-linux-gnu \
build/helm-operator-$(VERSION)-s390x-linux-gnu
build/operator-sdk-$(GIT_VERSION)-aarch64-linux-gnu \
build/operator-sdk-$(GIT_VERSION)-x86_64-linux-gnu \
build/operator-sdk-$(GIT_VERSION)-x86_64-apple-darwin \
build/operator-sdk-$(GIT_VERSION)-ppc64le-linux-gnu \
build/operator-sdk-$(GIT_VERSION)-s390x-linux-gnu \
build/ansible-operator-$(GIT_VERSION)-aarch64-linux-gnu \
build/ansible-operator-$(GIT_VERSION)-x86_64-linux-gnu \
build/ansible-operator-$(GIT_VERSION)-x86_64-apple-darwin \
build/ansible-operator-$(GIT_VERSION)-ppc64le-linux-gnu \
build/ansible-operator-$(GIT_VERSION)-s390x-linux-gnu \
build/helm-operator-$(GIT_VERSION)-aarch64-linux-gnu \
build/helm-operator-$(GIT_VERSION)-x86_64-linux-gnu \
build/helm-operator-$(GIT_VERSION)-x86_64-apple-darwin \
build/helm-operator-$(GIT_VERSION)-ppc64le-linux-gnu \
build/helm-operator-$(GIT_VERSION)-s390x-linux-gnu

release: clean $(release_builds) $(release_builds:=.asc) ## Release the Operator SDK

Expand Down
6 changes: 1 addition & 5 deletions internal/cmd/operator-sdk/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func NewCmd() *cobra.Command {
}

func run() {
version := ver.GitVersion
if version == "unknown" {
version = ver.Version
}
fmt.Printf("operator-sdk version: %q, commit: %q, kubernetes version: %q, go version: %q, GOOS: %q, GOARCH: %q\n",
version, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion, runtime.GOOS, runtime.GOARCH)
ver.GitVersion, ver.GitCommit, ver.KubernetesVersion, ver.GoVersion, runtime.GOOS, runtime.GOARCH)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It will start to use the dev version as unknown. Am I right?

we need to update the e2e tests See: https://github.com/operator-framework/operator-sdk/blob/master/test/e2e-helm/e2e_helm_suite_test.go#L108-L109

Also, maybe the molecule shell as well.
Also, will the (+git) still or not? if not, then we need

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If the binary is built with the Makefile, this value will be the same as it has always been, because the Makefile will inject this value automatically.

Everything in the CI and release process uses the Makefile, so this shouldn't have any other impact.

Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 Sep 4, 2020

Choose a reason for hiding this comment

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

@joelanford,

The e2e tests as the shell scripts will run operator-sdk init to scaffold the projects. The version is used in the scaffolds (here).

Then, note that in the e2e test, for example, we replace the version.version+git by dev:https://github.com/operator-framework/operator-sdk/blob/master/test/e2e-helm/e2e_helm_suite_test.go#L107-L110

See the CI error faced in this PR: (unable to build the image)

    s: "make docker-build IMG=e2e-test/controller-manager:tfcf failed with error: make[1]: Entering directory '/home/travis/gopath/src/github.com/operator-framework/operator-sdk/test/e2e-helm/e2e-tfcf'\ndocker build . -t e2e-test/controller-manager:tfcf\nSending build context to Docker daemon  35.87MB\r\r\nStep 1/5 : FROM quay.io/operator-framework/helm-operator:\ninvalid reference format\nMakefile:42: recipe for target 'docker-build' failed\nmake[1]: *** [docker-build] Error 1\nmake[1]: Leaving directory '/home/travis/gopath/src/github.com/operator-framework/operator-sdk/test/e2e-helm/e2e-tfcf'\n",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I need to debug that. Theoretically, the correct value should have been injected into that operator-sdk binary used to run operator-sdk init. I'll pick this back up and rebase after #3856 is resolved because that's blocking everything from merging right now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@camilamacedo86 this PR is now updated, and all tests are now passing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@joelanford it broke the tests. It is passing because the test has been done with the 1.0.0 tag instead of the dev one.
it is no longer using the dev image :-(

change the Replace in test/utils/utils.go

// ReplaceInFile replaces all instances of old with new in the file at path.
func ReplaceInFile(path, old, new string) error {
	info, err := os.Stat(path)
	if err != nil {
		return err
	}
	b, err := ioutil.ReadFile(path)
	if err != nil {
		return err
	}
	if !strings.Contains(string(b), old) {
		return errors.New("unable to find the content to be replaced")
	}
	s := strings.Replace(string(b), old, new, -1)
	err = ioutil.WriteFile(path, []byte(s), info.Mode())
	if err != nil {
		return err
	}
	return nil
}

You will see that it will return the error unable to find the content to be replaced in all e2e tests.

}
2 changes: 1 addition & 1 deletion internal/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

//var needs to be used instead of const for ldflags
var (
Version = "v1.0.0+git"
Version = "unknown"
GitVersion = "unknown"
GitCommit = "unknown"
KubernetesVersion = "unknown"
Expand Down
2 changes: 0 additions & 2 deletions website/content/en/docs/contribution-guidelines/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ $ GEN_CHANGELOG_TAG=v1.3.0 make gen-changelog

Commit the following changes:

- `internal/version/version.go`: update `Version` to `v1.3.0`.
- `website/content/en/docs/installation/install-operator-sdk.md`: update the linux and macOS URLs to point to the new release URLs.
- `CHANGELOG.md`: commit changes (updated by changelog generation).
- `website/content/en/docs/upgrading-sdk-version/v1.3.0.md`: commit changes (created by changelog generation).
Expand Down Expand Up @@ -327,7 +326,6 @@ $ git push -f upstream v1.3.x

Check out a new branch from `master` or release branch and commit the following changes:

- `internal/version/version.go`: update `Version` to `v1.3.0+git`.
- **(Major and minor releases only)** `website/config.toml`: update `version_menu = "v1.3"` to `version_menu = "Releases"`.

---
Expand Down