Skip to content

Commit

Permalink
[Dadosfera] FEAT: Dadosfera changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelsantanaep committed Apr 6, 2024
2 parents a900c85 + d74c248 commit 3a775cb
Show file tree
Hide file tree
Showing 38 changed files with 654 additions and 84 deletions.
Empty file added .clj-kondo/.lock
Empty file.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
;!zprint {:width 140}

{:lint-as {steffan-westcott.clj-otel.api.trace.span/with-span-binding clojure.core/let}}
{:lint-as {steffan-westcott.clj-otel.api.trace.span/with-span-binding clojure.core/let}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:lint-as {metabase.driver.mongo.connection/with-mongo-client clojure.core/let, metabase.driver.mongo.connection/with-mongo-database clojure.core/let}, :config-in-call {metabase.driver.mongo.connection/with-mongo-client {:ignore [:unresolved-symbol :type-mismatch]}, metabase.driver.mongo.connection/with-mongo-database {:ignore [:unresolved-symbol :type-mismatch]}}}
10 changes: 8 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM mcr.microsoft.com/vscode/devcontainers/java:11
FROM mcr.microsoft.com/devcontainers/javascript-node:18-bullseye

# Set up nodesource, install node, yarn, fontconfig for static viz, rlwrap for dev ergonomics
#install java on debian
RUN apt-get update && \
apt-get install -y openjdk-11-jre curl

RUN ( curl -fsSL https://deb.nodesource.com/setup_18.x | bash ) \
&& export DEBIAN_FRONTEND=noninteractive \
Expand All @@ -9,3 +11,7 @@ RUN ( curl -fsSL https://deb.nodesource.com/setup_18.x | bash ) \

# install Clojure
RUN curl https://download.clojure.org/install/linux-install-1.11.1.1262.sh | bash

RUN curl -sLO https://raw.githubusercontent.com/clj-kondo/clj-kondo/master/script/install-clj-kondo && \
chmod +x install-clj-kondo && \
./install-clj-kondo
53 changes: 33 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
// https://aka.ms/vscode-remote/devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [3000],

// Comment out the next line to run as root instead.
"remoteUser": "vscode",

"runArgs": ["--network=metabase-dev"],

"postStartCommand": "git config --global --add safe.directory /workspaces/metabase"
}
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile"
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"betterthantomorrow.calva",
"dsznajder.es7-react-js-snippets",
"eamodio.gitlens",
"EditorConfig.EditorConfig",
"styled-components.vscode-styled-components"
],
"settings": {
"calva.showCalvaSaysOnStart": false
}
}
},
// Use 'postCreateCommand' to run commands after the container is created.
"postStartCommand": "bash -i -c 'nvm install && nvm use' && yarn install && git config --global --add safe.directory /workspaces/metabase"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
89 changes: 89 additions & 0 deletions DADOSFERA/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Dadosfera Metabase

- This Repository is a fork of [metabase/metabase](https://github.com/metabase/metabase)

## Update fork

Because we have introduced a few changes to the code, updating it should cause a lot of conflicts with the upstream.

To avoid unnecessary time consuming conflicts resolution, we can use the following strategy:

1. Add metabase remote to the repository

```bash
git remote add metabase git@github.com:metabase/metabase.git
```

2. Fetch the metabase remote

```bash
git fetch metabase
```

3. Checkout to the tag we want to update to (ex: v0.48.5)

```bash
git checkout v0.48.5
```

4. Create a new branch based on that tag

```bash
git checkout -b update/v0.48.5_dadosfera
```

5. Cherry-pick the commit [[Dadosfera] FEAT: Dadosfera changes](https://github.com/dadosfera/metabase/commit/e7b55ccd0d707aa8943d0b15d7852f13d3939eb2)

```bash
git cherry-pick e7b55ccd0d707aa8943d0b15d7852f13d3939eb2
```

This commit contains all changes we need to apply to metabase. It's important to keep it updated with every change we make to the code.

6. Resolve the conflicts, paying close attention to the changes we have made to the code.

> Sometimes the file we altered has been deleted in the upstream, but that doesn't mean the changes we made should be discarded. Check for new files that may have been added and that we may need to alter.
>
> ex.: `Header.jsx` was deleted in the upstream, but we have made changes to it. Search for files named `Header.tsx` or similars to see if the changes we made to should be applied to a new file.
7. After resolving the conflicts, run the application to make sure everything is working as expected.

```bash
docker build --no-cache --build-arg="VERSION=latest" -t metabase_local:latest .

docker run -p 3000:3000 --name metabase_local metabase_local:latest
```

8. If everything is working fine, commit the resolved conflicts using the same name as the previous

```bash
git commit -m "[Dadosfera] FEAT: Dadosfera changes"
```

> Remember to commit all the necessary changes into a single commit, to help other updates in the future.
9. **Copy the commit hash and description/title and save it to step 5** on this README, so it's always updated.

10. Push the changes and publish your branch on remote

```bash
git push origin update/v0.48.5_dadosfera
```

## Launching changes to Staging and production branches

After updating the fork, we need to launch the changes to the staging and production branches. The pull request is the best way to do so, but it shold rise a lot of conflicts, since our new branch is based on **metabase/metabase** not **dadosfera/metabase**. To avoid that, we can use the following strategy:

1. Reset stg branch to the new branch and force push

```bash
git checkout stg
git reset --hard update/v0.48.5_dadosfera
git push origin stg --force
```

> This is a dangerous command, and is intended to be used by advanced git users. It will overwrite the remote branch with your local changes. If you are not sure about what you are doing, please ask for help.
2. Run the deploy to stg using [metabase-deploy](https://github.com/dadosfera/metabase-deploy/actions/workflows/deploy-manually.yml) github action

3. Repeat steps for the production branch when all is validated on the staging environment
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { useCallback, useRef } from "react";
import { t } from "ttag";

Expand Down Expand Up @@ -146,7 +147,7 @@ const DatabaseEditAppSidebar = ({
)}
</SidebarGroup.List>
</SidebarGroup>
<SidebarGroup>
{/* <SidebarGroup>
<SidebarGroup.Name>{t`Danger Zone`}</SidebarGroup.Name>
<SidebarGroup.List>
{isSyncCompleted(database) && (
Expand Down Expand Up @@ -182,7 +183,7 @@ const DatabaseEditAppSidebar = ({
</SidebarGroup.ListItem>
)}
</SidebarGroup.List>
</SidebarGroup>
</SidebarGroup> */}
</SidebarContent>
{hasModelActionsSection && (
<ModelActionsSidebarContent>
Expand Down
Loading

0 comments on commit 3a775cb

Please sign in to comment.