Skip to content

Commit

Permalink
Add a tilt_inspector extension that lets you navigate internal tilt s…
Browse files Browse the repository at this point in the history
…tate (tilt-dev#166)
  • Loading branch information
nicks authored Apr 27, 2021
1 parent bdcb08b commit bfffccb
Show file tree
Hide file tree
Showing 11 changed files with 3,243 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ RUN curl -sSL https://github.com/google/ko/releases/download/v0.8.1/ko_0.8.1_Lin
mv ko /root/go/bin/ko && \
which ko

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt update && apt install -y yarn
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ test:
./test.sh

publish-ci-image:
cd .circleci && docker build -t tiltdev/tilt-extensions-ci .
cd .circleci && docker build --pull -t tiltdev/tilt-extensions-ci .
docker push tiltdev/tilt-extensions-ci
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ All extensions have been vetted and approved by the Tilt team.
- [`snyk`](/snyk): Use [Snyk](https://snyk.io) to test your containers, configuration files, and open source dependencies.
- [`syncback`](/syncback): Sync files/directories from your container back to your local FS.
- [`tests`](/tests): Some common configurations for running your tests in Tilt.
- [`tilt_inspector`](/tilt_inspector): Debugging server for exploring internal Tilt state.
- [`wait_for_it`](/wait_for_it): Wait until command output is equal to given output.

## Contribute an Extension
Expand Down
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ ko/test/test.sh

secret/test/test.sh
restart_process/test/test.sh
tilt_inspector/test/test.sh
tests/golang/test/test.sh
tests/javascript/test/test.sh
1 change: 1 addition & 0 deletions tilt_inspector/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
24 changes: 24 additions & 0 deletions tilt_inspector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Tilt Inspsector

Author: [Nick Santos](https://github.com/nicks)

A small debugging server for viewing internal Tilt state.

## Functions

### tilt_inspector(port: int = 11350)

Exposes a tilt inspector server at the given port.

## Example Usage

```
load('ext://tilt_inspector', 'tilt_inspector')
tilt_inspector()
```

## Other notes

Requires yarn/nodejs.

One tilt inspector server can inspect arbitrarily many tilt instances.
18 changes: 18 additions & 0 deletions tilt_inspector/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- mode: Python -*-

_dir = os.getcwd()

def tilt_inspector(port=11351):
# The tilt:inspector resource is currently a local server installed + run
# with Yarn.
#
# Ideally, it would be a docker container, but that would require some
# networking tricks to get the process in the container talking to Tilt.
local_resource(
name="tilt:inspector",
deps=[],
cmd='cd %s && yarn install' % _dir,
serve_env={'TILT_INSPECTOR_PORT': '%d' % port},
serve_cmd='cd %s && yarn run tilt-inspector' % _dir,
readiness_probe=probe(http_get=http_get_action(port=port)),
links=['http://localhost:%d/' % port])
6 changes: 6 additions & 0 deletions tilt_inspector/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"license": "Apache-2.0",
"dependencies": {
"@tilt.dev/tilt-inspector": "0.1.5"
}
}
3 changes: 3 additions & 0 deletions tilt_inspector/test/Tiltfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load('../Tiltfile', 'tilt_inspector')

tilt_inspector()
7 changes: 7 additions & 0 deletions tilt_inspector/test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cd $(dirname $0)

set -ex
tilt ci
tilt down --delete-namespaces
Loading

0 comments on commit bfffccb

Please sign in to comment.