-
Notifications
You must be signed in to change notification settings - Fork 35
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
refactor build tooling #114
Conversation
- enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114
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.
Looks good! Just one question about the Dockerfile.
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.
some notes to self
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.
Thanks for refactoring the build process.
Can you move the usage information above the develop information?
I like the changes to the pipeline, but I have concerns about the makefile:
- it adds maintenance complexity
- it's probably better to keep the publishing task to the ci/cd pipeline, vs documenting the publishing flow through the make file - now there are 2 ways to accomplish the same thing
- see other comment
usage : | ||
@echo "Usage:" | ||
@echo "" | ||
@echo " \$$ make check # run tests for required software" |
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.
is checking necessary - wouldn't the commands fail if it's not installed anyways, or does make hide the error message?
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 commands would fail, but the thinking behind these check-*
targets is that each could be added as a prerequisite to another target .. effectively becoming a hook to provide some feedback to a user about installing whatever dependency they're missing:
# compile binary
$(binary_name) : check-go # ...
if the user doesn't have go installed, we could include something like a link to install documentation
that said, not at all opposed to removing these.. is that what you'd prefer?
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.
Since it's written, let's keep it.
I think if it becomes a cause of errors then we can remove it then to reduce points of maintenance :)
This comment has been minimized.
This comment has been minimized.
- adds required `GCLOUD_SDK_VERSION` `--build-arg` to `Dockerfile` - removes `Dockerfile.1.10`, `Dockerfile.1.11` (can now be customized via `GCLOUD_SDK_VERSION` build arg) - removes `bin/dist`; replaced with `make`-based implementation - adds several misc config / rc files - updates `README`, `DOCS.md` to reflect changes, address linting refactor build tooling - adds required `GCLOUD_SDK_VERSION` `--build-arg` to `Dockerfile` - removes `Dockerfile.1.10`, `Dockerfile.1.11` (can now be customized via `GCLOUD_SDK_VERSION` build arg) - removes `bin/dist`; replaced with `make`-based implementation - adds several misc config / rc files - updates `README`, `DOCS.md` to reflect changes, address linting Apply suggestions from code review Co-Authored-By: Chris Montoro <[email protected]>
- remove cloud-sdk stage from Dockerfile - remove bin/install-kubectl ; add installation steps inline within Dockerfile - replaced references to CLOUD_SDK_VERSION / GCLOUD_SDK_VERSION with GCLOUD_SDK_TAG - move developer focused documentation to CONTRIBUTING.md - move .PHONY blocks to the line above each related target definition - add coverage.out make target - add check for go v 1.12+ - rename docker-release, docker-run-local make targets - add terraform integration to automate test resource provisioning - update DOCS.md to support deep links to individual parameters within API reference - update local-example app, image, API_TOKEN variable names to avoid potential confusion with drone-gke parameters
- enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114
- enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114
Yes. |
* `vars` - variables to use in `template` and `secret_template` (see [below](#available-vars) for details) | ||
* `secrets` - credential and variables to use in `secret_template` (see [below](#secrets) for details) | ||
* *optional* `expand_env_vars` - expand environment variables for values in `vars` for reference (defaults to `false`) | ||
### `image` |
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.
This is very verbose, I'd like to stick to the original format, or in the drone plugins registry format:
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.
is there any automation built around those formats? happy to use a less verbose alternative, just thinking it would be helpful to enable deep linking directly to a specific parameter's documentation..
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.
AFAIK no there isn't.
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.
hm if there isn't any automation built around the previous format or the other formats used, is there a functional downside to these changes (aside from the more verbose markdown source)?
in addition to the deep links, i think some folks might find the in-context example
s helpful.. for a concrete case, i myself had to view the source of the plugin to find out how to use the wait_deployments
option (do i provide a string? if so, separated by what character? there aren't any other options that accept an array of values so it wasn't clear that this one was expected to be provided as such) .. for another, i wasn't aware that values within vars
could be any arbitrary value (e.g., could include more than the primitive string / int types).. that might have been more obvious if the type info was included in the docs for each option
@@ -68,7 +417,7 @@ If connecting to a [zonal cluster](https://cloud.google.com/kubernetes-engine/do | |||
|
|||
The `zone` and `region` parameters are mutually exclusive; providing both to the plugin for the same execution will result in an error. | |||
|
|||
## Secrets | |||
## Using `secrets` |
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.
👍
"namespace": "", | ||
"project": "my-gcp-proj", | ||
"zone": "us-east1-a" | ||
"BRANCH": "master", |
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.
👍
|
||
Executing locally from the working directory: | ||
|
||
``` | ||
```sh |
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.
👍
|
||
spec: | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
app: {{.app}} | ||
app: {{.app_name}} |
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.
can we keep this as {{.app}}
?
env: {{.env}} | ||
spec: | ||
containers: | ||
- name: app | ||
image: {{.image}} | ||
image: {{.app_image}} |
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.
and this as {{.image}}
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.
so while working with the project and documenting a few commands / parameters, i noticed this (as well as the {{.app}}
and {{.API_TOKEN}}
references) were potentially confusing
specifically, it seemed like folks might be easily confused between{{.API_TOKEN}}
and secrets: { source: GOOGLE_CREDENTIALS, target: token }
especially when looking for token
and seeing references to both the SA credential use case and the secretRef
use case.. same with the k8s container spec image
use case and the drone step image
use case, as well as in the k8s container spec name
use and the pod spec label
use case..
more generally, the idea here was to try and distinguish between references related to a user's use case and references related to the plugin's use case..
mind elaborating a bit on your concerns here?
@@ -0,0 +1,21 @@ | |||
root = true |
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.
Sure you want to check this in?
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.
@oliver-nyt happy to remove, but i think projects tend to set this to prevent configurations higher up in the filesystem tree (e.g, user settings) from resulting in auto generated changes that may not be desired within the project.. here are a few selected examples from the projects listed here:
wdyt? keep or remove?
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.
Your call. I personally don't like checking in user tools specific stuff like editor configs (this is for VSCode only, right?) but I see your point, it makes life of some users easier. Interesting that so many projects do it.
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.
editorconfig isn't specific to vscode: https://editorconfig.org/#download 😁
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 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.
I second @oliver-nyt's comment on Go version, LGTM otherwise 🚀
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.
One question about check-go
, because if failed locally 😬
@oliver-nyt @fsouza re: the version of go there, i was basing that off of Line 3 in 483e946
happy to remove the golang version checks if thats going to be a pain point |
- enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114
- enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114
@tonglil @fsouza @oliver-nyt any other feedback / requested changes here, or is everyone comfortable merging at this point? |
Go for it |
good to go! |
- enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114
* add new `kubectl_version` param - enables running the plugin using a non-default `kubectl` executable - updates image `ENTRYPOINT` to support setting of `EXTRA_KUBECTL_VERSIONS` environment variable used by plugin to validate against `kubectl_version` depends on #114 * update DOCS * update validation implementation, docs; add new option to make run target * rename entrypoint to set-env-versions
Summary
Adds required
GCLOUD_SDK_TAG
--build-arg
toDockerfile
.Removes
Dockerfile.1.10
,Dockerfile.1.11
; thecloud-sdk
version (and by proxy, thekubectl
version) can / must now be customized via the newGCLOUD_SDK_VERSION
build arg.Removes
bin/dist
; replaced withmake
-based implementation.Adds several misc config / rc files (e.g.,
.dockerignore
,.editorconfig
, etc).Updates
README
,DOCS.md
to reflect changes, address lint issues.Motivation
This changeset evolved from the changes included in #115 and the primary motivation was to enable a tighter local development cycle / shorter iterations. These changes were separated from #115 primarily to simplify code review.
With these two changes, we may be able to address improvements / feature requests (e.g., #29 , #104 , #105 , etc) with less friction, barriers to entry for new contributors, more flexibility, etc.