Commit graph

101 commits

Author SHA1 Message Date
Scott Gress
e37aa6cf29
Updates for getting private key from AWS secrets manager (#32789)
for #31321 

# Details

Small updates from [community
PR](https://github.com/fleetdm/fleet/pull/31134):

* Updated config vars to match
[docs](https://github.com/fleetdm/fleet/blob/docs-v4.75.0/docs/Configuration/fleet-server-configuration.md#server_private_key_region)
* Added support for specifying region in config (already documented)
* Removed parsing of ARN for region
* Made retry backoff intervals a bit longer

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
(already added in the community PR
[here](https://github.com/fleetdm/fleet/blob/sgress454/updates-for-private-key-in-aws-sm/changes/private-key-secrets-manager#L0-L1)

## Testing

- [X] Added/updated automated tests
- [X] QA'd all new/changed functionality manually



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- New Features
- Added support for specifying the AWS region for server private key
retrieval from AWS Secrets Manager via server.private_key_region.

- Chores
  - Renamed configuration keys:
    - server.private_key_secret_arn → server.private_key_arn
- server.private_key_secret_sts_assume_role_arn →
server.private_key_sts_assume_role_arn
- server.private_key_secret_sts_external_id →
server.private_key_sts_external_id
  - Update your configuration to use the new keys.
- Adjusted retry backoff for Secrets Manager retrieval to improve
resilience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-09-19 10:57:02 -05:00
Victor Lyuboslavsky
4e50de7193
For Go tests, always upload a success/fail status indicator so that aggregate-result works correctly. (#32065)
Fixes #31994
2025-08-18 17:23:45 -05:00
Victor Lyuboslavsky
58eef867e0
Update MySQL versions we test with to 8.4.6 and 9.4.0 (#31694)
Fixes #31693

Manually forced a run for MySQL 8.4.6 to validate.

# Checklist for submitter

- Changes not needed since this is not a product change.

## Testing

- [x] Added/updated automated tests
2025-08-08 07:19:06 +02:00
Ian Littman
dfaad610d9
Remove unneeded exposed ports on osquery-in-a-box minio to avoid host-port conflicts (#30416)
Also ensures we run integration tests when docker-compose files used by
`fleetctl preview` are changed, so we don't merge any more test failures
due to those.
2025-06-29 12:40:17 -05:00
Victor Lyuboslavsky
1ffcc21450
Reducing "waiting for mysql" timeout to 1 minute to speed up dev feedback. (#28935)
I'm seeing it takes ~10 seconds to MySQL to come up, so 1 minute should
be plenty. 5 minutes was too long to wait.
2025-05-07 16:17:22 -05:00
Victor Lyuboslavsky
2d5ac35578
Improving "Wait for mysql" in Go tests. (#28901)
For #28902

Modified the GitHub Actions workflow to prevent it from hanging at the
"waiting for mysql..." step. The updated workflow now:

- Times out after 5 minutes of unsuccessful MySQL connection attempts
- Logs all connection attempts with timestamps and error messages when a
timeout occurs
- Dumps MySQL container logs when a timeout occurs, providing valuable
diagnostic information
- Automatically stops and restarts all Docker containers using the same
command as the original "Start Infra Dependencies" step
- Retries this process up to 5 times before failing the job
2025-05-07 10:17:53 -05:00
Victor Lyuboslavsky
dd10a417ec
Replacing MySQL 8.4 with MySQL 9.X in our regular (every commit) tests. (#28777)
Replacing MySQL 8.4 with MySQL 9.X in our regular (every commit) tests
to speed up dev feedback. The MySQL 8.4 tests will still run nightly.

The vulnerability feed download CI fails below are not related to this
change.
2025-05-02 17:24:24 -05:00
Victor Lyuboslavsky
3d3d43864a
Bumping MySQL 8.4.3->8.4.5 and 9.1.0->9.3.0 in tests. (#28767)
I forced a test run on 9.3.0 (which only runs nightly be default).
2025-05-02 13:40:11 -05:00
Victor Lyuboslavsky
229b51ff5b
Report aggregate results immediately after test-go matrix runs. (#28123)
Report aggregate results immediately after test-go matrix runs
2025-04-11 14:05:19 -05:00
Victor Lyuboslavsky
5a549a3d03
Mark test-go failed if one test failed. (#28052) 2025-04-09 17:39:47 -05:00
Ian Littman
008eff27b0
Add MySQL 8.0.32 to test matrix (#27985)
Adding to validate Aurora 3.05.2 compat per a customer request.
2025-04-08 12:51:36 -05:00
Victor Lyuboslavsky
7558d5afa1
Improvements to test-go CI job (#27916)
This PR makes several improvements to test-go CI job
- remove ZSH dependency from all test suites except for a new `scripts`
suite
- add a `fast` suite that does not have out-of-process dependencies,
which completes in ~1.5 minutes
- contributors can add their fast tests to this suite so they can see
the results in CI faster
- Rename `core` to `main` test suite to be consistent with Makefile. It
is the default bucket for tests.
- Cleaned up Makefile so that it is more straightforward to add new test
suites or move Go packages between suites
- Do not stop the test suites on a fail.
- We do not want to be blocked by a test fail that another product team
introduced
- Sometimes, we want to see all test failures so we can fix them all at
once.
- Removed `test-schema` and `mock` prerequisites for `test-go` since
they are not needed and just take up time.
- But also added `test-schema` run to one of the test suites just in
case.

Unfortunately, `fleetctl` is still the bottleneck and needs to be
refactored. New issue filed:
https://github.com/fleetdm/fleet/issues/27927

## Before
<img width="248" alt="image"
src="https://github.com/user-attachments/assets/110ffc1d-f090-4d3e-be77-0419b9577d20"
/>

## After
<img width="320" alt="image"
src="https://github.com/user-attachments/assets/8d01ea11-408f-4eb6-81d8-9c25410b8830"
/>
2025-04-07 12:52:26 -05:00
Lucas Manuel Rodriguez
8003227554
Use go 1.24 new tool feature (#27765)
Release notes: https://tip.golang.org/doc/go1.24

> Go modules can now track executable dependencies using tool directives
in go.mod. This removes the need for the previous workaround of adding
tools as blank imports to a file conventionally named “tools.go”. The go
tool command can now run these tools in addition to tools shipped with
the Go distribution. For more information see [the
documentation](https://tip.golang.org/doc/modules/managing-dependencies#tools).
The new -tool flag for go get causes a tool directive to be added to the
current module for named packages in addition to adding require
directives.

I ran:
```
go get -tool github.com/fleetdm/fleet/v4/server/goose
go get -tool github.com/kevinburke/go-bindata
go get -tool github.com/quasilyte/go-ruleguard/dsl
go rm tools.go
go mod tidy
```

`make deps-go` was failing in CI because of the removal of `tools.go`
(my guess is that `go get .` was a nop because there was nothing in `.`
to download).
So, taking the chance of removing `deps-go` because `go` will download
packages during the build process. AFAICS there's no need to download
everything beforehand.
2025-04-07 11:12:05 -03:00
Lucas Manuel Rodriguez
60f829f6bd
Fix code scanning alerts (#27074)
These are fixes to some of the alerts in:
https://github.com/fleetdm/fleet/security/code-scanning
2025-03-27 10:01:20 -03:00
Victor Lyuboslavsky
527428f0b4
Speeding up Go tests in CI. (#27434)
Using `go get .` (~3s) is faster than `go mod download` (~13s) in CI.
2025-03-25 12:03:24 -05:00
Ian Littman
e7d04f2ff0
Clean up Python 3.12 vulns test expectations, fix continue-on-error behavior for integration and vulns suites (#26903)
From what I can tell, continue-on-error has been false for the
integration suites since the suites were renamed to `integration-*`, so
this fixes that issue in addition to continuing to run test suites when
the vulns suite fails (which may be due to vulns feed updates).

This also makes the vulns test more resilient to new CVEs being reported
on Python 3.12.0, which is rather likely to collect new CVEs.

# Checklist for submitter

- [x] Added/updated automated tests
2025-03-06 08:46:07 -06:00
StepSecurity Bot
d109e72cbe
[StepSecurity] ci: Harden GitHub Actions (#25985) 2025-02-03 12:25:18 -06:00
Dante Catalfamo
8c338a1d77
Try splitting up integration tests (#25312)
Follow up to #25271 and #21774

Integration test failures will happen much faster of they occur, but now
the bottleneck is the `fleetctl` test suite.

It's trivial to continue splitting tests up now. We should look into
creating an action that checks that mock generation is up-to-date, run
it before all the tests, and then remove the mock generation step from
each test step. That would save about a minute and a half of runtime
from each test and help offset the cost of splitting the tests up.

![ci runtime
breakdown](https://github.com/user-attachments/assets/057b8ee1-782c-4e1f-9486-42c7d1169c81)
![ci runtime
max](https://github.com/user-attachments/assets/3a26995f-d9cb-490b-84d9-1a7fbb3cd6b3)

![image](https://github.com/user-attachments/assets/b4c888c8-867f-4bdd-9b69-0dc20d0d202a)
2025-01-10 12:52:13 -05:00
Dante Catalfamo
e6fb647d95
Run CI tests in parallel (#25271)
#21774

Improves run time by about 30%.

Things have been arranged in such a way that splitting modules out
further will be trivial in the future, such as breaking the different
integration test suited into their own units.


![image](https://github.com/user-attachments/assets/ead46e4c-6f14-406d-a29b-b25abc79c384)


![image](https://github.com/user-attachments/assets/3f7fd7f3-d7a8-4ff8-a184-646a72f1d015)
2025-01-09 13:38:24 -05:00
Victor Lyuboslavsky
0b9f36ad03
Enable MySQL 9.1 Go tests (#25055)
Enable MySQL 9 tests in the nightly Go test run.

The tests passed in my run:
https://github.com/fleetdm/fleet/actions/runs/12552738253/job/34999129651
2025-01-02 15:36:10 -06:00
Victor Lyuboslavsky
e4df954b0f
Update nanomdm dependency with latest bug fixes and improvements. (#23906)
#23905 

- Update with upstream nanomdm changes up to
825f2979a2
- Removed PostgeSQL folder from our nanomdm
- Added nanomdm MySQL test job to our CI

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-11-20 11:47:11 -06:00
Victor Lyuboslavsky
d0ed03f3c8
Update Go CI tests: MySQL 8.4.2 -> 8.4.3 (#23255)
Make sure Fleet works with the latest MySQL 8.4
2024-10-25 15:58:10 -05:00
Tim Lee
1ecdad24ad
Remove panic recovery in CI tests (#22644) 2024-10-09 18:29:14 -06:00
Ian Littman
ab996dc57d
Note that minimum MySQL version is 8.0.36 everywhere (not just 8.0) because that's what we test with (#22072)
Also mention that we test with 8.4.2 in a few more places.

Note that while I'm editing release articles, this isn't retconning
minimum requirements; we mention in 4.55.0 release notes further down
that we expect 8.0.36.
2024-09-13 10:59:38 -05:00
Lucas Manuel Rodriguez
6a5c515dc4
Attempt to use go.mod version instead of hidden Github var (#21768)
Done as part of oncall improvements.

`vars.GO_VERSION` can only be changed by admins and it's not public
(Fleet devs don't know the current value of the variable), this approach
uses the version specified in our `go.mod` file.
2024-09-03 20:49:50 -03:00
Victor Lyuboslavsky
1b06b050d7
Fix issues with coverage uploads (#21736)
#21707
2024-09-03 09:07:16 -05:00
Victor Lyuboslavsky
fdfc12982b
Improvements to go tests in CI (#21545)
#21546 
Some improvements to overall go test CI run time.
2024-08-26 08:55:53 -05:00
Roberto Dip
936cc4a6d7
notify #help-engineering when a dogfood deploy is in progress (#21347)
This ensures `#help-engineering` is notified when a dogfood deploy is in
progress. It helps set people's expectations about what's going on while
the server is temporarily down.
2024-08-19 15:33:00 -03:00
Victor Lyuboslavsky
4eb72535dc
Support for MySQL 8.4.2 (#21364)
#21270

The main change for MySQL 8.4.2 is that foreign key constraints are
stricter:
https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_restrict_fk_on_non_standard_key

Also, most replica-related commands have been renamed.

# Checklist for submitter

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
- [x] Added/updated tests
- [x] If database migrations are included, checked table schema to
confirm autoupdate
- [x] Manual QA for all new/changed functionality
2024-08-16 16:32:38 +02:00
Lucas Manuel Rodriguez
ab7df5155d
Use docker compose on CI instead of docker-compose (#21017)
After this is merged I'll cherry pick to `minor-fleet-4.55.0`.
2024-08-02 18:12:36 -03:00
Dante Catalfamo
5e1a3d03ae
MySQL 8.0 Migration (#20225)
#17249
2024-07-22 16:27:36 -04:00
Victor Lyuboslavsky
8c1c016b54
Don't stop unit tests if Go integration tests fail (#20628) 2024-07-20 19:22:07 +02:00
Roberto Dip
01030cbde6
test approach for running integration suite in parallel (#20085)
for #18297

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Manual QA for all new/changed functionality
2024-07-01 11:37:12 -03:00
Dante Catalfamo
188b52c979
Generate a summary on any go-test failure, add context after panic (#20066)
Stops developers from having to manually grep through the logs to find
the failing test
2024-06-27 15:39:23 -04:00
Victor Lyuboslavsky
f761827850
Move CalculateAggregatedPerfStatsPercentiles reads to the replica (#19206)
Move CalculateAggregatedPerfStatsPercentiles reads to the replica
#18838

I manually tested the aggregated query stats change by using a read
replica.
https://github.com/fleetdm/fleet/blob/main/tools/mysql-replica-testing/README.md
- But set `master_delay=0` due to issue
https://github.com/fleetdm/fleet/issues/19272
- Run a saved query as a live query, and see that its stats in
`aggregated_stats` table are updated.


# Checklist for submitter
- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2024-05-31 07:08:31 -05:00
Lucas Manuel Rodriguez
fd323a3909
Catch FAIL and panic: runtime error in CI (#19009)
This is just a CI change to catch these other type of errors and display
them on the Slack message:

Instead of showing just `unknown, please check build URL`:
![Screenshot 2024-05-15 at 8 34
19 AM](https://github.com/fleetdm/fleet/assets/2073526/bd66def6-50de-4ee5-8ccd-17a7cf0741ae)
2024-05-15 10:01:26 -03:00
Dante Catalfamo
2c6e7c71a8
Zsh script support (#18411)
#17321
2024-04-30 14:38:56 -04:00
Lucas Manuel Rodriguez
01f9963856
Add summary to test-go.yml Slack message when it fails (#18188)
This is to clearly see what is failing. (Looking through the thousands
of log lines via the URL is tedious.)

![Screenshot 2024-04-10 at 1 25
31 PM](https://github.com/fleetdm/fleet/assets/2073526/b64edc4b-6c88-4385-80e2-7babb1d4f3e5)
2024-04-10 18:04:26 -03:00
Martin Angers
8253e77264
Enable release device: copy global settings to new teams created via puppet (#17842) 2024-03-26 08:15:57 -04:00
Luke Heath
6ebc308eb4
[StepSecurity] ci: Harden GitHub Actions (#17780) 2024-03-22 15:32:23 -05:00
Lucas Manuel Rodriguez
1afb015f6c
Test DB migrations with Percona XtraDB MySQL server 5.7.25 (#16320)
#15881

This PR adds a script to test DB migrations with Percona XtraDB 5.7.25.

PS: To run this test before we merge this PR to `main` you will need to
change step 2 (`Make sure to be on latest main`), instead of `main` use
this branch `15881-test-migrations-with-percona`.
2024-01-29 14:21:37 -03:00
Tim Lee
0557f10ac5
14729 smtp settings validation for TLS (#15029) 2023-11-21 11:48:21 -07:00
Eric
ed7c51c9c9
Add --coverpkg flag to go test in the Makefile (#15153)
Related to: #10209

Changes:
 - Updated the go test in the Makefile to have the `--codepkg` flag.
- Added a newline to the `test-go` GH workflow to trigger a run for this
PR


> Note: I'm creating this as a draft PR to see the results of the "Test
Go" workflow
2023-11-20 17:01:19 -06:00
Luke Heath
91db043094
Use go variable to set version in workflows (#14890) 2023-11-03 09:42:27 -05:00
Roberto Dip
ad9e30f120
Update Go to v1.21.3 (#14634)
for #14633
2023-10-19 10:01:05 -03:00
Luke Heath
1e1e28791f
Document milestone release ritual (#13932) 2023-09-25 14:35:36 -05:00
Roberto Dip
ea6b59f179
upgrade Go version to 1.21.1 (#13877)
For #13715, this:

- Upgrades the Go version to `1.21.1`, infrastructure changes are
addressed separately at https://github.com/fleetdm/fleet/pull/13878
- Upgrades the linter version, as the current version doesn't work well
after the Go upgrade
- Fixes new linting errors (we now get errors for memory aliasing in
loops! 🎉 )

After this is merged people will need to:

1. Update their Go version. I use `gvm` and I did it like:

```
$ gvm install go1.21.1
$ gvm use go1.21.1 --default
```

2. Update the local version of `golangci-lint`:

```
$ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2
```

3. (optional) depending on your setup, you might need to re-install some
packages, for example:

```
# goimports to automatically import libraries
$  go install golang.org/x/tools/cmd/goimports@latest

# gopls for the language server
$ go install golang.org/x/tools/gopls@latest

# etc...
```
2023-09-13 15:59:35 -03:00
Roberto Dip
5ad734d617
upgrade go to v1.19.12 (#13617) 2023-08-31 13:49:24 -05:00
Luke Heath
204f082fe5
Pin all workflow actions versions by commit (#13462) 2023-08-31 12:09:21 -05:00
Roberto Dip
d9de78e9fc
upgrade Go version to 1.19.11 (#12902) 2023-07-26 11:09:22 -07:00