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

Switch to a singleton Shell resetter #126

Merged
merged 36 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
12dfea7
Switch to a singleton Shell resetter
fenollp May 30, 2022
55fd74a
drop = sign in pastseed
fenollp Apr 23, 2023
c3afea3
bump minor
fenollp Apr 23, 2023
174b963
ran: make update
fenollp Jul 28, 2023
a2a748e
update github actions
fenollp Jul 28, 2023
4f4bd18
.goreleaser.yml: upgrade
fenollp Jul 28, 2023
88f4dad
add dependabot
fenollp Jul 28, 2023
6b9ed34
test fixes
fenollp Jul 28, 2023
7f4a792
move demo model to a more useful place
fenollp Jul 28, 2023
6e86098
fix cwid suffix thingy
fenollp Jul 28, 2023
98865c4
upgrade protoc things
fenollp Jul 28, 2023
ce9f252
un-global selectedResetters under rt struct
fenollp Jul 28, 2023
5f2a6f4
have reset action return both errors
fenollp Jul 28, 2023
c01836a
fixup tests
fenollp Jul 28, 2023
6d4760f
pass that test
fenollp Jul 28, 2023
e923d79
cleanup
fenollp Jul 28, 2023
a5af0a4
ouip
fenollp Jul 28, 2023
606ae67
pass
fenollp Jul 29, 2023
1dcc4d5
rename
fenollp Jul 29, 2023
e032ee2
cleanup
fenollp Jul 29, 2023
64a8a0c
ouipe
fenollp Jul 31, 2023
63b8a7d
mention timeout on exec timeout
fenollp Aug 3, 2023
2d3362b
make update
fenollp Aug 4, 2023
aeeb09f
oouip
fenollp Aug 15, 2023
845e54a
cleanup
fenollp Aug 15, 2023
9d511b9
fix race
fenollp Aug 16, 2023
3808bc0
cleanup test
fenollp Aug 16, 2023
48e3def
encapsulate
fenollp Aug 16, 2023
df69a05
getting closer
fenollp Aug 16, 2023
339f4e5
cleanup
fenollp Aug 18, 2023
781d716
Shower
fenollp Aug 18, 2023
bf85fc6
trimspace
fenollp Aug 18, 2023
f31c35a
move things around
fenollp Aug 18, 2023
f1c37cf
move things around
fenollp Aug 18, 2023
f29a992
nits
fenollp Aug 18, 2023
8b84b1a
randomize shell resetter coms
fenollp Aug 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:

- package-ecosystem: 'github-actions'
open-pull-requests-limit: 10
directory: '/'
schedule:
interval: 'daily'

- package-ecosystem: 'docker'
open-pull-requests-limit: 10
directory: '/'
schedule:
interval: 'daily'

- package-ecosystem: 'gomod'
open-pull-requests-limit: 10
directory: '/'
schedule:
interval: 'daily'

# - package-ecosystem: 'cargo'
# open-pull-requests-limit: 10
# directory: '/'
# schedule:
# interval: 'daily'
10 changes: 5 additions & 5 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ jobs:
env:
SLUG: ${{ github.repository }}

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set TAG
run: grep -F . Tagfile && echo TAG=$(cat Tagfile) >>$GITHUB_ENV

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v2.9.1

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/bake-action@v1.7.0
- uses: docker/bake-action@v3.1.0
with:
files: ./docker-bake.hcl
targets: goreleaser-dist
Expand All @@ -49,7 +49,7 @@ jobs:
./monkey version | grep -F $(cat Tagfile)
./monkey --version | grep -F $(cat Tagfile)

- uses: ncipollo/release-action@v1
- uses: ncipollo/release-action@v1.12.0
if: github.ref == 'refs/heads/master'
with:
artifacts: ./dist/*
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
tagfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # For $ git tag

- name: Ensure Tagfile is usable
run: grep -E '^[0-9]+[.][0-9]+[.][0-9]+$' Tagfile

- name: Checkout master Tagfile
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: master
path: ./master-Tagfile
Expand All @@ -40,8 +40,8 @@ jobs:
check-goimports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
- uses: actions/checkout@v3
- uses: actions/setup-go@v4.0.1
with:
go-version: '>=1.17.0'
- run: go install github.com/incu6us/goimports-reviser/[email protected]
Expand All @@ -52,8 +52,8 @@ jobs:
check-nillness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
- uses: actions/checkout@v3
- uses: actions/setup-go@v4.0.1
- run: go run golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest ./...

checks:
Expand All @@ -74,18 +74,18 @@ jobs:
env:
SLUG: ${{ github.repository }}

- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: docker/setup-buildx-action@v1
- uses: docker/setup-buildx-action@v2.9.1

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/bake-action@v1.7.0
- uses: docker/bake-action@v3.1.0
with:
files: ./docker-bake.hcl
targets: ${{ matrix.check }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ jobs:
buildkit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Ensure download script is in the right path
run: test -f .godownloader.sh

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
# TODO - godownloader -r FuzzyMonkeyCo/monkey -o .godownloader.sh .goreleaser.yml
- name: Run shellcheck
uses: ludeeus/action-shellcheck@1.1.0
uses: ludeeus/action-shellcheck@2.0.0
with:
check_together: 'yes'
severity: error
6 changes: 3 additions & 3 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
command: version
github_token: ${{ secrets.github_token }}
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: lint
uses: FuzzyMonkeyCo/setup-monkey@v1
with:
Expand All @@ -39,7 +39,7 @@ jobs:
with:
command: version
github_token: ${{ secrets.github_token }}
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: lint
uses: FuzzyMonkeyCo/setup-monkey@v1
with:
Expand All @@ -58,7 +58,7 @@ jobs:
with:
command: version
github_token: ${{ secrets.github_token }}
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: lint
uses: FuzzyMonkeyCo/setup-monkey@v1
with:
Expand Down
26 changes: 9 additions & 17 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,17 @@ builds:
-X github.com/FuzzyMonkeyCo/monkey/pkg/internal/fm.grpcHost={{.Env.GRPCHOST}}

archives:
- replacements:
# https://en.wikipedia.org/wiki/Uname
# uname -m compatible.
386: i386
amd64: x86_64
# uname -s compatible.
# arm64: aarch64
darwin: Darwin
dragonfly: DragonFly
freebsd: FreeBSD
linux: Linux
netbsd: NetBSD
openbsd: OpenBSD
windows: Windows
format_overrides:
- format_overrides:
- goos: windows
format: zip
# name_template: '{{.ProjectName}}-{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}'
name_template: '{{.ProjectName}}-{{.Os}}-{{.Arch}}'
# uname -m + uname -s compatible
# TODO: arm64: aarch64
name_template: >-
{{ .ProjectName }}-
{{- title .Os }}-
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
files:
- LICENSE
- README.md
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
ARG PREBUILT

# Fetched 2022/04/04
FROM --platform=$BUILDPLATFORM docker.io/library/alpine@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4 AS alpine
FROM --platform=$BUILDPLATFORM docker.io/library/alpine@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1 AS alpine
FROM --platform=$BUILDPLATFORM docker.io/nilslice/protolock@sha256:baf9bca8b7a28b945c557f36d562a34cf7ca85a63f6ba8cdadbe333e12ccea51 AS protolock
FROM --platform=$BUILDPLATFORM docker.io/library/golang@sha256:660f138b4477001d65324a51fa158c1b868651b44e43f0953bf062e9f38b72f3 AS golang
FROM --platform=$BUILDPLATFORM docker.io/goreleaser/goreleaser@sha256:05ee558b6a6114557b11a16fc0bfa2483287208c9977fc8840cc8c82d01fea92 AS goreleaser
FROM --platform=$BUILDPLATFORM docker.io/goreleaser/goreleaser@sha256:841e919e53acd9190197938b0b705158593dd3be74715b2b1be22716bd9bffe1 AS goreleaser
# On this image:
# go env GOCACHE => /root/.cache/go-build
# go env GOMODCACHE => /go/pkg/mod
Expand Down Expand Up @@ -101,9 +101,9 @@ RUN \
# Not using ADD as a network call is always performed
&& mkdir -p /wellknown/google/protobuf \
&& curl -#fsSLo /wellknown/google/protobuf/struct.proto https://raw.githubusercontent.com/protocolbuffers/protobuf/2f91da585e96a7efe43505f714f03c7716a94ecb/src/google/protobuf/struct.proto \
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0 \
&& go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@0ae748fd2007a8ade11db4174599f4ba967b3f37
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31.0 \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0 \
&& go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@v0.4.0
COPY pkg/internal/fm/*.proto .
RUN \
--mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ OpenAPIv3(
# Invariants of our APIs expressed in a Python-like language

assert that(monkey.env("TESTING_WHAT", "demo")).is_equal_to("demo")
SPEC = "pkg/modeler/openapiv3/testdata/jsonplaceholder.typicode.comv1.0.0_openapiv3.0.1_spec.yml"
SPEC = "pkg/runtime/testdata/jsonplaceholder.typicode.comv1.0.0_openapiv3.0.1_spec.yml"
print("Using {}.".format(SPEC))

monkey.openapi3(
Expand Down
2 changes: 1 addition & 1 deletion Tagfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.47.0
0.48.0
99 changes: 99 additions & 0 deletions bla.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/bin/bash -eu

# # echo a
# # echo b
# # exec echo c
# # exec echo d

# declare -p
# source /tmp/.monkey_5916184413087258808_00000000000000000005.env >/dev/null 2>&1
# set -o errexit
# set -o errtrace
# set -o nounset
# set -o pipefail
# set -o xtrace

# ./vault/bin/vault server -dev -dev-root-token-id='root' -address='http://127.0.0.1:8200' -exit-on-core-shutdown &
# # export vault_pid=$!
# vault_pid=$!

# # Wait until server is up
# until curl --output /dev/null --silent --fail -H 'X-Vault-Token: root' http://127.0.0.1:8200/v1/sys/internal/specs/openapi; do
# sleep .1
# done

# set +o xtrace
# set +o pipefail
# set +o nounset
# set +o errtrace
# set +o errexit
# declare -p > /tmp/.monkey_5916184413087258808_00000000000000000005.env


set -o errexit
set -o errtrace
set -o nounset
set -o pipefail

# master <- master$UUID.script
# slave <- slave$UUID.script
# ltime <- get master mtime
# loop
# mtime <- get master mtime
# if deleted
# break
# if mtime > ltime
# ltime <- mtime
# set -o xtrace
# source $(cat master)
# set +o xtrace
# touch slave
# sleep .5 TODO: don't poll



# while :; do
for i in $(seq 1 3); do
# source /tmp/.monkey_5916184413087258808_00000000000000000005_vault_dev.script
# source <(
# set -o xtrace
# echo 'echo a'
# )

set -o xtrace

source a.sh
source <(
echo 'source b.sh'
)
source c.sh

set +o xtrace
break
done

# ..._$UUID.script
# i <- ..._$UUID.script.i
# o <- ..._$UUID.script.o
while :; do
if ! script=$(cat "$i"); then
# File was deleted
break
fi

if [[ -z "$script" ]]; then
sleep 1
continue
fi

set -o xtrace
source "$script"
set +o xtrace
touch "$o"
done
rm -f "$i" "$o" ...self...
# Go side: https://stackoverflow.com/a/21508289
# or https://github.com/fsnotify/fsnotify

create loop script from template with hard paths
spawn loop in background
4 changes: 2 additions & 2 deletions do_pastseed.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
rt "github.com/FuzzyMonkeyCo/monkey/pkg/runtime"
)

var rePastseed = regexp.MustCompile(rt.PastSeedMagic + `=([^\s]+)`)
var rePastseed = regexp.MustCompile(rt.PastSeedMagic + ` ([^\s]+)`)

// Looks in the logs for the youngest seed that triggered a bug
// Only ever prints best seed on a newline character
// Only ever prints best seed and a newline character
// so it can be used as --seed=$(monkey pastseed)
func doPastseed(starfile string) int {
for offset := uint64(1); true; offset++ {
Expand Down
2 changes: 1 addition & 1 deletion fuzzymonkey.star
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Invariants of our APIs expressed in a Python-like language

assert that(monkey.env("TESTING_WHAT", "demo")).is_equal_to("demo")
SPEC = "pkg/modeler/openapiv3/testdata/jsonplaceholder.typicode.comv1.0.0_openapiv3.0.1_spec.yml"
SPEC = "pkg/runtime/testdata/jsonplaceholder.typicode.comv1.0.0_openapiv3.0.1_spec.yml"
print("Using {}.".format(SPEC))

monkey.openapi3(
Expand Down
Loading