Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

CI: Update teleport version to 15.2.0 #1040

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

marcoandredinis
Copy link
Contributor

@marcoandredinis marcoandredinis commented Mar 20, 2024

Updates Teleport binary used in tests to 15.2.0

This new version of teleport has the following relevant changes:

Teleport process logging uses log/slog

For terraform tests we start a teleport binary and parse its output to understand when the Auth/Proxy service started and what ports are they listening on.
We used a regex for that, but teleport migrated to log/slog and the regex no longer works.
Migration PR: gravitational/teleport#38551
We had to fix the regex for integration tests in teleport: gravitational/teleport#39315
Terraform Tests also use that library, so after the regex changed, we must upgrade Teleport CI version to get the new log format.

Teleport API: GetClusterNetworkingConfig and GetSessionRecordingConfig never return a nil

When developing the ClusterMaitenanceConfig we had to include a nil check, because if it was never configured, GetClusterMaintenanceConfig would return a nil object.
This nil check was added to all SingleResource resources.

For ClusterNetworkingConfig and SessionRecordingConfig, the Get operation never returns a nil resource and staticcheck linter was yelling about it.
So, we had to create a new flag to ensure we only nil-checked the resources that can actually return a nil value.

Teleport Resource Metadata

It is no longer recommended to use the <Resource>.Metadata.ID to check for cached responses.
We are now using the revision field.

During this change we also detected a miss-usage of an error variable and fixed that (could lead to a panic).

LoginRules didn't have the Revision field, so we added it here: https://github.com/gravitational/teleport.e/pull/3821

Unfortunately, that PR didn't merge in time for 15.2.0.
However, that's ok because LoginRules are not cached.
So, instead of waiting for a new release (15.2.1), we just removed the cache check.

@marcoandredinis marcoandredinis force-pushed the marco/update_teleport_version_ci_15-1-9 branch from f1183bc to 4319052 Compare March 28, 2024 08:24
@marcoandredinis marcoandredinis force-pushed the marco/update_teleport_version_ci_15-1-9 branch from 4319052 to c916651 Compare March 28, 2024 09:50
@marcoandredinis marcoandredinis force-pushed the marco/update_teleport_version_ci_15-1-9 branch from c916651 to bb5ff0d Compare March 28, 2024 11:27
@marcoandredinis marcoandredinis changed the title CI: Update teleport version to 15.1.9 CI: Update teleport version to 15.1.10 Mar 28, 2024
@marcoandredinis marcoandredinis changed the title CI: Update teleport version to 15.1.10 CI: Update teleport version to 15.2.0 Apr 2, 2024
This new version of teleport has the following relevant changes:

* Teleport process logging uses `log/slog`
For terraform tests we start a teleport binary and parse its output to understand when the Auth/Proxy service started and what ports are they listening on.
We used a regex for that, but teleport migrated to `log/slog` and the regex no longer works.
Migration PR: gravitational/teleport#38551
We had to fix the regex for integration tests in teleport: gravitational/teleport#39315
Terraform Tests also use that library, so after the regex changed, we must upgrade Teleport CI version to get the new log format.

* Teleport API: `GetClusterNetworkingConfig` and `GetSessionRecordingConfig` never return a nil

When developing the `ClusterMaitenanceConfig` we had to include a nil check, because if it was never configured, `GetClusterMaintenanceConfig` would return a nil object.
This nil check was added to all SingleResource resources.

For `ClusterNetworkingConfig` and `SessionRecordingConfig`, the `Get` operation never returns a nil resource and `staticcheck` linter was yelling about it.
So, we had to create a new flag to ensure we only nil-checked the resources that can actually return a nil value.

* Teleport Resource Metadata
It is no longer recommended to use the `<Resource>.Metadata.ID` to check for cached responses.
We are now using the revision field.

During this change we also detected a miss-usage of an `error` variable and fixed that (could lead to a panic).

LoginRules didn't have the `Revision` field, so we added it here: gravitational/teleport.e#3821

Unfortunately, that PR didn't merge in time for 15.2.0.
However, that's ok because LoginRules are not cached.
So, instead of waiting for a new release (15.2.1), we just removed the cache check.
@marcoandredinis marcoandredinis force-pushed the marco/update_teleport_version_ci_15-1-9 branch from c233311 to 0d0a5ac Compare April 2, 2024 08:57
@marcoandredinis marcoandredinis marked this pull request as ready for review April 2, 2024 09:04
@@ -103,7 +103,7 @@ release: build
endif
tar -C $(BUILDDIR) -czf $(RELEASE).tar.gz .

TERRAFORM_EXISTS := $(shell terraform -version 2>/dev/null | grep 'Terraform v1.5')
TERRAFORM_EXISTS := $(shell terraform -version 2>/dev/null | grep 'Terraform v1.')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional? Do we want to force a specific TF version or we're OK with everything 1.x?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I can add it into another PR if you think it's better

I think requiring anything in the 1.x range is fine, and I was getting annoyed with having to upgrade multiple things

go.mod Show resolved Hide resolved
@marcoandredinis
Copy link
Contributor Author

@r0mant Can you please take a look? I need a code owners review

@marcoandredinis marcoandredinis merged commit c178b25 into master Apr 2, 2024
14 checks passed
@marcoandredinis marcoandredinis deleted the marco/update_teleport_version_ci_15-1-9 branch April 2, 2024 16:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants