Граф коммитов

87 Коммитов

Автор SHA1 Сообщение Дата
Ben Bangert 6ed76a6caf
chore: update node to 18.18.2
Because:

* We want to use the latest security release of Node.

This commit:

* Updates Node.js to 18.18.2
2023-10-16 16:46:26 -07:00
Dan Schomburg c57524f332
task(CI): Disable nx cache in docker build 2023-09-27 12:09:21 -07:00
dschom 372c14aaaa
task(all): Ignore all .env files 2023-09-25 16:29:45 -07:00
Barry Chen 3a61a72cac
Use bullseye as base image (instead of bookworm the current default) 2023-09-06 14:26:05 -05:00
dschom e114e823d9
task(ci): Include max old space node option in build.sh
Because:
- The CI job `Create FxA Image` ran out of memory

This Commit:
- Applies the the `--max-old-space-size=7168` node option, which should prevent the OOM.
2023-08-30 14:20:43 -07:00
dschom 992115594b
task(ci): Fix netcat install after updating docker base image to node:18.17-slim 2023-08-30 13:39:01 -07:00
dschom d96797ae6a
task(CI): Improve nx caching for CI pipelines
Because:
- Not all CI operations where taking advantage of NX caches

This Commit:
- Adjusts nx.json config to ensure correct caching behavior
- Adjusts nx.json config to ensure proper target chains. ie build is dependent on pre-build
- Uses nx to directly run integration tests
- Uses nx to directly run unit tests
- Phases out dependency on generated .list files
- Ensures 'start up' for services for functional tests is done with nx and uses nx caches.
- Creates nx tags to facilitate test commands
- Fixes linter errors encountered
- Updates docker images to nx for builds
- Updates nx ignore files
2023-08-29 11:19:54 -07:00
Ben Bangert 54f0c2e7a2
chore: update to TS to 5.2.2 and Node to 18.17.1
Because:

* We want to use the latest typescript features.

This commit:

* Updates to TypeScript 5.2.2.
* Updates to Node 18.17.1 as OOM would occur frequently with 18.14.
* Updates CI to use a large instance with increased memory for Node.
2023-08-28 14:47:29 -07:00
Dan Schomburg db24f8485d
bug(ci): Broken ci image build
Because
- Deploy ci image was failing

This Commit:
- Adds a missing ';'
2023-08-11 19:18:04 -07:00
Dan Schomburg 59caa3d8f3
Merge branch 'main' into fix-broken-ci-image-build 2023-07-20 15:17:02 -07:00
dschom 2d5d7396c0
fix(ci): Fix broken ci images due to missing allowlist folder
Because:
- Our CI image build was failing

This Commit:
- Makes an exception for the project/configs/gql/allowlist folder in the dockerignore file
2023-07-20 11:55:33 -07:00
Reino Muhl 8a4ed3350a
feat(infra): wait for db patches on startup
Because:

* On stack startup, services start before mysql patches have completed,
  causing profile-server to fail on startup.

This commit:

* Adds script to check if patcher script has started and is still
  running.

Closes #
2023-07-20 12:08:34 -04:00
dschom b02676e358
fix(ci): Fix broken ci images due to missing allowlist folder
Because:
- Our CI image build was failing

This Commit:
- Makes an exception for the configs/gql/allowlist folder in the dockerignore file
2023-07-19 09:04:35 -07:00
dschom df7897920d
task(gql-api): Allowlist graphql queries
Because:
- We want to lock down our gql queries as part of good security practices.

This Commit:
- Creates task that extracts existing gql queries from our code
- Applies middleware that checks a allowlist of extracted queries.
- Creates a 403 if the query is not in the allowlist
- Makes all gql parsable by extraction utility. The extraction utility doesn't support string placeholders. e.g. gql` Account { ${ACCOUNT_FIELDS} }`
- Moves all the gql in the admin server into .ts files. Again for consistency and extraction utility support.
- Cleans up some config references at startup
- Adds nx config for extraction & copy tasks
2023-07-18 05:54:28 -07:00
dschom e51fb8adc2
bug(CI): Current version not being set properly in docker build.
Because:
- Deployed services all had a version set to v0.0.0

This Commit:
- Determines version specified in `packages/version.json`
- Provides this version to `build.sh` ensuring it is set in packages
2023-05-25 10:53:22 -07:00
Julian Poyourow 565ebb89c9
chore(build): initial nx implementation
Because:

* We want to introduce nx to the repository

This commit:

* Adds nx with working builds

Closes: FXA-7341

Co-authored-by: dschom <dschomburg@mozilla.com>
2023-05-23 08:37:47 -07:00
dschom b4cfc9c325
chore(CI): Switch to multi stage docker build and clean up
Because:
- We want to clean up our docker build
- We no longer used our service specific images

This Commit:
- Switches to multi stage docker build
  - Removes unused building of individual services
  - Removes used script that sets environment variables.
  - Removes `workspaces focus` call that resulted in redundant installs
  - Removes trap on build logs.
  - Uses circleci DLC to get cache hits for fxa-utils and fxa-build-utils
- Removes scripts that build service specific images
- Cleans up naming conventions to reflect that only one image is being built
2023-05-11 17:13:06 -07:00
Dan Schomburg 11d541f263
Merge pull request #15255 from mozilla/FXA-7359
task(CI): Patch package.json version fields to reflect the git tag
2023-05-05 14:31:34 -07:00
dschom 7f79c431d0
task(CI): Patch package.json version fields to reflect the git tag
Because:
- We want the package.json version to match the git tag being deployed.
- We don't want to commit a change on the package.json file to accomplish this.

This Commit:
- If there is a git tag, the code will send it into the docker build as a VERSION build arg.
- This build arg is then used to update the version field in all package.json files.
2023-05-05 12:13:46 -07:00
Barry Chen ec34079b91
feat(metrics): add glean.js to content-server
Because:
 - we want to use Glean for our metrics

This commit:
 - integrates glean.js into content-server
 - adds a couple placeholder registration Glean metrics events
2023-05-05 12:45:33 -05:00
dschom dcccce4abc
bug(CI): Add curl to docker images 2023-03-29 15:24:04 -07:00
dschom 91007213ac
task(ci): Add jq to docker
Because:
- jq util was missing from docker images based on node:18

This Commit:
- Installs jq
2023-03-29 12:14:08 -07:00
Barry Chen 218b49e88b
Revert "chore(lint): move eslint-plugin-fxa into the monorepo" 2023-03-28 12:47:03 -07:00
Barry Chen fbb5f0f5bc
chore(lint): move eslint-plugin-fxa into the monorepo
Because:
 - we don't want to maintain the fxa eslint plugin in another repo

This commit:
 - move the plugin into the monorepo

Co-authored-by: Peter deHaan <peter@deseloper.com>
2023-03-22 16:12:11 -05:00
Barry Chen ba550558a0
chore(repo): delete pushbox service integration
Because:
 - the pushbox service has been decommissioned

This commit:
 - removes the pushbox service integration config and code from the
   auth-erver
2023-03-21 13:53:44 -05:00
Barry Chen bb29851b17
fix(CI): call script directly to clone l10n repo 2023-03-21 10:06:51 -05:00
Barry Chen 1f7e26e709
fix(CI): clone l10n repo
Because:
 - we need to clone l10n repo so that packages can be built

This commit:
 - explicitly call `l10n:clone` in the Dockerfile for CI images
2023-03-20 15:49:19 -05:00
Barry Chen da11e63832
chore(deps): upgrade to node.js 18
Because:
 - we want to use the latest node LTS major version

This commit:
 - upgrades FxA to use node 18, with two workarounds
   - Webpack uses a hash algorithm that's no longer supported by default
     in node 17+, causing build failures; --openssl-legacy-provider is
     used as the workaround
   - dns.lookup in node 17+ by default returns the results in the same
     order as they are from the resolver, which could lead to
     'localhost' resolving to ::1; --dns-result-order=ipv4first is used
     as the workaround
2023-03-20 13:28:10 -05:00
dschom c79c6260a4
bug(CI): Fix nightly CI build
Because:
- Nightly CI build was failing because fxa-shared now references the test folder during build.

This Commit:
- Removes tests directories from the docker ignore list.
2023-02-17 15:53:07 -08:00
dschom 8d3e42963f
task(CI): Improvements to caching and startup behaviors
Because:
- Something was off for base-install in jobs using the ci-base-browser-latest images. Yarn cache hits were not happening as anticipated. Also, in the event the yarn install could be skipped, the postinstall script was taking longer than expected.
- An occasional race condition where the deploy-fxa-ci-browser-image could be built off a stale base image was detected.
- Since ci-base-latest and ci-base-browsers-latests weren’t pushed at the same time, occasionally different builds would be used in a pipeline. Although this never directly led to problems, it did seem like the potential was there.
- The ci-* docker images were larger than desired..
- While investigating optimizations, it became apparent job spin up times could be further reduced by using CircleCI workspaces.
– Nightly builds are useful, and we would occasionally encounter a regression on main that wasn’t present in PRs due to differences in resulting state after a merge.
- SRE needs a better way to trigger smoke tests in parallel.

This commit:
- Reworks the docker file.
	- Puts everything into one multi stage build, which results in better layer caching.
	- Creates new tag names ci-builder, ci-test-runner, & ci-functional-test-runner
       - Makes sure these images are as small as possible
	- Updates references to these new images in the executors
- Ensures that the ci images are built on the same machine and pushed at the same time. This addresses the potential race condition described in the because section above.
- Short circuits the docker build for ci images if there are no npm package changes detected. Since the base images are really just a way to decrease build time by caching package dependencies in a docker image that compresses better than the circle ci cache, we don’t actually need to build the image unless a package change has occurred.
- Leverages CircleCI workspaces. The build now primes the workspace and it is then restored in the subsequent jobs. This ends up saving time, because we skip the build / install step, and it allows us to use much smaller docker images for any job running post build.
- Adds a script to extract the current state of the yarn cache from a docker image, so the yarn cache can be kept fresh. This was an oversight in the initial pass.
- For functional tests, the operation that starts the pm2 stack and the actual jobs have been separated into different steps. This gives us better timing metrics, and also lets us see which step fails most often. Starting the stack actually takes up a considerable amount of time, and shouldn’t be confused with the time it takes to execute tests.
- For functional tests (both playwright and content), a memory optimization was made by not including fxa-shared or fxa-react in the ‘run start’ operation. Both of these workspaces are now built in the ‘build’ stage, so there is no reason to include them when spinning up the stack. This actually resulted in a noticeable reduction in memory usage. This is probably due to the fact that these pm2 tasks were running a watch operation, which is more memory intensive than just running a build.
- Ensures that the entire git history isn't copied into the base image, which results in a smaller image. (Our git history is surprisingly large!) This is done by setting a depth of 1 when cloning and depth of 2 when fetching. These changes also address FXA-6676, because the clone and fetch operations have been modified.
- Adds a nightly workflow, so that we can run a full test suite to guard against regression resulting from a merge into main. See FXA-6626 for more information. We can also use this nightly flow to postpone any CI tasks that run on main, but aren’t urgent.
- Retains the ability to manually trigger tasks that were shifted to the nightly workflow. These tasks include deploying storybook or deploying packages.
- Adds the ability to trigger smoke test workflows with pipeline parameters. It’s possible this will simplify executing smoke tests in parallel for SRE.
- Fixes the issue of slow base-install script performance when the yarn install operation could be skipped. The issue was that when we invoke postinstall directly, fxa-shared would be built. This is already taken care of in the build step, so doing so in the base install was an unneeded redundancy.
- Adds a few other minor improvements fixes such as avoiding a couple redundant build / lint operations, making the build script a bit more robust, and cleaning up the config file a bit.
2023-01-30 13:14:13 -08:00
dschom a620922422
task(CI): build, unit test, and integration test jobs
Because:
- We wanted to run a few preliminary checks before proceeding to more
  expensive CI jobs. Checks include:
    - Compiling typescript in commonly referenced workspace packages
    - Linting code that has changed
    - Executing Unit Tests for code that has changed
- We wanted to partition test operations into unit tests, and
   integration tests. Unit tests can be run relatively quickly and
   require no additional infrastructure. Integration tests require
   additional infrastructure and generally have longer execution
   times. Now that jobs are blocked from running until preliminary
   checks pass, one of which is unit tests, it is important to draw a
   distinction between these two types of tests.
- We want to avoid unnecessary yarn installs and typescript
  compilations, which are time consuming.
- We want to make sure that test results are published and failing tests
   can be easily viewed in the CI.

This Commit:

- Creates a build-and-validate job in the CI that builds, lints, and
  unit tests code prior to running any other jobs.
- Creates unit-test job in CI config
- Creates integration-test job in CI config
- Removes redundant calls to compile workspace packages. These
  are now built up front, cached, and restored as needed for future
  runs.
- Extends the create-lists script functionality to generate commands
  that can be executed with the parallel command.
- Removes unnecessary yarn install operations. Invoking yarn workspace
   focus results in a yarn install. In the case of running tests this is largely
   unnecessary, because we already do a yarn install in the base-install
   step.
- Make sure test results are exported as junit xml so the CI can report
  back on tests that were failing. This was done for a couple workspace
  packages, but many were lacking the capability. All test:unit and
  test:integration npm scripts now export this data.
- Fixes the following issues encountered along the way:
        - Adds logs to monitor heap usage of jest tests. Some
          jest tests are still using a lot of memory.
        - Moves a few slow / long running tests from unit test to
          integration tests.
        - Ensures that jest.transform for ts-jest is always instructed
           to have the config option isolateModules is set to true. This
           definitely decreases memory overhead and resolves some
           of the OOM errors we were hitting. It was configured in
           some places but not everywhere.
        - Exports test results files for all tests
        - Exports all test artifacts
        - Uses gnu parallel to run tests in parallel. Turns out yarn
          workspaces foreach would give a false positive when an OOM
          was encountered. Fortunately, the parallel command offered an
          acceptable work around, and even offers some nice features
          like the load argument, which allows to control test execution a
          bit more efficiently.
2023-01-10 12:52:01 -08:00
dschom 74d474389c
bug(CI): Fixes the playwright install in the base image used for functional tests.
Because:
- Playwright tests weren't running

This Commit:
- Switches from to an npx install to setup the playwright browsers
2022-12-20 12:18:25 -08:00
dschom acf3c82590
task(ci): Use docker base image
Because:
- We want to speed up pipeline startup.

This Commit:
- Optimizes docker base image builds for the smallest images possible.
- Enables hard links for yarn cache
- Enables global yarn cache
- Avoids needlessly installing playwright browsers.
- Avoids needlessly running yarn install.
- Uses mozilla/fxa-circleci:ci-base-latest image for running test pipelines
- Uses mozilla/fxa-circleci:ci-base-browsers image for running functional tests pipelines
- Creates configurable executors that can be reused across pipelines
- Upgrades to yarn 3.3.0
- Enabled direct check out of PR code to test, which is faster than circle ci’s checkout command.
- Upgrades functional test to X-Large. This was already the case for playwright tests, but is now extended to content server tests too. This decision was made due to running lots of pipelines and realizing flakiness was largely due to CPU or memory hitting 100% for long periods of time.
- Turns off tracing, since it saves a bit of runtime.
2022-12-15 15:48:16 -08:00
dschom de864fc93e
task(ci): Create docker image for CI
Because:
- We are in the process of experimenting with CI pipeline optimizations

This Commit:
- Creates a new docker image that can be used in other CI jobs.
- This base image comes pre-populated with node_modules, dist folders, and l10n repos.
2022-11-22 18:38:30 -08:00
Dan Schomburg 70a784eb9e
Merge pull request #14405 from mozilla/fix-otel-docker-network-error
task(shared): Fix docker network error with otel
2022-11-04 17:53:44 -07:00
dschom 1ab4ba501b
task(shared): Fix docker network error with otel
Because:
- When starting tracing with open telemetry the network name would sometimes collide and result in error.

This Commit:
- Sets an 'fxa' network name
- Applies this network to services
- Allows services to communicate by their names
2022-11-04 16:22:11 -07:00
Julian Poyourow 76ef507b26
chore(auth-server): enable typescript-eslint
Because:

* We aren't currently linting TS files in auth-server

This commit:

* Enables and fixes linting issues in auth-server

Closes FXA-6136
2022-11-04 10:43:26 -07:00
dschom bdcd59ff70
task(content): Add support for tracing on client side
Because:
- We want to start trace capture at client side
- We can't report trace data directly to cloud trace

This Commit:
- Adds support for client side tracing in tracing/browser-tracing.ts
- Some refactors to fxa-shared/tracing to ensure code is reused
- Cleans up tests
- Introduces traceparent header and tracestate html headers
- Opens up OTLP ports on jaeger
- Introduces a clientName to trace config
- Adds an open telemetry collector service (otel-collector)
- Uses this services for all trace capture
- Adds flow id to trace id headers so traces can be validated
2022-10-11 16:00:03 -07:00
dschom e8ae3388d0
fix(infrastructure): Improve Jaeger startup behavior
Because:
- When not enabled Jaeger was exiting with an 'error' status which was confusing.

This commit:
- Adjust infrastructure.config.js so that Jaeger exists cleanly with a 'stopped' status.
- Reports a better log message so that it's clear Jaeger is not required to run FxA.
2022-09-07 16:29:49 -07:00
dschom f14a2dc923
task(auth): Enable open telemetry on auth server
Because:
- We want to be able to see trace information
- We want to be able to export trace information to google cloud

This Commit:
- Adds utility class to fxa-shared for configuring and initializing open telemetry
- Initializes open telemetry in the auth server
- Forces resolution of google-gax.
- Forces resolution of @grpc/grpc-js.
- Adds the jaeger docker container for viewing traces locally. This is accessible on localhost:16686.

Note, adding @google-cloud/opentelemetry-cloud-trace-exporter resulted
in a version conflicts for google-gax and @grpc/grpc-js, which caused
runtime failures when interacting with @google-cloud/firestore. After
many experiments, this seems to do the trick.
2022-09-02 17:54:41 -07:00
Peter deHaan e6f74e0936
fix(lint): Add more stylelint rules 2022-06-17 13:19:38 -07:00
Peter deHaan aa715ddb4d
chore(lint): A few more Stylelint tweaks 2022-06-10 17:01:35 -07:00
Peter deHaan c14c1f7084
fix(lint): Tweak some stylelint configs and fix content-server issues 2022-06-10 13:40:49 -07:00
Barry Chen 8d310a6d28
chore(build): switch to python3 in builder docker deps 2022-05-18 15:31:34 -05:00
Danny Coates 8bb2cc910f
Merge pull request #10558 from mozilla/rmrfmf
feat(services): remove fxa-auth-db-mysql, fxa-email-event-proxy, and fxa-email-service
2022-01-13 17:07:48 -08:00
Danny Coates 50e124b518
feat(services): remove fxa-auth-db-mysql, fxa-email-event-proxy, and fxa-email-service
and fxa-metrics-processor
2022-01-13 16:23:22 -08:00
Danny Coates 89850b99e6
chore(deps): update docker images to node 16 2022-01-13 10:37:48 -08:00
Danny Coates dfb1cd9517
feat(event-broker): wire up events from auth-server through event-broker to webhooks in local dev 2021-12-15 16:00:50 -08:00
jackyzy823 0c8cc56c36
chore(dev): update dev docker-compose mysql server to 5.7 (#11173)
Because:

* db-migrations script failed to work on mysql 5.6

This commit:

* update mysql server to 5.7

issue #10526
2021-12-13 12:28:58 -08:00
Danny Coates 1ea7fdd312
chore(dev): wait for containers on 'yarn start' (#11119)
On M1 we currently sometimes need to 'yarn restart services' after a 'yarn start' before things start working. Maybe if we wait for the containers to be responsive before starting services we can avoid this. The important one seems to be mysql.
2021-11-22 16:58:30 -08:00