CI: move parity job from trial account to Flagsmith prod Snowflake with a scoped role

未关闭
#2 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
github-actions, python

调研方向

首先检查 engine-parity CI job、现有的 Snowflake 配置以及 repository 的 GH secrets。Provision FS_CI、范围受限的 role、service user、warehouse monitor 和密钥对身份验证,然后更新列出的 secrets,并验证 parity tests 是否能够在不授予更广泛 grants 的情况下创建和删除每次运行所使用的表。

由索引模型根据 Issue 内容生成。

描述

The engine-parity CI job currently runs against my personal Snowflake trial account under ACCOUNTADMIN. The current trial account is tied to a personal email and expires; production account with billing is the durable home.

What needs to happen

  1. Provision a CI database + schema in the Flagsmith prod Snowflake account. Suggested layout: a dedicated FS_CI database, scratch schema PUBLIC. The parity tests already create per-run transient IDENTITIES_PARITY_<uuid> / TRAITS_PARITY_<uuid> tables there and drop them on teardown, so concurrent runs don't collide.

  2. Create a least-privilege role for CI, e.g. FS_SQL_ENGINE_CI_RW. Required grants:

    USE ROLE SECURITYADMIN;
    CREATE ROLE FS_SQL_ENGINE_CI_RW;
    
    USE ROLE SYSADMIN;
    GRANT USAGE ON DATABASE FS_CI TO ROLE FS_SQL_ENGINE_CI_RW;
    GRANT USAGE ON SCHEMA FS_CI.PUBLIC TO ROLE FS_SQL_ENGINE_CI_RW;
    GRANT CREATE TABLE ON SCHEMA FS_CI.PUBLIC TO ROLE FS_SQL_ENGINE_CI_RW;
    GRANT USAGE ON WAREHOUSE FS_CI_WH TO ROLE FS_SQL_ENGINE_CI_RW;
    
    GRANT ROLE FS_SQL_ENGINE_CI_RW TO USER <ci-user>;
    ALTER USER <ci-user> SET DEFAULT_ROLE = FS_SQL_ENGINE_CI_RW;
    

    No grants beyond that — the parity tests do CREATE TRANSIENT TABLE, INSERT, SELECT, DROP TABLE and that's it.

  3. Provision a service user for CI (e.g. flagsmith_sql_engine_ci) with key-pair auth. Generate the keypair, register the public key on the user, capture the private key for GH secrets. Disable password auth on the user.

  4. Add a resource monitor on FS_CI_WH capping monthly credit spend (suggest $5-10 / month — current usage is ~$0.05 per CI run, ~$2-5 / month at heavy PR volume).

  5. Update GH secrets in this repo:

    • SNOWFLAKE_ACCOUNT → prod account locator
    • SNOWFLAKE_USERflagsmith_sql_engine_ci
    • SNOWFLAKE_ROLEFS_SQL_ENGINE_CI_RW
    • SNOWFLAKE_WAREHOUSEFS_CI_WH
    • SNOWFLAKE_DATABASEFS_CI
    • SNOWFLAKE_SCHEMAPUBLIC
    • SNOWFLAKE_PRIVATE_KEY → contents of the new key file
主要语言
Python
星标
1
派生
0
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Flagsmith/flagsmith-sql-flag-engine 的其他 Issue

查看 Flagsmith/flagsmith-sql-flag-engine 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。