-
Notifications
You must be signed in to change notification settings - Fork 1.8k
test/test-framework: add go.mod, go.sum and build/Dockerfile #2202
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
Changes from all commits
97f80b4
3f5e543
c467813
8586d45
3191ee4
f0bc771
61db2dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,23 +8,22 @@ set -ex | |
|
||
source hack/lib/test_lib.sh | ||
|
||
# Define vars | ||
DOCKERFILE="build/Dockerfile" | ||
|
||
# Go inside of the mock data test project | ||
cd test/test-framework | ||
|
||
# Create the required files in the mock test/test-framework just to allow run from it the oprator-sdk commands | ||
echo > $DOCKERFILE | ||
go mod init test-framework | ||
|
||
# Remove files that are required and created just to exec the commands. | ||
trap_add 'rm -rf $DOCKERFILE go.mod go.sum' EXIT | ||
# Ensure test-framework is up-to-date with current Go project dependencies. | ||
# NOTE: the SDK dependency version still needs updating on a new release. | ||
sdk_version="$(go list -m -f '{{.Version}}' github.com/operator-framework/operator-sdk)" | ||
../../build/operator-sdk print-deps > go.mod | ||
sed -i 's|github.com/operator-framework/operator-sdk\s*master||g' go.mod | ||
echo -e "\nreplace github.com/operator-framework/operator-sdk => ../../" >> go.mod | ||
go mod edit -require "github.com/operator-framework/operator-sdk@${sdk_version}" | ||
go build ./... | ||
go mod tidy | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tidy is already run in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure that helps us. Does If we include it here, a developer can run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see what you mean. It does not. I will add it here. |
||
# Run gen commands | ||
../../build/operator-sdk generate k8s | ||
../../build/operator-sdk generate openapi | ||
|
||
# TODO(camilamacedo86): remove this when the openapi gen be set to false and it no longer is generated | ||
# The following file is gen by openapi but it has not been committed in order to allow we clone and call the test locally in any path. | ||
trap_add 'rm pkg/apis/cache/v1alpha1/zz_generated.openapi.go' EXIT | ||
trap_add 'rm pkg/apis/cache/v1alpha1/zz_generated.openapi.go' EXIT | ||
../../build/operator-sdk generate openapi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest | ||
|
||
ENV OPERATOR=/usr/local/bin/memcached-operator \ | ||
USER_UID=1001 \ | ||
USER_NAME=test-framework | ||
|
||
# install operator binary | ||
COPY build/_output/bin/test-framework ${OPERATOR} | ||
|
||
COPY build/bin /usr/local/bin | ||
RUN /usr/local/bin/user_setup | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint"] | ||
|
||
USER ${USER_UID} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module github.com/operator-framework/operator-sdk/test/test-framework | ||
|
||
go 1.13 | ||
|
||
require ( | ||
github.com/operator-framework/operator-sdk v0.12.1-0.20191114194531-79e6369540c6 | ||
github.com/spf13/pflag v1.0.3 | ||
k8s.io/api v0.0.0 | ||
k8s.io/apimachinery v0.0.0 | ||
k8s.io/client-go v11.0.0+incompatible | ||
sigs.k8s.io/controller-runtime v0.3.0 | ||
) | ||
|
||
// Pinned to kubernetes-1.15.4 | ||
replace ( | ||
k8s.io/api => k8s.io/api v0.0.0-20190918195907-bd6ac527cfd2 | ||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918201827-3de75813f604 | ||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190817020851-f2f3a405f61d | ||
k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190918200908-1e17798da8c1 | ||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190918202139-0b14c719ca62 | ||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190918200256-06eb1244587a | ||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20190918203125-ae665f80358a | ||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20190918202959-c340507a5d48 | ||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190612205613-18da4a14b22b | ||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190918200425-ed2f0867c778 | ||
k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190817025403-3ae76f584e79 | ||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20190918203248-97c07dcbb623 | ||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20190918201136-c3a845f1fbb2 | ||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20190918202837-c54ce30c680e | ||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20190918202429-08c8357f8e2d | ||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20190918202713-c34a54b3ec8e | ||
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20190918202550-958285cf3eef | ||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20190918203421-225f0541b3ea | ||
k8s.io/metrics => k8s.io/metrics v0.0.0-20190918202012-3c1ca76f5bda | ||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20190918201353-5cc279503896 | ||
) | ||
|
||
replace github.com/operator-framework/operator-sdk => ../../ |
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.
TIL about this command! If there's equivalent go code, maybe in a future PR, we should consider outputting this version in the
go.mod
scaffold directly. Though maybe it's moot with the kubebuilder transition.