Comments (10)
Sounds good to me! Only few comments:
/scripts/doc_envbuilder_flags.go
- maybe go with a dedicated directory in case we add more scripts with multiple files, so /scripts/docsgen/main.go
I'm wondering if tests can be ignored here since it is not a critical flow.
Yeah I would assume so as in this case results, generated docs, could be reviewed manually in PRs.
Add a step in the CI to check if the README is updated with the latest flags.
Yes, must have.
from envbuilder.
Ammar created coder/serpent to build nice CLI interfaces. If you need to adjust structures, I would recommend migrating to this project, and...
that matches solution no 2. with a separate property for description. Maybe consider building the docsgen for serpent as a new OSS project?
from envbuilder.
Ammar created coder/serpent to build nice CLI interfaces. If you need to adjust structures, I would recommend migrating to this project, and...
I like this idea 👍
that matches solution no 2. with a separate property for description. Maybe consider building the docsgen for serpent as a new OSS project?
I like this idea too, but I would make it a separate issue/milestone.
from envbuilder.
@mtojek my plans for this task:
- Create a go script in
/scripts/doc_envbuilder_flags.go
that adds all the flags to the README. - I'm wondering if tests can be ignored here since it is not a critical flow.
- Add a step in the CI to check if the README is updated with the latest flags.
Do you think these steps make sense?
from envbuilder.
The current Options
structure looks like this:
type Options struct {
// SetupScript is ran as the root user prior to the init script.
// It is used to configure envbuilder dynamically during the runtime.
// e.g. specifying whether to start `systemd` or `tiny init` for PID 1.
SetupScript string `env:"SETUP_SCRIPT"`
}
From this current structure I can get the flag name: SETUP_SCRIPT
and the type: string
but I can't get the description as it is a comment. At first, I can see two options:
1. Create a tag called desc
and add it to the option.
type Options struct {
SetupScript string `env:"SETUP_SCRIPT" desc:"SetupScript is ran as the root user prior to the init script. It is used to configure envbuilder dynamically during the runtime. e.g. specifying whether to start 'systemd' or 'tiny init' for PID 1."`
}
This option doesn't require major code changes, but having the description as a single-line string can be difficult to read.
2. Create another type to encapsulate each option
type Option struct {
Env string
Description string
Type interface{}
}
type Options struct {
SetupScript Option{
Env: "SETUP_SCRIPT",
Description: `
SetupScript is ran as the root user prior to the init script.
It is used to configure envbuilder dynamically during the runtime.
e.g. specifying whether to start 'systemd' or 'tiny init' for PID 1
`,
Type: string,
}
}
This would require extra changes to the envbuilder module, which in itself isn't a bad thing, but I want to avoid adding unnecessary complexity.
@mtojek thoughts?
from envbuilder.
@mtojek taking a closer look at the envbuilder code, it looks like envbuilder was not intended to be a CLI 😅 so it might make sense to update its types internally.
from envbuilder.
Technically yes, but you can map ENV variables to CLI flags 👍
from envbuilder.
I'd be in favor of allowing all envbuilder settings to be adjusted with both flags and environment variables. This may also help in testing envbuilder functionality.
Also, if you're looking to parse Go source files @BrunoQuaresma, I'd recommend taking a look at: https://github.com/dave/dst. Utilizing that, you can get comments as well.
from envbuilder.
I'd be in favor of allowing all envbuilder settings to be adjusted with both flags and environment variables. This may also help in testing envbuilder functionality.
This would be much simpler :)
Also, if you're looking to parse Go source files @BrunoQuaresma, I'd recommend taking a look at: https://github.com/dave/dst.
Please nooo ... :D
from envbuilder.
Ok, after some thought I'm going to play around with the idea of transforming envbuilder into a CLI using coder/serpent.
I will share my progress here over the next few days.
from envbuilder.
Related Issues (20)
- Gitlab oauth2:token being written to .git/config file after cloning HOT 1
- Support all (or most) Kaniko flags
- Write RFC around performance/caching improvements
- Option to specify build path for Dockerfile
- Update Dev Containers docs and example templates in Coder HOT 1
- ☂️ v1.0 release
- Investigate feasibility of `docker-compose` support HOT 1
- chore: avoid unnecessary image pulls while testing HOT 1
- Investigate GPU support HOT 14
- Running envbuilder CLI on a local laptop may destroy the filesystem HOT 7
- publish envbuilder binary HOT 3
- Explore buildah in place of kaniko HOT 1
- Test CLI output against a golden file
- Test to validate that envs given previously will still produce the same options now in Serpent
- Keep the comments on the struct and instead go generate the serpent descriptions from those HOT 1
- Warn if clean up does not work when removing Docker config file.
- no Dockerfile or devcontainer.json found: no fallback image has been specified HOT 2
- (breaking) Prefix all envbuilder environment variables with ENVBUILDER_ HOT 11
- Flake: TestBuildFromDevcontainerInRoot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from envbuilder.