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

Custom values porter build #1899

Conversation

joshuabezaleel
Copy link
Contributor

What does this change

Enable --custom flag on porter build command to set custom values during porter build.

porter-1789-custom-values-porter-build-08-02.mp4

What issue does it fix

#1789

Notes for the reviewer

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

joshuabezaleel and others added 26 commits February 8, 2022 23:28
TODO: Writing custom values to the Dockerfile
TODO: Handling boolean and integer types

Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: Mahendra Bishnoi <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: Mahendra Bishnoi <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
This binds the --driver flag for porter install|invoke|upgrade|uninstall
to the PORTER_RUNTIME_DRIVER environment variable used by the operator.

I had already done this for PORTER_BUILD_DRIVER, but missed adding
similar configuration bindings for runtime.

So in the config file, the user can set rutime-driver and build-driver.
The environment variables are named: PORTER_RUNTIME_DRIVER and
PORTER_BUILD_DRIVER. The flag though on any command is just --driver for
simplicity, e.g. porter install --driver kubernetes.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
…ot exist (getporter#1828)

* Porter triggers autobuild when detecting that invocation image does not exist

Signed-off-by: joshuabezaleel <[email protected]>

* 1. Change function name from IsInvocationImagExists to IsImageCached along with some explanation comment.
2. Use invocationImage directly as an input to list images
3. Wrap error from Docker SDK and remove error wrap on stamp.go
4. Fix wording to "local image cache" from "host registry"

Signed-off-by: joshuabezaleel <[email protected]>
The integration tests accidentally were passing nil for the context
after I added context.Context as a parameter to some Porter commands in getporter#1831.
This passes in context.Background to fix the nil pointer exceptions that
was causing.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
The mage/mixins package contains common magefile targets that all mixins
use: build, test, publish, etc. This minimizes the amount of custom
logic in our magefiles and should make it easier to manage the magefile
in all the mixins going forward.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Use the system porter that was installed by the EnsurePorter target.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Allow someone to just publish binaries or also publish a mixin feed.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Print out where we are publishing and explain what to do if you use
different repository names.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
First check if we have a local copy of porter and use that to generate a
mixin feed. Otherwise assume that porter is installed in the GOPATH.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
This PR adds missing double quotes for Telemetry struct tag so it can be
properly set if present.

Signed-off-by: Yingrong Zhao <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
I accidentally committed changes to the magefile that broke
connectivitiy between the test kind cluster and the local registry
running in docker. They need to be on the same network.

This adds back code that I thought wasn't needed anymore to get docker
pulls from localhost:5000 from inside the cluster working again.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
The porter agent used to print the porter version before executing the
requested command. When I rewrote the bash script as a go program, that
regressed and it stopped printing it out.

This adds that back.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
getporter#1864)

* pkg/{porter,tracing}, cmd/porter: add tracing instrumentation for list
command

This PR adds instrumentation for list command. It also adds support for
automatically setting span name during creation by the caller function
name.

Signed-off-by: Yingrong Zhao <[email protected]>

* add readability

Signed-off-by: Yingrong Zhao <[email protected]>

* use new interface for creating a span

Signed-off-by: Yingrong Zhao <[email protected]>

* add unit test

Signed-off-by: Yingrong Zhao <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
)

* Support uninstall through the installation apply command

Allow someone to manage the entire installation lifecycle with a file,
and not have to jump back to using uninstall. That causes problems when
people are scripting porter calls based on what's in a repo, for
example, they need to detect deleted files and treat them differently.
Also if the bundle is already uninstalled, calling uninstall twice
results in an error, whereas apply does the right thing.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Switch from active to uninstalled flag on installation

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Two pull requests, getporter#1864 and getporter#1851, were merged, and while it didn't cause a merge
conflict, they didn't play well together and it broke the build.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
Signed-off-by: Yingrong Zhao <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
* Consolidate rootLogger and scopedLogger

By only allowing the porter application context to create a root span,
we can consolidate rootlogger and scoped logger into a single
TraceLogger, and simplify logic around setting attributes on the root
span.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Allow for a variable stack size when finding the function name

Sometimes the stack looks like this when we ask for the calling function
name:

InstallBundle
  -> tracing.TraceLogger.StartSpan
    -> tracing.callerFunc

other times it looks like this
ExecuteBundle
-> tracing.StartSpan
  -> tracing.TraceLogger.StartSpan
    -> tracing.callerFunc

So I have tweaked how we look up the stack to keep checking until we
find a function that isn't in the tracing package

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Document more of the tracing package

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
* Standardize table printing

Only use a single table printing library, with support for proper column
wrapping when data is a column is very long. We have been having trouble
with column data being so wide the table is unreadable when the terminal
forces the text to wrap.

This also updates all of Porter to use the single library, which has a
slightly different output (it adds a line under the table headers). When
I went through and updated all the expected console output tests, I took
the opportuntity to use the improved test.CompareToGoldenFile helper,
which makes syncing the expected test output much easier.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Update code to use new table printer

Update tests to use test.CompareGoldenFile

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Improve test.CompareGoldenFile

When the golden file for a test doesn't exist, create it. This makes it
easier to get started using golden files without having to create the
empty file first. You can just edit the test to use that helper and it
will make the file for you when run with mage updatetestfiles

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
When porter explain prints a suggested installation command, it should
only include parameters that are required _and_ apply to the install
command. Parameters can be limited to only apply to a particular action
and if it doesn't apply to install, we don't want to tell people to
specify in for porter install.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: joshuabezaleel <[email protected]>
@joshuabezaleel joshuabezaleel force-pushed the custom-values-porter-build branch from bdcd919 to be1a298 Compare February 8, 2022 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants