Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reuse built frontend in ci, merge compose files #6674

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Dec 24, 2023

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

  • renamed docker-compose.yml to compose.yml as it's supported by docker compose v2 by default
  • merged all compose files to simplify local backend and e2e tests execution. added profiles:
    • local - spins up all services in a setup, that previously was in docker-compose.yml
    • e2e - spins up all services in a setup, that previously was in .ci/docker-compose.cypress.yml
    • default(no profile set) - spins up all services in a setup, that previously was in .ci/docker-compose.yml
  • added ability to build frontend inside docker or reuse prebuilt frontend locally for CI purposes to speed up build
  • added arm64 build

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually - executed e2e and unit tests locally against all three compose profiles
  • N/A

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

@AndrewChubatiuk
Copy link
Contributor Author

@justinclift could you please review this MR?

@justinclift
Copy link
Member

@AndrewChubatiuk It's unlikely I'll have much free time to review Redash stuff today. 😦

Maybe one of the others can help instead? 😄

@AndrewChubatiuk AndrewChubatiuk force-pushed the frontend-build branch 2 times, most recently from 5886fd2 to cc8ab2b Compare January 16, 2024 05:30
Copy link

codecov bot commented Jan 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.37%. Comparing base (af0773c) to head (15b94b9).
Report is 2 commits behind head on master.

❗ Current head 15b94b9 differs from pull request most recent head 1619b0b. Consider uploading reports for the commit 1619b0b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6674      +/-   ##
==========================================
- Coverage   63.82%   63.37%   -0.45%     
==========================================
  Files         161      162       +1     
  Lines       13060    13170     +110     
  Branches     1803     1819      +16     
==========================================
+ Hits         8335     8347      +12     
- Misses       4425     4532     +107     
+ Partials      300      291       -9     

see 21 files with indirect coverage changes

@AndrewChubatiuk AndrewChubatiuk force-pushed the frontend-build branch 8 times, most recently from f0bb400 to 2f0f9ea Compare January 18, 2024 00:31
@justinclift
Copy link
Member

Thinking this bit over:

renamed docker-compose.yml to compose.yml as it's supported by docker compose v2 by default

I'm unsure if we want that rename. My thinking is that docker-compose.yml is widely known and recognised, while compose.yml isn't.

REDASH_PRODUCTION: "true"
PERCY_TOKEN: ddbcffd4497c339ea4dd356b9cd04c998f84f311df06b3dc96146a8a1228d170
CYPRESS_PROJECT_ID: 924cka
CYPRESS_RECORD_KEY: c0592115-a05c-4746-a203-ffc080db6881
Copy link
Member

Choose a reason for hiding this comment

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

Same question as above. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these values were just b64 encoded. need to move them to secrets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can remove these values if you can move them to secrets

Copy link
Member

Choose a reason for hiding this comment

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

This sounded familiar, so after some looking I've found previous discussion about those values:

f3892e0#commitcomment-120444257

Looks like they were put there on purpose when we were previously using CircleCI.

... this was intentional for CircleCI, because secrets don't work with PRs from Forked repositories.

We've moved from CircleCI to GitHub Actions, but the same thing might apply. We'd probably want to double check though, just to be sure.

Copy link
Contributor Author

@AndrewChubatiuk AndrewChubatiuk Jan 18, 2024

Choose a reason for hiding this comment

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

github actions with pull_request event type have the same behavior as in CircleCI, but we can try pull_request_target, which requires more attention to PR before running it, cause it provides a token with a write access to base repo, but also provides an access to base repo secrets

@AndrewChubatiuk AndrewChubatiuk force-pushed the frontend-build branch 5 times, most recently from be7b32a to bc5ceba Compare January 18, 2024 12:19
@AndrewChubatiuk
Copy link
Contributor Author

@justinclift could you please review it again?

@AndrewChubatiuk
Copy link
Contributor Author

AndrewChubatiuk commented Feb 3, 2024

@guidopetri @justinclift @eradman could you please review this MR?
With pull_request_target event type (which redash was recently switched to) Github Actions uses a pipeline from a target(master) branch, so this MR will never be green

@eradman
Copy link
Collaborator

eradman commented Feb 5, 2024

When I run the build there are a number of new warnings:

$ make
docker compose build
WARN[0000] The "COMMIT_INFO_SHA" variable is not set. Defaulting to a blank string.
WARN[0000] The "COMMIT_INFO_REMOTE" variable is not set. Defaulting to a blank string.
WARN[0000] The "CYPRESS_PROJECT_ID" variable is not set. Defaulting to a blank string.
WARN[0000] The "PERCY_TOKEN" variable is not set. Defaulting to a blank string.
WARN[0000] The "PERCY_BRANCH" variable is not set. Defaulting to a blank string.
WARN[0000] The "COMMIT_INFO_AUTHOR" variable is not set. Defaulting to a blank string.
WARN[0000] The "COMMIT_INFO_BRANCH" variable is not set. Defaulting to a blank string.
WARN[0000] The "COMMIT_INFO_MESSAGE" variable is not set. Defaulting to a blank string.
WARN[0000] The "CYPRESS_RECORD_KEY" variable is not set. Defaulting to a blank string.
WARN[0000] The "PERCY_COMMIT" variable is not set. Defaulting to a blank string.
WARN[0000] The "PERCY_PULL_REQUEST" variable is not set. Defaulting to a blank string.
WARN[0000] The "REDASH_PRODUCTION" variable is not set. Defaulting to a blank string.
WARN[0000] The "REDASH_PRODUCTION" variable is not set. Defaulting to a blank string.
WARN[0000] The "REDASH_PRODUCTION" variable is not set. Defaulting to a blank string.

The build works, but these messages make it look like I am missing a step. I'd say we should only emit a warning if the developer has an incomplete configuration.

@AndrewChubatiuk
Copy link
Contributor Author

@eradman made these variable overridable and empty by default to remove warnings

bin/docker-entrypoint Outdated Show resolved Hide resolved
compose.base.yaml Outdated Show resolved Hide resolved
tests/__init__.py Outdated Show resolved Hide resolved
@@ -68,3 +54,27 @@ services:
- "1080:1080"
- "1025:1025"
restart: unless-stopped
cypress:
ipc: host
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. Hadn't come across this docker setting before. Looks useful to know about for some situations. 😄

https://docs.docker.com/reference/cli/docker/container/run/#ipc

Copy link
Member

@justinclift justinclift left a comment

Choose a reason for hiding this comment

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

This looks 95% good to me. The only two important things that I think need changing before it can be merged are:

  • Change the migrate name back to create_db in the docker entrypoint

    • And whatever calls that name of course
  • Remove the change of REDASH_REDIS_URL environment variable

    • It's already documented using this name
  • Remove the change of REDASH_DATABASE_URL environment variable

    • It's already documented using this name

For updating this, please just add new commits so I don't have to re-review the entire thing. 😄

Makefile Show resolved Hide resolved
Copy link
Member

@justinclift justinclift left a comment

Choose a reason for hiding this comment

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

99% there now. Just needs the Makefile target changed in order to merge this. 😄

Makefile Show resolved Hide resolved
justinclift
justinclift previously approved these changes Apr 10, 2024
Copy link
Member

@justinclift justinclift left a comment

Choose a reason for hiding this comment

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

Looks good to me. 😄

@justinclift
Copy link
Member

Ahhh, yeah. We might as well include the lint change too. All good. 😄

@justinclift justinclift merged commit 3f19534 into getredash:master Apr 10, 2024
9 of 11 checks passed
@AndrewChubatiuk AndrewChubatiuk mentioned this pull request Apr 10, 2024
9 tasks
@AndrewChubatiuk AndrewChubatiuk mentioned this pull request Apr 12, 2024
eradman pushed a commit to eradman/redash that referenced this pull request May 7, 2024
…)"

Revert all commits >= 3f19534

These changes were far to invasive to test properly.
@AndrewChubatiuk AndrewChubatiuk deleted the frontend-build branch May 9, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants