Skip to content

Commit

Permalink
Add oranda and build website
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPickering committed Jan 26, 2024
1 parent 3dd6e76 commit 0356699
Show file tree
Hide file tree
Showing 21 changed files with 988 additions and 616 deletions.
19 changes: 8 additions & 11 deletions .env-select.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[applications.server.profiles.base]
variables = {PROTOCOL = "https"}

[applications.server.profiles.dev]
extends = ["base"]
variables = {SERVICE1 = "dev", SERVICE2 = "also-dev"}
[applications.server.profiles.base1]
pre_export = [{setup = "echo base1 setup", teardown = "echo base1 teardown"}]

[applications.server.profiles.prd]
extends = ["base"]
[applications.server.profiles.prd.variables]
SERVICE1 = "prd"
SERVICE2 = "also-prd"
SERVICE3 = {type = "file", path = "creds.env", multiple = true}
[applications.server.profiles.base2]
pre_export = [{setup = "echo base2 setup", teardown = "echo base2 teardown"}]

[applications.server.profiles.child]
extends = ["base1", "base2"]
pre_export = [{setup = "echo child setup", teardown = "echo child teardown"}]
98 changes: 98 additions & 0 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Workflow to build your docs with oranda (and mdbook)
# and deploy them to Github Pages
name: Web

# We're going to push to the gh-pages branch, so we need that permission
permissions:
contents: write

# What situations do we want to build docs in?
# All of these work independently and can be removed / commented out
# if you don't want oranda/mdbook running in that situation
on:
# Check that a PR didn't break docs!
#
# Note that the "Deploy to Github Pages" step won't run in this mode,
# so this won't have any side-effects. But it will tell you if a PR
# completely broke oranda/mdbook. Sadly we don't provide previews (yet)!
pull_request:

# Whenever something gets pushed to main, update the docs!
# This is great for getting docs changes live without cutting a full release.
#
# Note that if you're using cargo-dist, this will "race" the Release workflow
# that actually builds the Github Release that oranda tries to read (and
# this will almost certainly complete first). As a result you will publish
# docs for the latest commit but the oranda landing page won't know about
# the latest release. The workflow_run trigger below will properly wait for
# cargo-dist, and so this half-published state will only last for ~10 minutes.
#
# If you only want docs to update with releases, disable this, or change it to
# a "release" branch. You can, of course, also manually trigger a workflow run
# when you want the docs to update.
push:
branches:
- master

# Whenever a workflow called "Release" completes, update the docs!
#
# If you're using cargo-dist, this is recommended, as it will ensure that
# oranda always sees the latest release right when it's available. Note
# however that Github's UI is wonky when you use workflow_run, and won't
# show this workflow as part of any commit. You have to go to the "actions"
# tab for your repo to see this one running (the gh-pages deploy will also
# only show up there).
workflow_run:
workflows: ["Release"]
types:
- completed

# Alright, let's do it!
jobs:
web:
name: Build and deploy site and docs
runs-on: ubuntu-latest
steps:
# Setup
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@v2

# If you use any mdbook plugins, here's the place to install them!

# Install and run oranda (and mdbook)
# This will write all output to ./public/ (including copying mdbook's output to there)
- name: Install and run oranda
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/oranda/releases/download/v0.6.1/oranda-installer.sh | sh
oranda build
- name: Prepare HTML for link checking
# untitaker/hyperlink supports no site prefixes, move entire site into
# a subfolder
run: mkdir /tmp/public/ && cp -R public /tmp/public/oranda

- name: Check HTML for broken internal links
uses: untitaker/[email protected]
with:
args: /tmp/public/

# Deploy to our gh-pages branch (creating it if it doesn't exist)
# the "public" dir that oranda made above will become the root dir
# of this branch.
#
# Note that once the gh-pages branch exists, you must
# go into repo's settings > pages and set "deploy from branch: gh-pages"
# the other defaults work fine.
- name: Deploy to Github Pages
uses: JamesIves/[email protected]
# ONLY if we're on main (so no PRs or feature branches allowed!)
if: ${{ github.ref == 'refs/heads/main' }}
with:
branch: gh-pages
# Gotta tell the action where to find oranda's output
folder: public
token: ${{ secrets.GITHUB_TOKEN }}
single-commit: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/target

# Generated by `oranda generate ci`
public/
182 changes: 182 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,185 @@
### Removed

- [BREAKING] Removed Kubernetes value source

## [0.11.0] - 2023-08-24

### Breaking Changes

- Remove the concept of native commands
- The `command` value source is effectively gone, and the `shell` value source type has to renamed to `command` to replace the old one
- In other words, the `shell` type is gone and the `command` field for the `command` type now takes a string instead of a `string[]`
- Side effects can now only be shell commands (string literals)
- This is to reduce the overall complexity of the tool. I don't thi
nk there's a strong use case for native commands, where you can't just use shell commands

### New Features

- Add `cwd` option to `command` value source type, to force the command to execute in a particular directory
- Modifications to the `PATH` variable will be prepended to the existing value, rather than replacing it
- This special behavior is based on the variable name, and only applies to `PATH`

## [0.10.0] - 2023-08-15

### Breaking Changes

- Cascading config files are now only merged down to the profile level

### New Features

- Added side effects. See usage docs for more. Imperative environment configuration!

### Other

- Sourceable output from `es set` is now written to a temporary file instead of stdout. This difference is handled by the shell functions, so no change to behavior for users

## [0.9.0] - 2023-07-31

### Breaking Changes

- `es show` is now broken into sub-subcommands: `es show config` and `es show shell`
- Unknown keys in config will now be rejected

### New Features

- Add `--run-in-shell` flag to `es run`
- `es run` and `es set` no longer require an application name in the command; if not given, they will prompt, the same way they prompt for profile name

### Other

- Provide more context if the subprocess in `es run` fails

## [0.8.0] - 2023-07-18

### New Features

- Load multiple values from a single source with the `multiple` flag
- Supported for all value source types
- `file` value source, which loads value(s) from a file path (combine with `multiple = true` for maximum fun!)
- Support non-string primitives for simple literal values
- E.g. `VARIABLE1 = 123` or `VARIABLE2 = false`
- These values will simply be stringified before export, since shells only understand strings anyway

### Other

- Improve test coverage!

## [0.7.0] - 2023-07-13

This should be the last release with major breaking changes. The config layout has changed dramatically in order to support planned (and unplanned) future features.

### Breaking Changes

- Removed `vars` config section. You can no longer provide mappings for single variables. Instead, define a set of profiles with single variables
- This feature didn't provide any additional functionality, it was just a slight convenience at the cost of complexity both for users and code
- Restructured profile config:
- Renamed `apps` field to `applications`
- Add new `profiles` and `variables` subfields
- Overall, this means `apps.app1.profile1.VARIABLE1` will now be `applications.app1.profiles.profile1.variables.VARIABLE1`
- This is more tedious, but allows for current and future features to fit into the config

### New Features

- Profile inheritance - profiles can now extend other profiles, eliminating the need to copy-paste a bunch of common content between profiles

### Other

- `es` shell function definitions now use the full path to the `env-select` binary rather than relying on `PATH`
- This eliminates the need to add `env-select` to the `PATH`, and also guarantees that the copy of `env-select` that is being executed by `es` is the one that generated that `es` definition in the first place

## [0.6.2] - 2023-07-08

### Other

- Fix binaries being built for the wrong architecture

## [0.6.1] - 2023-07-08

### Other

- Defer shell path loading until it's needed. This will enable env-select init on systems that don't have the specified shell present

## [0.6.0] - 2023-07-08

I tried to fit all the foreseeable breaking changes into this release, there may be some more though.

### Breaking Changes

- Complex value sources (i.e. anything other than a simple string) now require the `type` field. E.g. `type = "literal"` or `type = "command"`
- As value sources get more intricate, options start to collide. This field makes it easy to disambiguate between source types, which allows them to have overlapping option names
- Rename `--shell-path` option _back_ to `--shell`, and it once again only requires a shell name, rather than a full path
- The full path for the shell will be grabbed via the `which` command now. This means whatever shell you use must be in your `PATH`
- Rename `command` value source type to `shell`
- The old `command` name is now used for commands that are executed natively

### New Features

- Add `run` subcommand, for one-off environment usage
- This runs a single command in the configured environment, rather than modifying the shell environment. Similar to `kubectl exec` or `poetry run`
- Add `command` value source type, which accepts an array of strings and executes a command natively, rather than via the shell
- Add `kubernetes` value source type, which executes a command in a kubernetes pod via `kubectl`
- Support complex literal values, enabling the `sensitive` option for literals
- This option probably isn't that useful, but now the field is supported globally
- Add a third level of verbosity (`-vvv`) to enable more granularity in log filtering

### Other

- Fix macOS x86 build in CI (the binary will appear on releases now)
- Add a bunch of tests

## [0.5.0] - 2023-06-30

### New Features

- Shell configuration can now be loaded from `env-select init` function. Add this to your shell startup script to load it automatically. See installation instructions for more info.
- `--shell-path` option allows you to override the `$SHELL` variable. This is rarely necessary, mostly useful for debugging.
- Print configured variables to stderr to give some feedback when running `es set`
- Add `sensitive` option to `command` value source, to mask data in information output
- Support additional verbosity level with `-vv`

### Other

- Dynamic commands are now executed within the scope of env-select . Env-select will run your shell as a subprocess to execute the command, rather than print out a templated string (e.g. `$(echo def)`) to invoke a subshell. This reduces the surface area for bugs, and opens up options new kinds of dynamic values.

## [0.4.1] - 2023-06-25

### Other

Fixed release process. Binaries for 0.4.0 are attached to this release

## [0.4.0] - 2023-06-25

### Breaking Changes

- Renamed binary from `es` to `env-select` (to facilitate shell plugins using `es`)
- Moved main functionality under `env-select set` subcommand

### New Features

- Added fish plugin
- Added `show` subcommand

### Bug Fixes & Tweaks

- Emit non-zero exit code for errors
- Print available variables and applications for bare `env-select set` or an invalid variable/application name

## [0.3.0] - 2023-06-25

### New Features

- Add `command` variant for values, allowing lazily evaluated commands instead of static values

### Other

- Add `aarch64-apple-darwin` to release build
- Upgrade to rust 1.67.1

## [0.2.0] - 2022-11-12

- Reorient schema around named profiles (breaking change)
- Fix terminal cursor disappearing after ctrl-c (#5)
- Allow passing profile name (or literal value, for single variables) as a cmd arg to skip interactive prompt (#3)
- Give profiles/variables consistent ordering in prompt (#2)
- Clean up error handling a bit
- Lots of doc improvements
Loading

0 comments on commit 0356699

Please sign in to comment.