Skip to content

Commit

Permalink
Merge pull request #11175 from linode/staging
Browse files Browse the repository at this point in the history
Release v1.131.0 - staging → master
  • Loading branch information
bnussman-akamai authored Oct 28, 2024
2 parents 018f396 + 4291bec commit 47ed675
Show file tree
Hide file tree
Showing 310 changed files with 9,587 additions and 4,051 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
path: ref_code_coverage.txt

current_branch:
if: github.event.pull_request.draft == false
# We want to make sure we only run on open PRs (not drafts), but also should run even if the base branch coverage job fails.
# If the base branch coverage job fails to create a report, the current branch coverage job will fail as well, but this may help us debug the CI on the current branch.
if: ${{ always() && github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
needs: base_branch

Expand Down
67 changes: 47 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ x-e2e-env:
# Cloud Manager-specific test configuration.
CY_TEST_SUITE: ${CY_TEST_SUITE}
CY_TEST_REGION: ${CY_TEST_REGION}
CY_TEST_FEATURE_FLAGS: ${CY_TEST_FEATURE_FLAGS}
CY_TEST_TAGS: ${CY_TEST_TAGS}
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}

Expand Down Expand Up @@ -67,9 +68,7 @@ x-e2e-volumes:
&default-volumes
- ./.git:/home/node/app/.git
- ./cache:/home/node/app/cache
- ./packages/manager:/home/node/app/packages/manager
- ./packages/validation:/home/node/app/packages/validation
- ./packages/api-v4:/home/node/app/packages/api-v4
- ./packages:/home/node/app/packages
- ./package.json:/home/node/app/package.json
- ./node_modules:/home/node/app/node_modules

Expand All @@ -82,14 +81,9 @@ x-e2e-runners:
context: .
dockerfile: ./packages/manager/Dockerfile
target: e2e
depends_on:
web:
condition: service_healthy
env_file: ./packages/manager/.env
volumes: *default-volumes
# TODO Stop using entrypoint, use CMD instead.
# (Or just make `yarn` the entrypoint, but either way stop forcing `cy:e2e`).
entrypoint: ['yarn', 'cy:e2e']
entrypoint: 'yarn'

services:
# Serves a local instance of Cloud Manager for Cypress to use for its tests.
Expand All @@ -112,13 +106,56 @@ services:
timeout: 10s
retries: 10

# Cypress test runner service to run tests against a remotely-served Cloud instance.
#
# This is useful when testing against a standard Cloud Manager environment,
# like Production at cloud.linode.com, but can also be used to run tests against
# pre-Prod environments, PR preview links, and more.
cypress_remote:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}

# Cypress test runner service to run tests against a locally-served Cloud instance.
#
# This is useful when testing against a customized or in-development build of
# Cloud Manager.
cypress_local:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
depends_on:
web:
condition: service_healthy

# Cypress component test runner service.
#
# Unlike other Cloud Manager Cypress tests, these tests can be run without
# requiring a Cloud Manager environment.
cypress_component:
<<: *default-runner
environment:
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}


# --> ! DEPRECATION NOTICE ! <--
# The services below this line are deprecated, and will be deleted soon.
# Don't build any pipelines or write any scripts that depend on these.
# Instead, opt to use `cypress_local` in places where you would've used `e2e`,
# use `cypress_remote` in places where you would've used `e2e_heimdall`, and
# use `cypress_component` in places where you would've used `component`.

# Generic end-to-end test runner for Cloud's primary testing pipeline.
# Configured to run against a local Cloud instance.
e2e:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
entrypoint: ['yarn', 'cy:e2e']

# Component test runner.
# Does not require any Cloud Manager environment to run.
Expand All @@ -138,14 +175,4 @@ services:
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}

region-1:
build:
context: .
dockerfile: ./packages/manager/Dockerfile
target: e2e
env_file: ./packages/manager/.env
volumes: *default-volumes
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH_1}
entrypoint: ['yarn', 'cy:e2e']
11 changes: 6 additions & 5 deletions docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,13 @@ Environment variables related to the general operation of the Cloud Manager Cypr
| `CY_TEST_SUITE` | Name of the Cloud Manager UI test suite to run. Possible values are `core`, `region`, or `synthetic`. | `region` | Unset; defaults to `core` suite |
| `CY_TEST_TAGS` | Query identifying tests that should run by specifying allowed and disallowed tags. | `method:e2e` | Unset; all tests run by default |

###### Regions
These environment variables are used by Cloud Manager's UI tests to override region selection behavior. This can be useful for testing Cloud Manager functionality against a specific region.
###### Overriding Behavior
These environment variables can be used to override some behaviors of Cloud Manager's UI tests. This can be useful when testing Cloud Manager for nonstandard or work-in-progress functionality.
| Environment Variable | Description | Example | Default |
|----------------------|-------------------------------------------------|-----------|---------------------------------------|
| `CY_TEST_REGION` | ID of region to test (as used by Linode APIv4). | `us-east` | Unset; regions are selected at random |
| Environment Variable | Description | Example | Default |
|-------------------------|-------------------------------------------------|-----------|--------------------------------------------|
| `CY_TEST_REGION` | ID of region to test (as used by Linode APIv4). | `us-east` | Unset; regions are selected at random |
| `CY_TEST_FEATURE_FLAGS` | JSON string containing feature flag data | `{}` | Unset; feature flag data is not overridden |
###### Run Splitting
These environment variables facilitate splitting the Cypress run between multiple runners without the use of any third party services. This can be useful for improving Cypress test performance in some circumstances. For additional performance gains, an optional test weights file can be specified using `CY_TEST_SPLIT_RUN_WEIGHTS` (see `CY_TEST_GENWEIGHTS` to generate test weights).
Expand Down
35 changes: 31 additions & 4 deletions docs/tooling/analytics.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Adobe Analytics
# Analytics

## Adobe Analytics

Cloud Manager uses Adobe Analytics to capture page view and custom event statistics. To view analytics, Cloud Manager developers must follow internal processes to request access to Adobe Analytics dashboards.

## Writing a Custom Event
### Writing a Custom Event

Custom events live (mostly) in `src/utilities/analytics/customEventAnalytics.ts`. Try to write and export custom events in this file if possible, and import them in the component(s) where they are used.

A custom event will take this shape:

```tsx
// Component.tsx {file(s) where the event is called, for quick reference}
// OtherComponent.tsx
Expand All @@ -33,7 +36,7 @@ Examples
- `sendMarketplaceSearchEvent` fires when selecting a category from the dropdown (`label` is predefined) and clicking the search field (a generic `label` is used).
- `sendBucketCreateEvent` sends the region of the bucket, but does not send the bucket label.

## Writing Form Events
### Writing Form Events

Form events differ from custom events because they track user's journey through a flow and, optionally, branching flows. Form events live in `src/utilities/analytics/formEventAnalytics.ts`. Try to write and export custom events in this file if possible, and import them in the component(s) where they are used.

Expand All @@ -53,10 +56,34 @@ These are the form events we use:

See the `LinodeCreateForm` form events as an example.

## Locally Testing Page Views & Custom Events and/or Troubleshooting
### Locally Testing Page Views & Custom Events and/or Troubleshooting Adobe Analytics

1. Set the `REACT_APP_ADOBE_ANALYTICS_URL` environment variable in `.env`.
2. Use the browser tools Network tab, filter requests by "adobe", and check that successful network requests have been made to load the launch script and its extensions.
3. In the browser console, type `_satellite.setDebug(true)`.
4. Refresh the page. You should see Adobe debug log output in the console. Each page view change or custom event that fires should be visible in the logs.
5. When viewing dashboards in Adobe Analytics, it may take ~1 hour for analytics data to update. Once this happens, locally fired events will be visible in the dev dashboard.

## Pendo

Cloud Manager uses [Pendo](https://www.pendo.io/pendo-for-your-customers/) to capture analytics, guide users, and improve the user experience. To view Pendo dashboards, Cloud Manager developers must follow internal processes to request access.

### Set Up and Initialization

Pendo is configured in [`usePendo.js`](https://github.com/linode/manager/blob/develop/packages/manager/src/hooks/usePendo.ts). This custom hook allows us to initialize the Pendo analytics script when the [App](https://github.com/linode/manager/blob/develop/packages/manager/src/App.tsx#L56) is mounted.

Important notes:

- Pendo is only loaded if a valid `PENDO_API_KEY` is configured as an environment variable. In our development, staging, and production environments, `PENDO_API_KEY` is available at build time. See **Locally Testing Page Views & Custom Events and/or Troubleshooting Pendo** for set up with local environments.
- We load the Pendo agent from the CDN, rather than [self-hosting](https://support.pendo.io/hc/en-us/articles/360038969692-Self-hosting-the-Pendo-agent).
- We are hashing account and visitor IDs in a way that is consistent with Akamai's standards.
- At initialization, we do string transformation on select URL patterns to **remove sensitive data**. When new URL patterns are added to Cloud Manager, verify that existing transforms remove sensitive data; if not, update the transforms.
- Pendo is currently not using any client-side (cookies or local) storage.
- Pendo makes use of the existing `data-testid` properties, used in our automated testing, for tagging elements. They are more persistent and reliable than CSS properties, which are liable to change.

### Locally Testing Page Views & Custom Events and/or Troubleshooting Pendo

1. Set the `REACT_APP_PENDO_API_KEY` environment variable in `.env`.
2. Use the browser tools Network tab, filter requests by "pendo", and check that successful network requests have been made to load Pendo scripts. (Also visible in browser tools Sources tab.)
3. In the browser console, type `pendo.validateEnvironment()`.
4. You should see command output in the console, and it should include a hashed `accountId` and hashed `visitorId`. Each page view change or custom event that fires should be visible as a request in the Network tab.
12 changes: 12 additions & 0 deletions packages/api-v4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@

## [2024-10-28] - v0.129.0


### Added:

- ACL related endpoints and types for LKE clusters ([#10968](https://github.com/linode/manager/pull/10968))
- `StackScripts` to Region capabilities type ([#11139](https://github.com/linode/manager/pull/11139))

### Fixed:

- Incorrect documentation on how to set a page size ([#11129](https://github.com/linode/manager/pull/11129))

## [2024-10-14] - v0.128.0

### Added:
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pagination and filter parameters to the API:

```js
// Return page 2 of Linodes, with a page size of 100:
getLinodes({ page: 2, pageSize: 100 });
getLinodes({ page: 2, page_size: 100 });

// Return all public Linode Images:
getImages({}, { is_public: true });
Expand Down
2 changes: 1 addition & 1 deletion packages/api-v4/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@linode/api-v4",
"version": "0.128.0",
"version": "0.129.0",
"homepage": "https://github.com/linode/manager/tree/develop/packages/api-v4",
"bugs": {
"url": "https://github.com/linode/manager/issues"
Expand Down
5 changes: 5 additions & 0 deletions packages/api-v4/src/account/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export type AccountCapability =
| 'Kubernetes'
| 'Linodes'
| 'LKE HA Control Planes'
| 'LKE Network Access Control List (IP ACL)'
| 'Machine Images'
| 'Managed Databases'
| 'Managed Databases Beta'
Expand Down Expand Up @@ -603,6 +604,10 @@ export interface AccountBeta {
id: string;
ended?: string;
description?: string;
/**
* The datetime the account enrolled into the beta
* @example 2024-10-23T14:22:29
*/
enrolled: string;
}

Expand Down
1 change: 1 addition & 0 deletions packages/api-v4/src/cloudpulse/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export interface CloudPulseMetricsList {

export interface ServiceTypes {
service_type: string;
label: string;
}

export interface ServiceTypesList {
Expand Down
35 changes: 35 additions & 0 deletions packages/api-v4/src/kubernetes/kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
KubernetesEndpointResponse,
KubernetesDashboardResponse,
KubernetesVersion,
KubernetesControlPlaneACLPayload,
} from './types';

/**
Expand Down Expand Up @@ -221,3 +222,37 @@ export const getKubernetesTypes = (params?: Params) =>
setMethod('GET'),
setParams(params)
);

/**
* getKubernetesClusterControlPlaneACL
*
* Return control plane access list about a single Kubernetes cluster
*/
export const getKubernetesClusterControlPlaneACL = (clusterId: number) =>
Request<KubernetesControlPlaneACLPayload>(
setMethod('GET'),
setURL(
`${API_ROOT}/lke/clusters/${encodeURIComponent(
clusterId
)}/control_plane_acl`
)
);

/**
* updateKubernetesClusterControlPlaneACL
*
* Update an existing ACL from a single Kubernetes cluster.
*/
export const updateKubernetesClusterControlPlaneACL = (
clusterID: number,
data: Partial<KubernetesControlPlaneACLPayload>
) =>
Request<KubernetesControlPlaneACLPayload>(
setMethod('PUT'),
setURL(
`${API_ROOT}/lke/clusters/${encodeURIComponent(
clusterID
)}/control_plane_acl`
),
setData(data)
);
14 changes: 14 additions & 0 deletions packages/api-v4/src/kubernetes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,22 @@ export interface KubernetesDashboardResponse {
url: string;
}

export interface KubernetesControlPlaneACLPayload {
acl: ControlPlaneACLOptions;
}

export interface ControlPlaneACLOptions {
enabled?: boolean;
'revision-id'?: string;
addresses?: null | {
ipv4?: null | string[];
ipv6?: null | string[];
};
}

export interface ControlPlaneOptions {
high_availability?: boolean;
acl?: ControlPlaneACLOptions;
}

export interface CreateKubeClusterPayload {
Expand Down
3 changes: 2 additions & 1 deletion packages/api-v4/src/regions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export type Capabilities =
| 'Placement Group'
| 'Premium Plans'
| 'Vlans'
| 'VPCs';
| 'VPCs'
| 'StackScripts';

export interface DNSResolvers {
ipv4: string; // Comma-separated IP addresses
Expand Down
4 changes: 0 additions & 4 deletions packages/manager/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ REACT_APP_API_ROOT='https://api.linode.com/v4'
# REACT_APP_CLIENT_ID='UPDATE_WITH_YOUR_ID'
REACT_APP_APP_ROOT='http://localhost:3000'

REACT_APP_LKE_HIGH_AVAILABILITY_PRICE='60'

##################################
# Optional:
##################################
Expand Down Expand Up @@ -64,5 +62,3 @@ REACT_APP_LKE_HIGH_AVAILABILITY_PRICE='60'
# E2E TESTS REMOVE ALL OF YOUR DATA AND RESOURCES
# INCLUDING LINODES,VOLUMES,DOMAINS,NODEBALANCERS
#MANAGER_OAUTH='YOUR_OATH_TOKEN'


Loading

0 comments on commit 47ed675

Please sign in to comment.