Commit Graph

2140 Commits

Author SHA1 Message Date
James Shubin
c83e2cb877 git: Add a small ignore entry 2025-03-17 21:51:45 -04:00
James Shubin
642c6b952f lang: core, funcs: Port some functions to CallableFunc API
Some modern features of our function engine and language might require
this new API, so port what we can and figure out the rest later.
2025-03-16 23:23:57 -04:00
James Shubin
f313380480 engine: resources: Container stopped should be valid for no container 2025-03-13 01:03:11 -04:00
James Shubin
f8a4751290 engine: resources: Don't prematurely error docker watches
A subtlety about the engine is that while it guarantees CheckApply
happens in the listed edge-based dependency order, it doesn't stop
Watch from starting up in whatever order it wants to. As a result, we
can prematurely error since the docker service isn't running yet. It may
in fact be in the process of getting installed and started by mgmt
before we then try and use this resource! As a result, let it error once
for free and wait for CheckApply to get going before we start again.

Keep in mind, Watch has to use the .Running() method once to tell
CheckApply to do its initial event. So this concurrency is complex!

It's unclear if this is a bug in mgmt or not, but I'm leaning towards
not, particularly since there isn't an obvious way to fix it.
2025-03-12 06:14:38 -04:00
James Shubin
3ca1aa9cb1 engine: resources: Fix backwards docker ports
This wasn't setup properly, now it's fixed. Woops.
2025-03-12 05:45:27 -04:00
James Shubin
37308b950b cli, gapi: Add more information that deploy is running
There can be a non-obvious pause, so give some hint here...
2025-03-12 05:45:26 -04:00
James Shubin
05306e3729 engine: resources: Modernize the docker resources
They made the assumption that there would be a based docker service
installed at Init which could not be guaranteed. Also use the internal
metaparameter timeout feature instead of private counters.
2025-03-12 05:45:26 -04:00
James Shubin
a6057319a9 lang: Make scope error messages be more consistent 2025-03-12 03:33:08 -04:00
James Shubin
87d8533bd0 lib: Patch out the mess when using our magic option 2025-03-11 04:53:08 -04:00
James Shubin
dce83efa96 etcd: Add a special magic option hack
Workaround some legacy code for now.
2025-03-11 04:53:08 -04:00
James Shubin
1cb9648b08 etcd: Workaround possible rare deadlock
This code is terrible, but maybe this is good enough for now.
2025-03-11 04:18:03 -04:00
James Shubin
17b859d0d7 cli, gapi, lang, lib: Add a flag to skip autoedges
The GAPI API is a bit of a mess, but I think this seems to work for
standalone run and also deploys. Hopefully I didn't add any unnecessary
extra dead code here, but that's archaeology for another day.
2025-03-11 04:18:03 -04:00
James Shubin
8d34910b9b modules: prometheus: Fix title of service template 2025-03-11 04:18:02 -04:00
James Shubin
5667fec410 modules: prometheus: Remove erroneous tmpl extension 2025-03-11 04:18:02 -04:00
James Shubin
46035fee83 engine: resources: Add simple configuration steps to virt builder
This adds some simplistic configuration management / provisioning
functionality to this virt:builder resource which makes it easier to
kick off special functionality that we might want to build.
2025-03-11 04:18:02 -04:00
James Shubin
219d25b330 engine: resources, modules: virtualization: Add a seeds option
This makes it easier to configure the machine by giving it an automatic
initial setup of an mgmt client.
2025-03-11 04:18:02 -04:00
James Shubin
181aab9c81 engine: resources: Fix small cmp typo in virt builder res 2025-03-10 19:01:05 -04:00
James Shubin
aabcaa7c8c setup: Error if no options are specified 2025-03-10 18:31:20 -04:00
James Shubin
09f3b8c05f setup: Add seeds and no server feature
We will want both of these for most clustered setups.
2025-03-10 16:24:18 -04:00
James Shubin
f5e2fde20d cli, lib: Fix typo 2025-03-10 16:23:56 -04:00
James Shubin
50bd6f5811 lib, gapi, cli: Add a wait flag to empty and a new default
Change the default "wait" state for if you run the empty frontend when
there's already an available deploy waiting. You almost certainly want
to start running it right away.

Example:

mgmt etcd

mgmt run --hostname h1 --no-server --tmp-prefix --seeds=http://127.0.0.1:2379 empty
mgmt run --hostname h2 --no-server --tmp-prefix --seeds=http://127.0.0.1:2379 empty

mgmt deploy --no-git --seeds=http://127.0.0.1:2379 lang examples/lang/hello0.mcl

mgmt run --hostname h3 --no-server --tmp-prefix --seeds=http://127.0.0.1:2379 empty

In fact, you don't even need to start up etcd first for this to all
work.
2025-03-10 14:56:42 -04:00
James Shubin
37e5a37045 setup: Fix firstboot typo 2025-03-09 15:55:58 -04:00
James Shubin
8544a66257 lang: Allow more than one possible error in tests
There are some rare situations with completely symmetrical graphs which
mean that there isn't a "more correct" error. This is due to the
annoying map iteration non-determinism, and so instead of fighting to
remove every bit of that, let's just accept more than one error here.
2025-03-09 03:03:37 -04:00
James Shubin
a50765393d lang: ast: Catch ordering errors 2025-03-09 01:50:28 -05:00
James Shubin
6bae5fc561 pgraph: Make our slow toposort even slower
I think this makes it more deterministic, but I'm not sure it matters,
since we are comparing based in the .String() property, and some nodes
have the same value, so it ends up depending on the order they're added
to the graph datastructure, but then we lose this information since it's
a map. Yuck.
2025-03-09 01:50:28 -05:00
James Shubin
f87c550be1 lang: ast, interfaces: Improve speculation safety checks
We want to speculate in more cases, so make sure that speculation is
safe!
2025-03-08 17:45:29 -05:00
James Shubin
aea894a706 lang: ast: Add more context to pointer errors
This makes debugging easier. We don't expect these errors to occur with
normal usage.
2025-03-08 17:45:29 -05:00
James Shubin
a549a30f71 lang: ast: Add more context to table errors
This makes debugging easier. We don't expect these errors to occur with
normal usage.
2025-03-08 17:45:29 -05:00
James Shubin
2899bc234a lang: Add a forkv loop statement for iterating over a map
This adds a forkv statement which is used to iterate over a map with a
body of statements. This is an important data transformation tool which
should be used sparingly, but is important to have.

An import statement inside of a forkv loop is not currently supported.
We have a simple hack to detect the obvious cases, but more deeply
nested scenarios probably won't be caught, and you'll get an obscure
error message if you try to do this.

This was incredibly challenging to get right, and it's all thanks to Sam
for his brilliance.

Note, I couldn't think of a better keyword that "forkv" but suggestions
are welcome if you think you have a better idea. Other ideas were formap
and foreach, but neither got me very excited.
2025-03-08 17:45:29 -05:00
James Shubin
cf7e73bbf6 lang: Add a for loop statement for iterating over a list
This adds a for statement which is used to iterate over a list with a
body of statements. This is an important data transformation tool which
should be used sparingly, but is important to have.

An import statement inside of a for loop is not currently supported. We
have a simple hack to detect the obvious cases, but more deeply nested
scenarios probably won't be caught, and you'll get an obscure error
message if you try to do this.

This was incredibly challenging to get right, and it's all thanks to Sam
for his brilliance.

Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
2025-03-08 17:45:29 -05:00
James Shubin
c456a5ab97 lang: types: Add some length methods for list and map 2025-03-06 16:55:55 -05:00
James Shubin
b5ae96e0d4 lang: types: Add some helpful true and false values
In case we need one, we don't need to build it.
2025-03-06 16:55:55 -05:00
James Shubin
f792facde9 lang: gapi: Debug stalled graph errors
This makes debugging these scenarios a lot easier.
2025-03-05 17:24:26 -05:00
James Shubin
a64e3ee179 misc: Add baddev tooling
I think this is the *wrong* way to build this, but it's perfectly legal
to have a feature branch with this committed that people can develop
against. We can always cherry-pick off those commits to merge them, and
we can update and rebase this commit over time when needed.
2025-02-27 17:18:39 -05:00
James Shubin
c5257dd64b lang: parser: Simplify code and format it
This would get done by gofmt -s anyways.
2025-02-27 17:13:31 -05:00
James Shubin
f74bc969ca make: Cleanup old targets 2025-02-27 17:01:37 -05:00
Edward Toroshchyn
63d7b8e51e engine: resources: exec: Fix wrong err variable being checked in test 2025-02-27 14:50:38 -05:00
James Shubin
d56896cb0d lang: core: Simplify list and map lookup default functions 2025-02-26 19:59:47 -05:00
James Shubin
d579787bcd lang: core: Simplify list and map lookup functions 2025-02-26 19:59:47 -05:00
James Shubin
37fffce9f5 lang: core: Simplify implementation of the "contains" function 2025-02-26 18:12:38 -05:00
James Shubin
d7ecc72b41 lang: ast, gapi, interfaces, parser: Print line numbers on error
This adds an initial implementation of printing line numbers on type
unification errors. It also attempts to print a visual position
indicator for most scenarios.

This patch was started by Felix Frank and finished by James Shubin.

Co-authored-by: Felix Frank <Felix.Frank.de@gmail.com>
2025-02-25 20:15:02 -05:00
James Shubin
f754bbbf90 git: Add more entries to gitignore file 2025-02-25 12:10:04 -05:00
Felix Frank
bb171ced86 misc: Add missing sudo invocation 2025-02-24 10:43:43 -05:00
Edward Toroshchyn
c25a2a257b misc: Fix typos and spelling errors 2025-02-24 16:01:46 +01:00
Lourenço
1f90de31e7 lang: core: net: Add a new func for URL parsing
This is a first attempt to add a new function for URL parsing, using
go's net/url package and the simple API. This is still a barebones
implementation, there's possibility to expose more information. It also
includes simple tests.
2025-02-19 13:35:20 +01:00
Lourenço
b5384d1278 engine: resources: Adding logic for svc unit state
This is a small patch that adds logic for checking what's the state of
the unit file and making the CheckApply function more robust
2025-02-18 17:14:27 -05:00
James Shubin
d80ec4aaa7 engine: resources: Detect simple self-referential frags
It would be a likely mistake to create a self-referential frag, and mgmt
would spin forever updating the file... We probably don't want this, so
let's just catch this case in Validate.

Of course you could get around this with multiple files, and a fancier
search could statically check the graph, but the goal isn't to prevent
any bad code, since that's not likely to be possible.
2025-02-15 06:58:15 -05:00
James Shubin
5d63376087 modules: meta: Remove duplicate line 2025-02-13 06:33:47 -05:00
James Shubin
4fd6ced287 docs: Add new talks from Belgium, 2025 2025-02-10 10:34:53 -05:00
James Shubin
82489c3fe0 engine: resources: Add shell field to user resource 2025-02-07 18:08:25 -05:00