liquid-labs / liquid-labs/contained-core
Migrate common code from contained-chrome
- Dominant language
- No language data
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Overview
[contained-chrome](https://github.com/liquid-labs/contained-chrome) has a number of common elements that we want to move into this project.
## Deliverables
### Setup skeleton `contained`
* Migrate [`contained-chrome.sh`](https://github.com/liquid-labs/contained-chrome/tree/master/src/cli/contained-chrome.sh) -> `run` action
* [ ] Remove default `IMAGE` value and require an image reference be provided.
* [ ] Update [reference to 'contained-chrome'](https://github.com/liquid-labs/contained-chrome/blob/3584617a70d08804503be8b6974eea8fdfb9bd7b/src/cli/contained-chrome.sh#L74) to `contained-core`
* [ ] delete `contained-chrome.sh`
* [ ] Update `contained-chrome` docs to describe using `contained-core` and `contained`.
* incorporate [`docker-publish.sh`](https://github.com/liquid-labs/contained-chrome/blob/master/src/tools/docker-publish.sh) into `contained dev publish [--release]`
* [ ] add `contained` section to [`contained-chrome/package.json`](https://github.com/liquid-labs/contained-chrome/blob/master/package.json)
* [ ] add `repo` section under `contained`; this will be `theliquidlabs/contained-chrome` in this case.
* [ ] Implement logic for 'dev'
* extract the image name from `package.json` `contained.repository`.
* for dev, just push the already dev-tagged image
* [ ] for release, tag the current dev image with `latest` and extract the semver from `package.json` and also tag that; push both the semver and latest tagged images
* [ ] Using `bash-toolkit` options processing (TODO: link), add a `--repository` option to the 'publish' action. This will override the `package.json` value. (We'll use it for testing later.)
### Move common bootstrap code
* Migrate `contained-chrome/src/docker/bootstrap.sh` to `contained-core/src/docker/contained-bootstrap.sh`
* [ ] build `contained-bootstrap.sh` (using `bash-rollup`) to `dist/dev/contained-bootstrap.sh`
* [ ] delete `contained-chrome/src/docker/bootstrap.sh`
### Move common Docker image
* [ ] Create `contained-core/src/docker/Dockerfile` and copy the [`contained-chrome/src/docker/Dockerfile`](https://github.com/liquid-labs/contained-chrome/blob/master/src/docker/Dockerfile) to get started
* change references from `bootstrap.sh` to `contained-bootstrap.sh`
* [ ] Test and ensure `contained dev publish --repository myhubname/contained-core` is working
* [ ] * [ ] Test and ensure `contained dev publish --repository myhubname/contained-core --release` is working
## Result
* We will have a new `contained` executable.
* Most of the commands will be placeholders, you should be able to run `contained list`, `contained run` etc. and get a `TOOD` response.
* `contained dev build`, `dev publish`, and `dev publish --release` will work.
## Notes
### contained setup
* `npm i --save-dev @liquid-labs/bash-rollup @liquid-labs/bash-toolkit`
* Refer to [the `liq-cli/.../dispatch.sh](https://github.com/liquid-labs/liq-cli/blob/master/src/liq/dispatch.sh) to for how to setup a dispatch function.
* For now, you can define the dispatch function right in the `contained.sh` script, we'll clean that up later.
* The dispatch essentially examines the arguments to determine a handler function. So 'contained foo bar` would look for a handler function like `foo-bar'. One change we want to make, though, is to prepend our handlers with `contained`, so if you start with a copy and paste, then modify the logic to include `contained-` as part of the handler function name.
* include `import strict` at the top of the script.
* To setup the build create a `Makefile`, refer to the [`liq.sh` build directive](https://github.com/liquid-labs/liq-cli/blob/b2c430090b816bc50ae91480631f7228c0efea32/Makefile#L35). In this case, there's only the one dependency file, so we'll have something like:
```
dist/contained.sh: src/cli/contained.sh
mkdir -p dist
$(BASH_ROLLUP) $< $@
```
* Setup the `BASH_ROLLUP` Makefile var as in the liq-cli Makefile.
* Create handler functions for each of the actions/group actions like:
```bash
contained-list() { echo TODO; }
contained-dev-publish() {
# publish code goes here
}
# etc.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing contained-chrome/src/cli/contained-chrome.sh, contained-chrome/src/docker/bootstrap.sh, and contained-chrome/src/docker/Dockerfile with the target contained-core layout. Read the package.json and Makefile guidance alongside the bash-rollup and bash-toolkit references. Done means the contained executable, bootstrap script, Docker image, and dev/release publish flows meet the listed Result and testing requirements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, docker
- Domain
- build-system, cli, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100