-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Use shared Task definitions #40
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
Conversation
Taskfile.yaml
Outdated
| excludes: | ||
| - test | ||
| - test-envtest-dep | ||
| - build:bin:val:test | ||
| - build-raw | ||
| - build:bin:build-raw | ||
| # put task names in here which are overwritten in this file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| excludes: | |
| - test | |
| - test-envtest-dep | |
| - build:bin:val:test | |
| - build-raw | |
| - build:bin:build-raw | |
| # put task names in here which are overwritten in this file |
Probably not needed, see below.
Taskfile.yaml
Outdated
| common: # imported a second time so that overwriting task definitions can call the overwritten task with a 'c:' prefix | ||
| taskfile: hack/common/Taskfile_controller.yaml | ||
| internal: true | ||
| aliases: | ||
| - c | ||
| vars: | ||
| NESTED_MODULES: api | ||
| API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...' | ||
| MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests' | ||
| CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...' | ||
| COMPONENTS: 'control-plane-operator' | ||
| REPO_URL: 'https://github.com/openmcp-project/control-plane-operator' | ||
| GENERATE_DOCS_INDEX: "true" | ||
| ENVTEST_REQUIRED: "true" | ||
| ENVTEST_K8S_VERSION: "1.30.0" | ||
|
|
||
| tasks: | ||
| test: | ||
| desc: " Run all tests." | ||
| run: once | ||
| aliases: | ||
| - build:bin:val:test | ||
| vars: | ||
| NESTED_MODULES: api | ||
| API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...' | ||
| MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests' | ||
| CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...' | ||
| COMPONENTS: 'control-plane-operator' | ||
| REPO_URL: 'https://github.com/openmcp-project/control-plane-operator' | ||
| GENERATE_DOCS_INDEX: "true" | ||
| ENVTEST_REQUIRED: "true" | ||
| ENVTEST_K8S_VERSION: "1.30.0" | ||
| deps: | ||
| - test-envtest-dep | ||
| cmds: | ||
| - 'PROJECT_ROOT="{{.ROOT_DIR2}}" NESTED_MODULES="{{.NESTED_MODULES}}" ENVTEST_K8S_VERSION="{{.ENVTEST_K8S_VERSION}}" {{.TASKFILE_DIR2}}/run-tests.sh {{.CODE_DIRS}}' | ||
|
|
||
| test-envtest-dep: | ||
| desc: " Install the envtest dependency, if marked as required." | ||
| run: once | ||
| status: | ||
| - '[ "{{.ENVTEST_REQUIRED | default "false"}}" != "true" ]' | ||
| cmds: | ||
| - task: tools:envtest | ||
| vars: | ||
| ENVTEST_REQUIRED: "true" | ||
| internal: true | ||
|
|
||
| build-raw: | ||
| desc: " Build the binary. Opposed to the regular build, this one just builds and skips code generation/validation tasks." | ||
| summary: | | ||
| This task builds the binary for the current operating system and architecture. | ||
| To overwrite this, set the 'OS' and 'ARCH' environment variables. | ||
| The binary is saved in the 'bin' folder, as $COMPONENT.$OS-$ARCH. | ||
| aliases: | ||
| - build:bin:build-raw | ||
| cmds: | ||
| - for: | ||
| var: COMPONENTS | ||
| as: COMPONENT | ||
| cmd: 'CGO_ENABLED=0 GOOS={{.OS}} GOARCH={{.ARCH}} go build -a -o {{.ROOT_DIR2}}/bin/{{.COMPONENT}}.{{.OS}}-{{.ARCH}} {{.ROOT_DIR2}}/cmd/main.go' No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| common: # imported a second time so that overwriting task definitions can call the overwritten task with a 'c:' prefix | |
| taskfile: hack/common/Taskfile_controller.yaml | |
| internal: true | |
| aliases: | |
| - c | |
| vars: | |
| NESTED_MODULES: api | |
| API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...' | |
| MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests' | |
| CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...' | |
| COMPONENTS: 'control-plane-operator' | |
| REPO_URL: 'https://github.com/openmcp-project/control-plane-operator' | |
| GENERATE_DOCS_INDEX: "true" | |
| ENVTEST_REQUIRED: "true" | |
| ENVTEST_K8S_VERSION: "1.30.0" | |
| tasks: | |
| test: | |
| desc: " Run all tests." | |
| run: once | |
| aliases: | |
| - build:bin:val:test | |
| vars: | |
| NESTED_MODULES: api | |
| API_DIRS: '{{.ROOT_DIR}}/api/v1beta1/...' | |
| MANIFEST_OUT: '{{.ROOT_DIR}}/api/crds/manifests' | |
| CODE_DIRS: '{{.ROOT_DIR}}/cmd/... {{.ROOT_DIR}}/internal/... {{.ROOT_DIR}}/test/... {{.ROOT_DIR}}/api/v1beta1/...' | |
| COMPONENTS: 'control-plane-operator' | |
| REPO_URL: 'https://github.com/openmcp-project/control-plane-operator' | |
| GENERATE_DOCS_INDEX: "true" | |
| ENVTEST_REQUIRED: "true" | |
| ENVTEST_K8S_VERSION: "1.30.0" | |
| deps: | |
| - test-envtest-dep | |
| cmds: | |
| - 'PROJECT_ROOT="{{.ROOT_DIR2}}" NESTED_MODULES="{{.NESTED_MODULES}}" ENVTEST_K8S_VERSION="{{.ENVTEST_K8S_VERSION}}" {{.TASKFILE_DIR2}}/run-tests.sh {{.CODE_DIRS}}' | |
| test-envtest-dep: | |
| desc: " Install the envtest dependency, if marked as required." | |
| run: once | |
| status: | |
| - '[ "{{.ENVTEST_REQUIRED | default "false"}}" != "true" ]' | |
| cmds: | |
| - task: tools:envtest | |
| vars: | |
| ENVTEST_REQUIRED: "true" | |
| internal: true | |
| build-raw: | |
| desc: " Build the binary. Opposed to the regular build, this one just builds and skips code generation/validation tasks." | |
| summary: | | |
| This task builds the binary for the current operating system and architecture. | |
| To overwrite this, set the 'OS' and 'ARCH' environment variables. | |
| The binary is saved in the 'bin' folder, as $COMPONENT.$OS-$ARCH. | |
| aliases: | |
| - build:bin:build-raw | |
| cmds: | |
| - for: | |
| var: COMPONENTS | |
| as: COMPONENT | |
| cmd: 'CGO_ENABLED=0 GOOS={{.OS}} GOARCH={{.ARCH}} go build -a -o {{.ROOT_DIR2}}/bin/{{.COMPONENT}}.{{.OS}}-{{.ARCH}} {{.ROOT_DIR2}}/cmd/main.go' |
I remember that I did this somewhere and you probably copied it from there, but I couldn't find it right now.
When I did this, the envtest stuff was not contained in the library, so it had to be added by these overwrites. By now, it is contained (see https://github.com/openmcp-project/build/blob/main/tasks_val.yaml#L23-L41), which means that simply setting ENVTEST_REQUIRED to "true" should be enough. Then, no overwrites are required, which means that the second include isn't required either (because it is only needed to refer to the original implementation in the overwrites).
This theory needs to be validated by running task test without the marked lines, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is not envtest itself, the problem is that this particular instance expects the ENVTEST_K8S_VERSION environment variable which is not available to the run-test.sh script. running task test is what started all this :D
docs/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this and disable documentation index generation for now, see remark above.
pkg/utils/envtest/envtest.go
Outdated
| if len(version) != 0 { | ||
| return version, nil | ||
| } | ||
| // fall back to reading the makefile! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no Makefile anymore, so this fallback needs to be adapted or removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CRDs were previously under config/crd/bases, where they are now not updated anymore. My proposal would be to make the aforementioned path a symlink to api/crds/manifests.
Co-authored-by: Johannes Aubart <[email protected]>
Co-authored-by: Johannes Aubart <[email protected]>
|
I understand the problem with the But I think we will get this to work somehow, with a few hacky modifications to the shared coding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
This PR changes the artifact paths from
ghcr.io/openmcp-project/github.com/openmcp-project/...toghcr.io/openmcp-project/....Release note: