Commit Graph

537 Commits

Author SHA1 Message Date
c0f81d03d4 Enable reconciliator on entitlements change
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
2025-03-04 09:55:39 +00:00
df743e6961 Add prebuild claim test
Some checks failed
Deploy PR / check_pr (push) Has been cancelled
Deploy PR / get_info (push) Has been cancelled
Deploy PR / comment-pr (push) Has been cancelled
Deploy PR / build (push) Has been cancelled
Deploy PR / deploy (push) Has been cancelled
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
2025-03-03 14:29:56 +00:00
59d406f3b2 Merge branch 'dk/prebuilds' of github.com:/coder/coder into dk/prebuilds-tests 2025-03-03 12:46:44 +00:00
242a67bf1d Merge branch 'jjs/prebuilds' of https://github.com/coder/coder into jjs/prebuilds 2025-03-03 10:23:38 +00:00
e16d763241 add tests to ensure that preubilds are correctly provisioned for active template versions 2025-03-03 10:20:47 +00:00
be166ea239 Merge branch 'dk/prebuilds' of https://github.com/coder/coder into jjs/prebuilds 2025-03-03 08:01:04 +00:00
39fc179203 WIP: claim integration test
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
2025-02-28 15:35:57 +00:00
6c2eb32552 WIP: db tests 2025-02-28 11:00:55 +00:00
964fe891c9 Merge remote-tracking branch 'origin/dk/prebuilds' into jjs/prebuilds
Some checks failed
Deploy PR / check_pr (push) Has been cancelled
Deploy PR / get_info (push) Has been cancelled
Deploy PR / comment-pr (push) Has been cancelled
Deploy PR / build (push) Has been cancelled
Deploy PR / deploy (push) Has been cancelled
2025-02-28 09:31:39 +00:00
499c688c19 Skipping on non-postgres run
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
2025-02-28 08:12:04 +00:00
b21fbc3740 add prebuild controller tests
Some checks are pending
Deploy PR / check_pr (push) Waiting to run
Deploy PR / get_info (push) Blocked by required conditions
Deploy PR / comment-pr (push) Blocked by required conditions
Deploy PR / build (push) Blocked by required conditions
Deploy PR / deploy (push) Blocked by required conditions
2025-02-28 06:03:57 +00:00
5e32ed22ac Merge branch 'main' of github.com:coder/coder into dk/prebuilds
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-26 14:31:56 +02:00
4e1e745912 add prebuild metrics and observability
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-25 11:17:10 +00:00
697c99d8cf add prebuild metrics and observability 2025-02-25 09:18:15 +00:00
5e854da331 add prebuild metrics and observability 2025-02-25 09:13:00 +00:00
a87e12750e More tests
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-25 07:36:40 +00:00
e005e4e51d chore: merge provisioner key and provisioner permissions (#16628)
Provisioner key permissions were never any different than provisioners.
Merging them for a cleaner permission story until they are required (if
ever) to be seperate.

This removed `ResourceProvisionerKey` from RBAC and just uses the
existing `ResourceProvisioner`.
2025-02-24 13:31:11 -06:00
546a549dcf feat: enable soft delete for organizations (#16584)
- Add deleted column to organizations table
- Add trigger to check for existing workspaces, templates, groups and
members in a org before allowing the soft delete

---------

Co-authored-by: Steven Masley <stevenmasley@gmail.com>
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
2025-02-24 12:59:41 -05:00
fad3f23791 Correct queries; running prebuilds only needs to return current preset ID
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-24 16:19:08 +00:00
e9b56d9346 WIP: adding unit-tests for reconciliation loop
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-24 16:15:21 +00:00
44d12aa722 Refactoring reconciliation loop into control & logic, adding initial (incomplete) tests
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-21 14:34:58 +00:00
d1b159ad12 Merge branch 'main' of github.com:/coder/coder into dk/prebuilds 2025-02-20 14:57:50 +00:00
4d97580666 Decompose GetTemplatePrebuildState into separate queries, reimplement logic in Go
This is in service of testability

Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-20 14:57:17 +00:00
9469b78290 fix!: enforce regex for agent names (#16641)
Underscores and double hyphens are now blocked. The regex is almost the
exact same as the `coder_app` `slug` regex, but uppercase characters are
still permitted.
2025-02-20 05:09:26 +00:00
64d476545b Merge branch 'main' of github.com:/coder/coder into dk/prebuilds
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-19 15:42:15 +00:00
7d949e5ee0 Log lock acquisition time for https://github.com/coder/internal/issues/371
Setting default claimer to avoid panics

Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-19 11:00:22 +00:00
9dd9fedc12 Implement strict prebuilds eligibility
See https://github.com/coder/internal/issues/372

Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-18 09:39:04 +00:00
e9fdd86c45 Merge branch 'jjs/presets' of github.com:/coder/coder into dk/prebuilds 2025-02-18 08:32:25 +00:00
0a94405c3f Move prebuilds code to enterprise top-level package, refactor into agpl pointers
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-18 08:20:17 +00:00
7498980c5f Hide prebuilds behind premium license & experiment
Signed-off-by: Danny Kopping <danny@coder.com>
2025-02-17 13:03:56 +00:00
7f061b9faf fix(coderd): add stricter authorization for provisioners endpoint (#16587)
References #16558
2025-02-17 14:34:47 +02:00
77306f3de1 feat(coderd): add filters and fix template for provisioner daemons (#16558)
This change adds provisioner daemon ID filter to the provisioner daemons
endpoint, and also implements the limiting to 50 results.

Test coverage is greatly improved and template information for jobs
associated to the daemon was also fixed.

Updates #15084
Updates #15192
Related #16532
2025-02-14 17:26:46 +02:00
d0a534e30d chore: prevent authentication of non-unique oidc subjects (#16498)
Any IdP returning an empty field here breaks the assumption of a
unique subject id. This is defined in the OIDC spec.
2025-02-10 09:31:08 -06:00
0e2ae10b47 feat: add additional patch routes for group and role idp sync (#16351) 2025-01-31 12:14:24 -07:00
6ea5c6f0ef fix: show user-auth provisioners for all organizations (#16350) 2025-01-30 14:08:27 -07:00
b256b204d0 feat: add endpoint for partial updates to org sync field and assign_default (#16337) 2025-01-30 13:55:17 -07:00
2371153a37 feat: add endpoint for partial updates to org sync mapping (#16316) 2025-01-30 10:52:50 -07:00
92d22e296b chore: track usage of organizations in telemetry (#16323)
Addresses https://github.com/coder/internal/issues/317.

## Changes

Requirements are quoted below:

> how many orgs does deployment have

Adds the Organization entity to telemetry.

> ensuring resources are associated with orgs

All resources that reference an org already report the org id to
telemetry. Adds a test to check that.

> whether org sync is configured

Adds the `IDPOrgSync` boolean field to the Deployment entity.

## Implementation of the org sync check

While there's an `OrganizationSyncEnabled` method on the IDPSync
interface, I decided not to use it directly and implemented a
counterpart just for telemetry purposes. It's a compromise I'm not happy
about, but I found that it's a simpler approach than the alternative.
There are multiple reasons:

1. The telemetry package cannot statically access the IDPSync interface
due to a circular import.
2. We can't dynamically pass a reference to the
`OrganizationSyncEnabled` function at the time of instantiating the
telemetry object, because our server initialization logic depends on the
telemetry object being created before the IDPSync object.
3. If we circumvent that problem by passing the reference as an
initially empty pointer, initializing telemetry, then IDPSync, then
updating the pointer to point to `OrganizationSyncEnabled`, we have to
refactor the initialization logic of the telemetry object itself to
avoid a race condition where the first telemetry report is performed
without a valid reference.

I actually implemented that approach in
https://github.com/coder/coder/pull/16307, but realized I'm unable to
fully test it. It changed the initialization order in the server
command, and I wanted to test our CLI with Org Sync configured with a
premium license. As far as I'm aware, we don't have the tooling to do
that. I couldn't figure out a way to start the CLI with a mock license,
and I didn't want to go down further into the refactoring rabbit hole.

So I decided that reimplementing the org sync checking logic is simpler.
2025-01-29 15:54:31 +01:00
c069563af1 test: fix use of t.Logf where t.Log would suffice (#16328) 2025-01-29 14:35:04 +00:00
76adde91dc fix(provisioner/terraform/tfparse): allow empty values in coder_workspace_tag defaults (#16303)
* chore(docs): update docs re workspace tag default values
* chore(coderdenttest): use random name instead of t.Name() in newExternalProvisionerDaemon
* fix(provisioner/terraform/tfparse): allow empty values in coder_workspace_tag defaults
2025-01-28 09:11:39 +00:00
5841c0aacb fix: fetch custom roles from workspace agent context (#16237) 2025-01-23 12:57:09 -06:00
f34e6fd92c chore: implement 'use' verb to template object, read has less scope now (#16075)
Template `use` is now a verb.
- Template admins can `use` all templates (org template admins same in
org)
- Members get the `use` perm from the `everyone` group in the
`group_acl`.
2025-01-17 11:55:41 -06:00
f32f7c6862 test(enterprise/coderd): fix ctx init in multiple workspace tests (#16176) 2025-01-17 14:33:58 +00:00
3a81aac318 chore(enterprise/coderd): use filesystem mirror for providers in TestWorkspaceTagsTerraform (#16155)
Fixes https://github.com/coder/internal/issues/266 (hopefully)

Each instance of this test has to download the coder/coder Terraform
provider.
To mitigate this, only download the providers once using a
`filesystem_mirror` (ref:
https://developer.hashicorp.com/terraform/cli/config/config-file#provider-installation)
2025-01-15 20:27:18 +00:00
12991ff43e fix(coderd): change the order of precedence between coder_workspace_tags and request tags (#16119)
This PR switches the order of precedence of workspace tags when posting
a template version.
Previously, user-specified tags in the request could not override those
detected from our parsing of the template file. Now, they can do.

This addresses a customer issue where were attempting to set a workspace
tag via variable.

Note: there is a possible follow-up item here where we could pass in the
workspace tag values from the request into `tfparse` and let it take
those user-specified values into account. This is covered in a separate
test.
2025-01-14 16:43:42 +00:00
071bb26018 feat(coderd): add endpoint to list provisioner daemons (#16028)
Updates #15190
Updates #15084
Supersedes #15940
2025-01-14 16:40:26 +00:00
5e88289493 chore(enterprise/coderd): conditionally disable parallelism on windows (#16072)
Fixes https://github.com/coder/internal/issues/266
2025-01-09 09:14:20 +00:00
6ca1e5973e chore: add api endpoints to get idp field values (#16063)
Supports coder/internal#210
2025-01-08 16:07:02 -05:00
7b88776403 chore(testutil): add testutil.GoleakOptions (#16070)
- Adds `testutil.GoleakOptions` and consolidates existing options to
this location
- Pre-emptively adds required ignore for this Dependabot PR to pass CI
https://github.com/coder/coder/pull/16066
2025-01-08 15:38:37 +00:00
1ab10cf80c fix(provisioner/terraform/tfparse): skip evaluation of unrelated parameters (#16023)
* Improves tfparse test coverage to include more parameter types and values
* Adds tests with unrelated parameters that should be ignored by tfparse
* Modifies tfparse to only attempt evaluation of parameters referenced by coder_workspace_tags
2025-01-03 19:32:17 +00:00