From 5ac71b67c2875ffecb46844a7ad4f5af6ba3f71d Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sun, 30 Oct 2022 08:58:16 +0100 Subject: [PATCH 1/5] Rename all to rules_resf and resf_frontend --- README.md | 2 +- WORKSPACE | 17 ++++ apollo/cmd/apollo/ci/BUILD.bazel | 4 +- apollo/cmd/apollo/ci/deploy.jsonnet | 4 +- apollo/cmd/apollostarter/ci/BUILD.bazel | 4 +- apollo/cmd/apollostarter/ci/deploy.jsonnet | 4 +- apollo/cmd/apolloworker/ci/BUILD.bazel | 4 +- apollo/cmd/apolloworker/ci/deploy.jsonnet | 4 +- apollo/migrate/BUILD | 2 +- apollo/ui/BUILD.bazel | 10 +- apollo/ui/deploy.jsonnet | 4 +- apollo/ui/server/index.mjs | 12 ++- apollo/ui/src/entrypoint.tsx | 12 --- ci/frontend.jsonnet | 4 +- ci/istio/envoyfilter.libsonnet | 4 +- ci/kubernetes.jsonnet | 6 +- common/frontend_server/index.mjs | 96 +++++++++++-------- common/frontend_server/upstream.mjs | 8 +- hydra/deploy/admin/BUILD.bazel | 4 +- hydra/deploy/admin/deploy.jsonnet | 4 +- hydra/deploy/public/BUILD.bazel | 4 +- hydra/deploy/public/deploy.jsonnet | 4 +- hydra/pkg/hydra/autosignup.go | 7 +- hydra/pkg/hydra/autosignup.mjs | 12 +-- infrastructure/certmanager/BUILD.bazel | 2 +- infrastructure/externaldns/BUILD.bazel | 2 +- infrastructure/istio-dev/BUILD.bazel | 2 +- infrastructure/istio-prod/BUILD.bazel | 2 +- initdb/BUILD.bazel | 2 +- initdb/main.go | 4 +- obsidian/cmd/v1/obsidian/ci/BUILD.bazel | 4 +- obsidian/cmd/v1/obsidian/ci/deploy.jsonnet | 4 +- obsidian/impl/v1/oauth2.go | 5 +- obsidian/migrate/BUILD.bazel | 2 +- obsidian/ui/BUILD | 10 +- obsidian/ui/deploy.jsonnet | 6 +- obsidian/ui/server/index.mjs | 14 ++- peridot/builder/v1/workflow/infrastructure.go | 25 ++--- peridot/cmd/v1/keykeeper/ci/BUILD.bazel | 4 +- peridot/cmd/v1/keykeeper/ci/deploy.jsonnet | 4 +- peridot/cmd/v1/peridotbuilder/ci/BUILD.bazel | 2 +- .../cmd/v1/peridotephemeral/ci/BUILD.bazel | 4 +- .../cmd/v1/peridotephemeral/ci/deploy.jsonnet | 4 +- peridot/cmd/v1/peridotserver/ci/BUILD.bazel | 4 +- .../cmd/v1/peridotserver/ci/deploy.jsonnet | 4 +- peridot/cmd/v1/yumrepofs/ci/BUILD.bazel | 4 +- peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet | 4 +- .../cmd/v1/yumrepofsupdater/ci/BUILD.bazel | 4 +- .../cmd/v1/yumrepofsupdater/ci/deploy.jsonnet | 4 +- peridot/migrate/BUILD | 2 +- peridot/ui/BUILD | 8 +- peridot/ui/deploy.jsonnet | 6 +- peridot/ui/server/index.mjs | 26 +++-- .../cmd/publisher-legacy-errata/BUILD.bazel | 2 +- rules_byc/internal/container/BUILD | 3 - rules_byc/internal/k8s/BUILD | 6 -- {rules_byc => rules_resf}/BUILD | 0 {rules_byc => rules_resf}/defs.bzl | 26 ++--- {rules_byc => rules_resf}/internal/BUILD | 0 rules_resf/internal/container/BUILD | 3 + .../internal/container/container.bzl | 0 rules_resf/internal/k8s/BUILD | 6 ++ .../internal/k8s/k8s.bash | 0 .../internal/k8s/k8s.bzl | 2 +- .../internal/resf_bundle}/BUILD | 6 +- .../internal/resf_bundle}/babel.config.js | 0 .../internal/resf_bundle}/index.hbs | 0 .../internal/resf_bundle}/index_internal.hbs | 0 .../internal/resf_bundle}/index_no_mobile.hbs | 0 .../internal/resf_bundle}/packserver.bash | 0 .../internal/resf_bundle/resf_bundle.bzl | 51 +++++----- .../internal/resf_bundle}/run_child.mjs | 0 .../internal/resf_bundle}/tailwind.config.js | 4 +- .../tailwind.config.nopreflight.js | 0 .../internal/resf_bundle}/tsconfig.json | 0 .../internal/resf_bundle}/webpack.config.js | 32 +------ servicecatalog/common.go | 8 +- spicedb/deploy/BUILD.bazel | 4 +- spicedb/deploy/deploy.jsonnet | 4 +- temporalutils/client.go | 9 +- utils/aws.go | 5 +- utils/env.go | 2 +- utils/flags.go | 9 +- 83 files changed, 296 insertions(+), 290 deletions(-) delete mode 100644 rules_byc/internal/container/BUILD delete mode 100644 rules_byc/internal/k8s/BUILD rename {rules_byc => rules_resf}/BUILD (100%) rename {rules_byc => rules_resf}/defs.bzl (82%) rename {rules_byc => rules_resf}/internal/BUILD (100%) create mode 100644 rules_resf/internal/container/BUILD rename {rules_byc => rules_resf}/internal/container/container.bzl (100%) create mode 100644 rules_resf/internal/k8s/BUILD rename {rules_byc => rules_resf}/internal/k8s/k8s.bash (100%) rename {rules_byc => rules_resf}/internal/k8s/k8s.bzl (96%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/BUILD (89%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/babel.config.js (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/index.hbs (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/index_internal.hbs (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/index_no_mobile.hbs (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/packserver.bash (100%) rename rules_byc/internal/byc_bundle/byc_bundle.bzl => rules_resf/internal/resf_bundle/resf_bundle.bzl (91%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/run_child.mjs (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/tailwind.config.js (97%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/tailwind.config.nopreflight.js (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/tsconfig.json (100%) rename {rules_byc/internal/byc_bundle => rules_resf/internal/resf_bundle}/webpack.config.js (88%) diff --git a/README.md b/README.md index 63af3a42..79a2e0ba 100644 --- a/README.md +++ b/README.md @@ -51,4 +51,4 @@ For best experience use IntelliJ+Bazel but `govendor` creates structure that is #### Run UI in development mode `ibazel run //TARGET:TARGET.server` - example: `ibazel run //apollo/ui:apollo.server` #### Find UI server targets -`bazel query 'attr(tags, "byc_frontend_server", //...)'` +`bazel query 'attr(tags, "resf_frontend_server", //...)'` diff --git a/WORKSPACE b/WORKSPACE index 910a0256..94880a75 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -100,6 +100,23 @@ go_repository( version = "v0.0.0-20210514164344-f6687ab2804c", ) +# --start target-determinator-- +http_archive( + name = "bazel_contrib_target_determinator", + sha256 = "1245f255cf5b857181adb7606a45a738ac4404278f33b3dc0ce0097ec70ccbb3", + strip_prefix = "target-determinator-61d25f5e13a4b2205b338531b929464e3ed5eb3d", + urls = ["https://github.com/bazel-contrib/target-determinator/archive/61d25f5e13a4b2205b338531b929464e3ed5eb3d.tar.gz"], +) + +load("@bazel_contrib_target_determinator//:third_party/go/deps.bzl", td_go_dependencies = "go_dependencies") + +td_go_dependencies() + +load("@bazel_contrib_target_determinator//:third_party/go/bazel_differ_deps.bzl", td_differ_go_dependencies = "go_dependencies") + +td_differ_go_dependencies() +# --end target-determinator-- + gazelle_dependencies() load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies") diff --git a/apollo/cmd/apollo/ci/BUILD.bazel b/apollo/cmd/apollo/ci/BUILD.bazel index 473d0c65..94bd2e07 100644 --- a/apollo/cmd/apollo/ci/BUILD.bazel +++ b/apollo/cmd/apollo/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -14,6 +14,6 @@ container( peridot_k8s( name = "apollo", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = ["//ci"], ) diff --git a/apollo/cmd/apollo/ci/deploy.jsonnet b/apollo/cmd/apollo/ci/deploy.jsonnet index 7498dcb2..0f72c301 100644 --- a/apollo/cmd/apollo/ci/deploy.jsonnet +++ b/apollo/cmd/apollo/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'apollo', replicas: 1, dbname: 'apollo', diff --git a/apollo/cmd/apollostarter/ci/BUILD.bazel b/apollo/cmd/apollostarter/ci/BUILD.bazel index da2ceacf..a01c778d 100644 --- a/apollo/cmd/apollostarter/ci/BUILD.bazel +++ b/apollo/cmd/apollostarter/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -11,7 +11,7 @@ container( peridot_k8s( name = "apollostarter", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = [ "//ci", ], diff --git a/apollo/cmd/apollostarter/ci/deploy.jsonnet b/apollo/cmd/apollostarter/ci/deploy.jsonnet index 9872c894..795dfe2e 100644 --- a/apollo/cmd/apollostarter/ci/deploy.jsonnet +++ b/apollo/cmd/apollostarter/ci/deploy.jsonnet @@ -1,4 +1,4 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; @@ -6,7 +6,7 @@ local utils = import 'ci/utils.jsonnet'; local site = std.extVar('site'); -bycdeploy.new({ +RESFDEPLOY.new({ name: 'apollostarter', replicas: 1, dbname: 'apollo', diff --git a/apollo/cmd/apolloworker/ci/BUILD.bazel b/apollo/cmd/apolloworker/ci/BUILD.bazel index 8dcde682..be52c68d 100644 --- a/apollo/cmd/apolloworker/ci/BUILD.bazel +++ b/apollo/cmd/apolloworker/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -11,7 +11,7 @@ container( peridot_k8s( name = "apolloworker", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = [ "//ci", ], diff --git a/apollo/cmd/apolloworker/ci/deploy.jsonnet b/apollo/cmd/apolloworker/ci/deploy.jsonnet index 9af7f880..8d604bf3 100644 --- a/apollo/cmd/apolloworker/ci/deploy.jsonnet +++ b/apollo/cmd/apolloworker/ci/deploy.jsonnet @@ -1,4 +1,4 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; @@ -6,7 +6,7 @@ local utils = import 'ci/utils.jsonnet'; local site = std.extVar('site'); -bycdeploy.new({ +RESFDEPLOY.new({ name: 'apolloworker', replicas: 1, dbname: 'apollo', diff --git a/apollo/migrate/BUILD b/apollo/migrate/BUILD index e664efd7..57d1df0b 100644 --- a/apollo/migrate/BUILD +++ b/apollo/migrate/BUILD @@ -1,5 +1,5 @@ package(default_visibility = ["//visibility:public"]) -load("//rules_byc:defs.bzl", "migration_tar") +load("//rules_resf:defs.bzl", "migration_tar") migration_tar() diff --git a/apollo/ui/BUILD.bazel b/apollo/ui/BUILD.bazel index 31a9920a..19c75ace 100644 --- a/apollo/ui/BUILD.bazel +++ b/apollo/ui/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_BASE", "byc_frontend", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_BASE", "container", "peridot_k8s", "resf_frontend") package(default_visibility = ["//visibility:public"]) @@ -8,18 +8,18 @@ server_entrypoint = "server/index.mjs" server_srcs = glob(["server/**/*.mjs"]) -byc_frontend( +resf_frontend( name = "apollo", srcs = glob([ "src/**/*.tsx", "src/**/*.ts", ]), entrypoint = "apollo/ui/src/entrypoint.tsx", - index_html = "//rules_byc/internal/byc_bundle:index_no_mobile.hbs", + index_html = "//rules_resf/internal/resf_bundle:index_no_mobile.hbs", server_deps = server_deps, server_entrypoint = server_entrypoint, server_srcs = server_srcs, - tailwind_config = "//rules_byc/internal/byc_bundle:tailwind.config.nopreflight.js", + tailwind_config = "//rules_resf/internal/resf_bundle:tailwind.config.nopreflight.js", title = "Rocky Enterprise Software Foundation Product Errata", deps = [ "//apollo/proto/v1:client_typescript", @@ -52,6 +52,6 @@ container( peridot_k8s( name = "apollo-frontend", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_BASE, + outs = RESFDEPLOY_OUTS_BASE, deps = ["//ci"], ) diff --git a/apollo/ui/deploy.jsonnet b/apollo/ui/deploy.jsonnet index a5768462..bd1b9768 100644 --- a/apollo/ui/deploy.jsonnet +++ b/apollo/ui/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local frontend = import 'ci/frontend.jsonnet'; local tag = std.extVar('tag'); -bycdeploy.new({ +RESFDEPLOY.new({ name: 'apollo-frontend', backend: false, migrate: false, diff --git a/apollo/ui/server/index.mjs b/apollo/ui/server/index.mjs index b942f86d..9f24fa97 100644 --- a/apollo/ui/server/index.mjs +++ b/apollo/ui/server/index.mjs @@ -31,24 +31,28 @@ */ import server from '../../../common/frontend_server/index.mjs'; -import { svcNameHttp, endpointHttp, NS } from '../../../common/frontend_server/upstream.mjs'; +import { + svcNameHttp, + endpointHttp, + NS, +} from '../../../common/frontend_server/upstream.mjs'; export default async function run(webpackConfig) { const devFrontendUrl = 'http://errata.pdot.localhost:9007'; const envPublicUrl = process.env['APOLLO_FRONTEND_HTTP_PUBLIC_URL']; - const frontendUrl = process.env['BYC_NS'] ? envPublicUrl : devFrontendUrl; + const frontendUrl = process.env['RESF_NS'] ? envPublicUrl : devFrontendUrl; server({ baseURL: frontendUrl, apis: { '/api': { prodApiUrl: endpointHttp(svcNameHttp('apollo'), NS('apollo')), - devApiUrl: `https://apollo-dev.internal.rdev.ciq.localhost` + devApiUrl: `https://apollo-dev.internal.rdev.ciq.localhost`, }, }, port: 9007, disableAuth: true, - webpackConfig + webpackConfig, }).then(); } diff --git a/apollo/ui/src/entrypoint.tsx b/apollo/ui/src/entrypoint.tsx index df3d7167..19cbe703 100644 --- a/apollo/ui/src/entrypoint.tsx +++ b/apollo/ui/src/entrypoint.tsx @@ -38,20 +38,8 @@ import CssBaseline from '@mui/material/CssBaseline'; import { Root } from './components/Root'; import 'tailwind/tailwind.css'; -import { createMuiTheme, ThemeProvider } from '@mui/material'; import { PeridotThemeProvider } from 'common/mui/theme'; -const theme = createMuiTheme({ - palette: { - primary: { - main: '#18181b', - }, - secondary: { - main: '#10b981', - }, - }, -}); - export const app = () => { ReactDOM.render( diff --git a/ci/frontend.jsonnet b/ci/frontend.jsonnet index 214d1dca..4f8981ef 100644 --- a/ci/frontend.jsonnet +++ b/ci/frontend.jsonnet @@ -9,7 +9,7 @@ value: 'production', }, { - name: 'BYC_SECRET', + name: 'RESF_SECRET', valueFrom: true, secret: { name: 'server', @@ -27,4 +27,4 @@ }, }, ] -} \ No newline at end of file +} diff --git a/ci/istio/envoyfilter.libsonnet b/ci/istio/envoyfilter.libsonnet index 821b91f4..da1c1f47 100644 --- a/ci/istio/envoyfilter.libsonnet +++ b/ci/istio/envoyfilter.libsonnet @@ -3,7 +3,7 @@ local base = import 'ci/istio/base.libsonnet'; { FILTER_TYPE_CUSTOM: 'custom', FILTER_TYPE_REDIRECT: 'redirect', - MATCH_TYPE_BYCDEPLOY: 'bycdeploy', + MATCH_TYPE_RESFDEPLOY: 'RESFDEPLOY', MATCH_TYPE_ALL: 'all', envoy_filter(info):: @@ -18,7 +18,7 @@ local base = import 'ci/istio/base.libsonnet'; }, spec: if filterType == $.FILTER_TYPE_CUSTOM then info.filter else { workloadSelector: if matchType == $.MATCH_TYPE_ALL then {} - else if matchType == $.MATCH_TYPE_BYCDEPLOY then { + else if matchType == $.MATCH_TYPE_RESFDEPLOY then { } else non_existing_value, }, diff --git a/ci/kubernetes.jsonnet b/ci/kubernetes.jsonnet index 2e989c92..2ad54d38 100644 --- a/ci/kubernetes.jsonnet +++ b/ci/kubernetes.jsonnet @@ -16,16 +16,16 @@ local utils = import 'ci/utils.jsonnet'; local defaultEnvs = [ { - name: 'BYC_ENV', + name: 'RESF_ENV', value: stageNoDash, }, { - name: 'BYC_NS', + name: 'RESF_NS', valueFrom: true, field: 'metadata.namespace', }, { - name: 'BYC_SERVICE_ACCOUNT', + name: 'RESF_SERVICE_ACCOUNT', valueFrom: true, field: 'spec.serviceAccountName', }, diff --git a/common/frontend_server/index.mjs b/common/frontend_server/index.mjs index 27bd5b0d..40855373 100644 --- a/common/frontend_server/index.mjs +++ b/common/frontend_server/index.mjs @@ -50,18 +50,18 @@ const { createProxyMiddleware } = httpProxyMiddleware; const { auth } = expressOidc; -export default async function(opts) { +export default async function (opts) { // Create a new app for health checks. const appZ = express(); - appZ.get('/healthz', ((req, res) => { + appZ.get('/healthz', (req, res) => { res.end(); - })); - appZ.get('/_/healthz', ((req, res) => { + }); + appZ.get('/_/healthz', (req, res) => { res.end(); - })); + }); const app = express(); - app.use(function(req, res, next) { + app.use(function (req, res, next) { // Including byc-internal-req: 1 should return the Z page if (req.header('byc-internal-req') === 'yes') { appZ(req, res, next); @@ -71,9 +71,9 @@ export default async function(opts) { }); const prod = process.env.NODE_ENV === 'production'; - const port = prod ? (process.env.PORT || 8086) : opts.port; + const port = prod ? process.env.PORT || 8086 : opts.port; - opts.secret = process.env.BYC_SECRET; + opts.secret = process.env.RESF_SECRET; // If we're in prod, then a secret has to be present if (prod && (!opts.secret || opts.secret.length < 32)) { @@ -86,9 +86,11 @@ export default async function(opts) { console.log(`Using clientID: ${opts.clientID}`); console.log(`Using baseURL: ${opts.baseURL}`); - if ((opts.issuerBaseURL.endsWith('.localhost') - || opts.issuerBaseURL.endsWith('.localhost/')) - && process.env['BYC_ENV']) { + if ( + (opts.issuerBaseURL.endsWith('.localhost') || + opts.issuerBaseURL.endsWith('.localhost/')) && + process.env['RESF_ENV'] + ) { const kong = 'kong-proxy.kong.svc.cluster.local'; const urlObject = new URL(opts.issuerBaseURL); console.warn(`Forcing ${urlObject.hostname} to resolve to ${kong}`); @@ -128,18 +130,18 @@ export default async function(opts) { idpLogout: true, authorizationParams: { response_type: 'code', - scope: 'openid profile email offline_access' + scope: 'openid profile email offline_access', }, session: { rolling: true, rollingDuration: 86400, - absoluteDuration: 86400 * 7 + absoluteDuration: 86400 * 7, }, routes: { callback: '/oauth2/callback', logout: '/oauth2/logout', - login: '/oauth2/login' - } + login: '/oauth2/login', + }, }; // If we have a authentication prefix, only force redirect on paths with that prefix @@ -153,8 +155,8 @@ export default async function(opts) { // Again, a bypass here doesn't accomplish anything. let requireEmailSuffix = opts.authOptions?.requireEmailSuffix; if (process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX']) { - requireEmailSuffix = process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX'].split( - ','); + requireEmailSuffix = + process.env['AUTH_OPTIONS_REQUIRE_EMAIL_SUFFIX'].split(','); } if (requireEmailSuffix) { middlewares.push((req, res, next) => { @@ -174,21 +176,26 @@ export default async function(opts) { if (isAllowed) { next(); } else { - res.redirect(process.env['AUTH_REJECT_REDIRECT_URL'] - ? process.env['AUTH_REJECT_REDIRECT_URL'] - : (opts.authOptions.authRejectRedirectUrl - || 'https://rockylinux.org')); + res.redirect( + process.env['AUTH_REJECT_REDIRECT_URL'] + ? process.env['AUTH_REJECT_REDIRECT_URL'] + : opts.authOptions.authRejectRedirectUrl || + 'https://rockylinux.org' + ); } }); } - app.use((req, res, next) => { - try { - auth(config)(req, res, next); - } catch (err) { - next(err); - } - }, [middlewares]); + app.use( + (req, res, next) => { + try { + auth(config)(req, res, next); + } catch (err) { + next(err); + } + }, + [middlewares] + ); } // Currently in dev, webpack is handling all file serving @@ -196,9 +203,11 @@ export default async function(opts) { let distDir = process.cwd() + '/dist'; if (prod) { // Enable security hardening in prod - app.use(helmet({ - contentSecurityPolicy: false - })); + app.use( + helmet({ + contentSecurityPolicy: false, + }) + ); // Prod expects a certain container structure for all apps // Packaging this application with the web base should do @@ -215,7 +224,7 @@ export default async function(opts) { app.use(express.static(distDir)); if (opts.apis) { - Object.keys(opts.apis).forEach(x => { + Object.keys(opts.apis).forEach((x) => { app.use(x, async (req, res, next) => { let authorization = ''; @@ -244,23 +253,25 @@ export default async function(opts) { // Make it possible to override api url using an env variable. // Example: /api can be set with URL_API // Example 2: /manage/api can be set with URL_MANAGE_API - const prodEnvName = `URL_${x.substr(1).replace('/', - '_').toUpperCase()}`; + const prodEnvName = `URL_${x + .substr(1) + .replace('/', '_') + .toUpperCase()}`; const apiUrl = process.env[prodEnvName] ? process.env[prodEnvName] : prod - ? opts.apis[x].prodApiUrl - : opts.apis[x].devApiUrl; + ? opts.apis[x].prodApiUrl + : opts.apis[x].devApiUrl; createProxyMiddleware({ target: apiUrl, changeOrigin: true, headers: { host: apiUrl, - authorization + authorization, }, - pathRewrite: rewrite + pathRewrite: rewrite, })(req, res); }); }); @@ -292,7 +303,7 @@ export default async function(opts) { return { email, name, - picture + picture, }; }; @@ -314,7 +325,7 @@ export default async function(opts) { webpackMildCompile(compiler); const wdm = webpackDevMiddleware(compiler, { - publicPath: opts.webpackConfig.output.publicPath + publicPath: opts.webpackConfig.output.publicPath, }); app.use(history()); @@ -322,14 +333,15 @@ export default async function(opts) { // Here we cache the old send function to re-use after we run the HTML through handlebars const oldSend = res.send; - res.send = data => { + res.send = (data) => { let newData; // Check if the request returned a HTML page // For SPAs, the only HTML page is the index page if (res.get('content-type').indexOf('text/html') !== -1) { // Run through handlebars compiler with our template parameters newData = hbs.handlebars.compile(data.toString())( - templateParams(req)); + templateParams(req) + ); } else { // No new data, just return old data newData = data; diff --git a/common/frontend_server/upstream.mjs b/common/frontend_server/upstream.mjs index 7d4a6443..ee3808f2 100644 --- a/common/frontend_server/upstream.mjs +++ b/common/frontend_server/upstream.mjs @@ -42,7 +42,7 @@ export function envOverridable(svcName, protocol, x) { } export function svcName(svc, protocol) { - let env = process.env['BYC_ENV']; + let env = process.env['RESF_ENV']; if (!env) { env = 'dev'; } @@ -54,7 +54,7 @@ export function svcNameHttp(svc) { } export function endpoint(generatedServiceName, ns, port) { - const forceNs = process.env['BYC_FORCE_NS']; + const forceNs = process.env['RESF_FORCE_NS']; if (forceNs) { ns = forceNs; } @@ -67,9 +67,9 @@ export function endpointHttp(generatedServiceName, ns, port = '') { } export function NS(ns) { - const env = process.env['BYC_ENV']; + const env = process.env['RESF_ENV']; if (!env || env === 'dev') { - const bycNs = process.env['BYC_NS']; + const bycNs = process.env['RESF_NS']; if (!bycNs) { return `${os.userInfo().username}-dev`; } diff --git a/hydra/deploy/admin/BUILD.bazel b/hydra/deploy/admin/BUILD.bazel index fd776096..6150fde3 100644 --- a/hydra/deploy/admin/BUILD.bazel +++ b/hydra/deploy/admin/BUILD.bazel @@ -1,9 +1,9 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "peridot_k8s") peridot_k8s( name = "admin", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, force_normal_tags = True, deps = [ "//ci", diff --git a/hydra/deploy/admin/deploy.jsonnet b/hydra/deploy/admin/deploy.jsonnet index 7821f805..4e1e29d1 100644 --- a/hydra/deploy/admin/deploy.jsonnet +++ b/hydra/deploy/admin/deploy.jsonnet @@ -1,9 +1,9 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local common = import 'hydra/deploy/common.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'hydra-admin', replicas: 1, dbname: 'hydra', diff --git a/hydra/deploy/public/BUILD.bazel b/hydra/deploy/public/BUILD.bazel index d5d980eb..8133dc0e 100644 --- a/hydra/deploy/public/BUILD.bazel +++ b/hydra/deploy/public/BUILD.bazel @@ -1,9 +1,9 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "peridot_k8s") peridot_k8s( name = "public", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, force_normal_tags = True, deps = [ "//ci", diff --git a/hydra/deploy/public/deploy.jsonnet b/hydra/deploy/public/deploy.jsonnet index 5f4639d3..a6af07c0 100644 --- a/hydra/deploy/public/deploy.jsonnet +++ b/hydra/deploy/public/deploy.jsonnet @@ -1,9 +1,9 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local common = import 'hydra/deploy/common.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'hydra-public', replicas: 1, dbname: 'hydra', diff --git a/hydra/pkg/hydra/autosignup.go b/hydra/pkg/hydra/autosignup.go index 9de1a049..218abcd7 100644 --- a/hydra/pkg/hydra/autosignup.go +++ b/hydra/pkg/hydra/autosignup.go @@ -35,9 +35,10 @@ import ( "fmt" "net/url" "os" - "peridot.resf.org/servicecatalog" "strings" + "peridot.resf.org/servicecatalog" + "github.com/ory/hydra-client-go/client" "github.com/ory/hydra-client-go/client/admin" "github.com/ory/hydra-client-go/models" @@ -64,7 +65,7 @@ func redirectUri(req *AutoSignupRequest) []string { } func secret() string { - env := os.Getenv("BYC_ENV") + env := os.Getenv("RESF_ENV") if env == "" { return "dev-123-secret" } @@ -92,7 +93,7 @@ func AutoSignup(req *AutoSignupRequest) *AutoSignupResponse { ctx := context.TODO() - ns := os.Getenv("BYC_NS") + ns := os.Getenv("RESF_NS") if ns == "" { ns = "dev" } diff --git a/hydra/pkg/hydra/autosignup.mjs b/hydra/pkg/hydra/autosignup.mjs index dccc9a9c..869e5803 100644 --- a/hydra/pkg/hydra/autosignup.mjs +++ b/hydra/pkg/hydra/autosignup.mjs @@ -37,7 +37,7 @@ import { svcNameHttp, endpointHttp, NS, - envOverridable + envOverridable, } from '../../../common/frontend_server/upstream.mjs'; import pkg from '@ory/hydra-client'; import os from 'os'; @@ -60,18 +60,18 @@ function hydraAdminUrl() { const hydraAdmin = new AdminApi( new Configuration({ - basePath: hydraAdminUrl() + basePath: hydraAdminUrl(), }) ); export const hydraPublic = new PublicApi( new Configuration({ - basePath: hydraPublicUrl() + basePath: hydraPublicUrl(), }) ); function secret() { - const env = process.env['BYC_ENV']; + const env = process.env['RESF_ENV']; if (!env || env === 'dev') { return 'dev-123-secret'; } @@ -85,7 +85,7 @@ function secret() { } export async function hydraAutoSignup(req) { - let ns = process.env['BYC_NS']; + let ns = process.env['RESF_NS']; if (!ns || ns === '') { ns = 'dev'; } @@ -109,7 +109,7 @@ export async function hydraAutoSignup(req) { const ret = { clientID: serviceName, - secret: secret() + secret: secret(), }; try { diff --git a/infrastructure/certmanager/BUILD.bazel b/infrastructure/certmanager/BUILD.bazel index 2e79e31d..b6788ca7 100644 --- a/infrastructure/certmanager/BUILD.bazel +++ b/infrastructure/certmanager/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "k8s_apply") +load("//rules_resf:defs.bzl", "k8s_apply") k8s_apply( name = "certmanager", diff --git a/infrastructure/externaldns/BUILD.bazel b/infrastructure/externaldns/BUILD.bazel index cb998c19..c4dbbd57 100644 --- a/infrastructure/externaldns/BUILD.bazel +++ b/infrastructure/externaldns/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "k8s_apply") +load("//rules_resf:defs.bzl", "k8s_apply") k8s_apply( name = "externaldns", diff --git a/infrastructure/istio-dev/BUILD.bazel b/infrastructure/istio-dev/BUILD.bazel index d94d3174..90c530b3 100644 --- a/infrastructure/istio-dev/BUILD.bazel +++ b/infrastructure/istio-dev/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "k8s_apply") +load("//rules_resf:defs.bzl", "k8s_apply") k8s_apply( name = "istio-dev", diff --git a/infrastructure/istio-prod/BUILD.bazel b/infrastructure/istio-prod/BUILD.bazel index 37f4b361..e2f0bf86 100644 --- a/infrastructure/istio-prod/BUILD.bazel +++ b/infrastructure/istio-prod/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "k8s_apply") +load("//rules_resf:defs.bzl", "k8s_apply") k8s_apply( name = "istio-prod", diff --git a/initdb/BUILD.bazel b/initdb/BUILD.bazel index 603a4ef3..b3c8105b 100644 --- a/initdb/BUILD.bazel +++ b/initdb/BUILD.bazel @@ -1,5 +1,5 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") -load("//rules_byc:defs.bzl", "container") +load("//rules_resf:defs.bzl", "container") go_library( name = "initdb_lib", diff --git a/initdb/main.go b/initdb/main.go index a7a89c25..eae9f1ca 100644 --- a/initdb/main.go +++ b/initdb/main.go @@ -81,8 +81,8 @@ func mn(_ *cobra.Command, _ []string) { log.Fatal("no target db") } - env := os.Getenv("BYC_ENV") - namespace := os.Getenv("BYC_NS") + env := os.Getenv("RESF_ENV") + namespace := os.Getenv("RESF_NS") roleName := fmt.Sprintf("%s-%s", namespace, targetDB) secretName := fmt.Sprintf("%s-database-password", targetDB) diff --git a/obsidian/cmd/v1/obsidian/ci/BUILD.bazel b/obsidian/cmd/v1/obsidian/ci/BUILD.bazel index 687423fd..bd8ca516 100644 --- a/obsidian/cmd/v1/obsidian/ci/BUILD.bazel +++ b/obsidian/cmd/v1/obsidian/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -14,6 +14,6 @@ container( peridot_k8s( name = "obsidian", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = ["//ci"], ) diff --git a/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet b/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet index 01007d5f..47503d35 100644 --- a/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet +++ b/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet @@ -1,8 +1,8 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'obsidian', dbname: 'obsidian', backend: true, diff --git a/obsidian/impl/v1/oauth2.go b/obsidian/impl/v1/oauth2.go index 9d2bc0bc..d36b62b5 100644 --- a/obsidian/impl/v1/oauth2.go +++ b/obsidian/impl/v1/oauth2.go @@ -34,6 +34,8 @@ import ( "context" "database/sql" "fmt" + "os" + "github.com/coreos/go-oidc/v3/oidc" "github.com/ory/hydra-client-go/client/admin" hydramodels "github.com/ory/hydra-client-go/models" @@ -43,7 +45,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "os" "peridot.resf.org/obsidian/db/models" obsidianpb "peridot.resf.org/obsidian/pb" "peridot.resf.org/utils" @@ -57,7 +58,7 @@ type NameClaim struct { } func callbackForwarder(callbackURL string) string { - env := os.Getenv("BYC_ENV") + env := os.Getenv("RESF_ENV") // this section contained a callback forwarder, but cannot be published // todo(mustafa): evaluate other ways to make it easier for dev if env == "dev" || env == "" { diff --git a/obsidian/migrate/BUILD.bazel b/obsidian/migrate/BUILD.bazel index 191ec3b7..a1cb11f6 100644 --- a/obsidian/migrate/BUILD.bazel +++ b/obsidian/migrate/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "migration_tar") +load("//rules_resf:defs.bzl", "migration_tar") package(default_visibility = ["//visibility:public"]) diff --git a/obsidian/ui/BUILD b/obsidian/ui/BUILD index f8ff1753..be0b9d19 100644 --- a/obsidian/ui/BUILD +++ b/obsidian/ui/BUILD @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_BASE", "byc_frontend", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_BASE", "container", "peridot_k8s", "resf_frontend") package(default_visibility = ["//visibility:public"]) @@ -10,14 +10,14 @@ server_entrypoint = "server/index.mjs" server_srcs = glob(["server/**/*.mjs"]) -byc_frontend( +resf_frontend( name = "obsidian", srcs = glob([ "src/**/*.tsx", "src/**/*.ts", ]), entrypoint = "obsidian/ui/src/entrypoint.tsx", - index_html = "//rules_byc/internal/byc_bundle:index_no_mobile.hbs", + index_html = "//rules_resf/internal/resf_bundle:index_no_mobile.hbs", server_deps = server_deps, server_entrypoint = server_entrypoint, server_srcs = server_srcs, @@ -30,6 +30,8 @@ byc_frontend( "//tailwind:css", "@npm//@mui/icons-material", "@npm//@mui/material", + "@npm//@mui/styles", + "@npm//@mui/system", "@npm//await-to-js", "@npm//react-router", "@npm//react-router-dom", @@ -51,6 +53,6 @@ container( peridot_k8s( name = "obsidian-frontend", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_BASE, + outs = RESFDEPLOY_OUTS_BASE, deps = ["//ci"], ) diff --git a/obsidian/ui/deploy.jsonnet b/obsidian/ui/deploy.jsonnet index 2842d516..c9afb7f7 100644 --- a/obsidian/ui/deploy.jsonnet +++ b/obsidian/ui/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local frontend = import 'ci/frontend.jsonnet'; local tag = std.extVar('tag'); -bycdeploy.new({ +RESFDEPLOY.new({ name: 'obsidian-frontend', backend: false, migrate: false, @@ -22,4 +22,4 @@ bycdeploy.new({ health: { port: 8086, }, -}) \ No newline at end of file +}) diff --git a/obsidian/ui/server/index.mjs b/obsidian/ui/server/index.mjs index 20ca6e20..f88212f8 100644 --- a/obsidian/ui/server/index.mjs +++ b/obsidian/ui/server/index.mjs @@ -33,12 +33,16 @@ // noinspection ES6PreferShortImport import server from '../../../common/frontend_server/index.mjs'; -import { endpointHttp, NS, svcNameHttp } from '../../../common/frontend_server/upstream.mjs'; +import { + endpointHttp, + NS, + svcNameHttp, +} from '../../../common/frontend_server/upstream.mjs'; export default async function run(webpackConfig) { const devFrontendUrl = 'http://obsidian.pdot.localhost:16000'; const envPublicUrl = process.env['OBSIDIAN_FRONTEND_HTTP_PUBLIC_URL']; - const frontendUrl = process.env['BYC_NS'] ? envPublicUrl : devFrontendUrl; + const frontendUrl = process.env['RESF_NS'] ? envPublicUrl : devFrontendUrl; server({ disableAuth: true, @@ -46,11 +50,11 @@ export default async function run(webpackConfig) { apis: { '/api': { prodApiUrl: endpointHttp(svcNameHttp('obsidian'), NS('obsidian')), - devApiUrl: `https://id-api-dev.internal.pdev.resf.localhost` - } + devApiUrl: `https://id-api-dev.internal.pdev.resf.localhost`, + }, }, port: 16000, - webpackConfig + webpackConfig, }).then(); } diff --git a/peridot/builder/v1/workflow/infrastructure.go b/peridot/builder/v1/workflow/infrastructure.go index 4691ead8..4b210125 100644 --- a/peridot/builder/v1/workflow/infrastructure.go +++ b/peridot/builder/v1/workflow/infrastructure.go @@ -36,6 +36,12 @@ import ( "database/sql" "errors" "fmt" + "math/rand" + "os" + "runtime" + "strings" + "time" + "github.com/sirupsen/logrus" "github.com/spf13/viper" "go.temporal.io/api/enums/v1" @@ -49,14 +55,9 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" - "math/rand" - "os" "peridot.resf.org/peridot/db/models" peridotpb "peridot.resf.org/peridot/pb" "peridot.resf.org/utils" - "runtime" - "strings" - "time" ) type ProvisionWorkerRequest struct { @@ -583,7 +584,7 @@ func (c *Controller) CreateK8sPodActivity(ctx context.Context, req *ProvisionWor }, }, Spec: v1.PodSpec{ - ServiceAccountName: os.Getenv("BYC_SERVICE_ACCOUNT"), + ServiceAccountName: os.Getenv("RESF_SERVICE_ACCOUNT"), ImagePullSecrets: imagePullSecrets, Containers: []v1.Container{ { @@ -592,16 +593,16 @@ func (c *Controller) CreateK8sPodActivity(ctx context.Context, req *ProvisionWor Args: []string{command}, Env: []v1.EnvVar{ { - Name: "BYC_ENV", - Value: os.Getenv("BYC_ENV"), + Name: "RESF_ENV", + Value: os.Getenv("RESF_ENV"), }, { - Name: "BYC_NS", - Value: os.Getenv("BYC_NS"), + Name: "RESF_NS", + Value: os.Getenv("RESF_NS"), }, { - Name: "BYC_FORCE_NS", - Value: os.Getenv("BYC_FORCE_NS"), + Name: "RESF_FORCE_NS", + Value: os.Getenv("RESF_FORCE_NS"), }, { Name: "LOCALSTACK_ENDPOINT", diff --git a/peridot/cmd/v1/keykeeper/ci/BUILD.bazel b/peridot/cmd/v1/keykeeper/ci/BUILD.bazel index 3e879f4e..b4c44bee 100644 --- a/peridot/cmd/v1/keykeeper/ci/BUILD.bazel +++ b/peridot/cmd/v1/keykeeper/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/build", @@ -11,6 +11,6 @@ container( peridot_k8s( name = "keykeeper", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = ["//ci"], ) diff --git a/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet b/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet index 67a88d30..0b2e9575 100644 --- a/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet +++ b/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'keykeeper', replicas: if kubernetes.prod() then 3 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/peridotbuilder/ci/BUILD.bazel b/peridot/cmd/v1/peridotbuilder/ci/BUILD.bazel index 3e7fe91c..6e47d929 100644 --- a/peridot/cmd/v1/peridotbuilder/ci/BUILD.bazel +++ b/peridot/cmd/v1/peridotbuilder/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_CUSTOM", "container") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_CUSTOM", "container") container( architecture = "amd64", diff --git a/peridot/cmd/v1/peridotephemeral/ci/BUILD.bazel b/peridot/cmd/v1/peridotephemeral/ci/BUILD.bazel index a53b285e..e8d31441 100644 --- a/peridot/cmd/v1/peridotephemeral/ci/BUILD.bazel +++ b/peridot/cmd/v1/peridotephemeral/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE_CUSTOM", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE_CUSTOM", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -11,7 +11,7 @@ container( peridot_k8s( name = "peridotephemeral", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE_CUSTOM, + outs = RESFDEPLOY_OUTS_MIGRATE_CUSTOM, dependent_push = select({ "//platforms:x86_64": [ "//peridot/cmd/v1/peridotbuilder/ci:peridotbuilder_amd64_container", diff --git a/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet b/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet index 7f6ef012..19a84da8 100644 --- a/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet +++ b/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet @@ -1,4 +1,4 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; @@ -14,7 +14,7 @@ local provisionWorkerRole(metadata) = kubernetes.define_role_v2(metadata, 'provi } ]); -bycdeploy.new({ +RESFDEPLOY.new({ name: 'peridotephemeral', replicas: if kubernetes.prod() then if site == 'extarches' then 5 else 10 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/peridotserver/ci/BUILD.bazel b/peridot/cmd/v1/peridotserver/ci/BUILD.bazel index 1a00eedd..da72a44c 100644 --- a/peridot/cmd/v1/peridotserver/ci/BUILD.bazel +++ b/peridot/cmd/v1/peridotserver/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -14,6 +14,6 @@ container( peridot_k8s( name = "peridotserver", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = ["//ci"], ) diff --git a/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet b/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet index 6ac96754..8bcf5a1e 100644 --- a/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet +++ b/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'peridotserver', replicas: if kubernetes.prod() then 5 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/yumrepofs/ci/BUILD.bazel b/peridot/cmd/v1/yumrepofs/ci/BUILD.bazel index c88d6198..bb2938dc 100644 --- a/peridot/cmd/v1/yumrepofs/ci/BUILD.bazel +++ b/peridot/cmd/v1/yumrepofs/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -11,6 +11,6 @@ container( peridot_k8s( name = "yumrepofs", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = ["//ci"], ) diff --git a/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet b/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet index 64dbc7fc..443b0e00 100644 --- a/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet +++ b/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet @@ -1,9 +1,9 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local utils = import 'ci/utils.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'yumrepofs', replicas: if kubernetes.prod() then 3 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/yumrepofsupdater/ci/BUILD.bazel b/peridot/cmd/v1/yumrepofsupdater/ci/BUILD.bazel index 5ea32e0d..9034f05a 100644 --- a/peridot/cmd/v1/yumrepofsupdater/ci/BUILD.bazel +++ b/peridot/cmd/v1/yumrepofsupdater/ci/BUILD.bazel @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "container", "peridot_k8s") container( base = "//bases/bazel/go", @@ -11,6 +11,6 @@ container( peridot_k8s( name = "yumrepofsupdater", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, deps = ["//ci"], ) diff --git a/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet b/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet index e67a73e7..f4f2b140 100644 --- a/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet +++ b/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'yumrepofsupdater', replicas: if kubernetes.prod() then 4 else 1, dbname: 'peridot', diff --git a/peridot/migrate/BUILD b/peridot/migrate/BUILD index 191ec3b7..a1cb11f6 100644 --- a/peridot/migrate/BUILD +++ b/peridot/migrate/BUILD @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "migration_tar") +load("//rules_resf:defs.bzl", "migration_tar") package(default_visibility = ["//visibility:public"]) diff --git a/peridot/ui/BUILD b/peridot/ui/BUILD index c5ed9125..81c8a3c3 100644 --- a/peridot/ui/BUILD +++ b/peridot/ui/BUILD @@ -1,4 +1,4 @@ -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_BASE", "byc_frontend", "container", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_BASE", "container", "peridot_k8s", "resf_frontend") package(default_visibility = ["//visibility:public"]) @@ -11,14 +11,14 @@ server_entrypoint = "server/index.mjs" server_srcs = glob(["server/**/*.mjs"]) -byc_frontend( +resf_frontend( name = "peridot", srcs = glob([ "src/**/*.tsx", "src/**/*.ts", ]), entrypoint = "peridot/ui/src/entrypoint.tsx", - index_html = "//rules_byc/internal/byc_bundle:index_no_mobile.hbs", + index_html = "//rules_resf/internal/resf_bundle:index_no_mobile.hbs", server_deps = server_deps, server_entrypoint = server_entrypoint, server_srcs = server_srcs, @@ -54,6 +54,6 @@ container( peridot_k8s( name = "peridot-frontend", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_BASE, + outs = RESFDEPLOY_OUTS_BASE, deps = ["//ci"], ) diff --git a/peridot/ui/deploy.jsonnet b/peridot/ui/deploy.jsonnet index 5d00e633..60e20ab8 100644 --- a/peridot/ui/deploy.jsonnet +++ b/peridot/ui/deploy.jsonnet @@ -1,10 +1,10 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local frontend = import 'ci/frontend.jsonnet'; local tag = std.extVar('tag'); -bycdeploy.new({ +RESFDEPLOY.new({ name: 'peridot-frontend', backend: false, migrate: false, @@ -22,4 +22,4 @@ bycdeploy.new({ health: { port: 8086, }, -}) \ No newline at end of file +}) diff --git a/peridot/ui/server/index.mjs b/peridot/ui/server/index.mjs index d9f5a937..f85fa38f 100644 --- a/peridot/ui/server/index.mjs +++ b/peridot/ui/server/index.mjs @@ -33,13 +33,20 @@ // noinspection ES6PreferShortImport import server from '../../../common/frontend_server/index.mjs'; -import { svcNameHttp, endpointHttp, NS } from '../../../common/frontend_server/upstream.mjs'; -import { hydraAutoSignup, hydraPublic } from '../../../hydra/pkg/hydra/autosignup.mjs'; +import { + svcNameHttp, + endpointHttp, + NS, +} from '../../../common/frontend_server/upstream.mjs'; +import { + hydraAutoSignup, + hydraPublic, +} from '../../../hydra/pkg/hydra/autosignup.mjs'; export default async function run(webpackConfig) { const devFrontendUrl = 'http://peridot.pdot.localhost:15000'; const envPublicUrl = process.env['PERIDOT_FRONTEND_HTTP_PUBLIC_URL']; - const frontendUrl = process.env['BYC_NS'] ? envPublicUrl : devFrontendUrl; + const frontendUrl = process.env['RESF_NS'] ? envPublicUrl : devFrontendUrl; const wellKnown = await hydraPublic.discoverOpenIDConfiguration(); const hdr = await hydraAutoSignup({ @@ -49,7 +56,7 @@ export default async function run(webpackConfig) { frontend: true, scopes: 'openid profile email offline_access', redirectUri: `${frontendUrl}/oauth2/callback`, - postLogoutRedirectUri: frontendUrl + postLogoutRedirectUri: frontendUrl, }); server({ @@ -59,13 +66,16 @@ export default async function run(webpackConfig) { baseURL: frontendUrl, apis: { '/api': { - prodApiUrl: endpointHttp(svcNameHttp('peridotserver'), NS('peridotserver')), - devApiUrl: `https://peridot-api-dev.internal.pdev.resf.localhost` - } + prodApiUrl: endpointHttp( + svcNameHttp('peridotserver'), + NS('peridotserver') + ), + devApiUrl: `https://peridot-api-dev.internal.pdev.resf.localhost`, + }, }, port: 15000, disableAuthEnforce: true, - webpackConfig + webpackConfig, }).then(); } diff --git a/publisher/cmd/publisher-legacy-errata/BUILD.bazel b/publisher/cmd/publisher-legacy-errata/BUILD.bazel index 3794bb34..b9ca84d2 100644 --- a/publisher/cmd/publisher-legacy-errata/BUILD.bazel +++ b/publisher/cmd/publisher-legacy-errata/BUILD.bazel @@ -1,5 +1,5 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") -load("//rules_byc:defs.bzl", "container") +load("//rules_resf:defs.bzl", "container") go_library( name = "publisher-legacy-errata_lib", diff --git a/rules_byc/internal/container/BUILD b/rules_byc/internal/container/BUILD deleted file mode 100644 index 986fd5c7..00000000 --- a/rules_byc/internal/container/BUILD +++ /dev/null @@ -1,3 +0,0 @@ -package(default_visibility = ["//rules_byc/internal:__subpackages__"]) - -exports_files(["container.bzl"]) diff --git a/rules_byc/internal/k8s/BUILD b/rules_byc/internal/k8s/BUILD deleted file mode 100644 index 79f88a2a..00000000 --- a/rules_byc/internal/k8s/BUILD +++ /dev/null @@ -1,6 +0,0 @@ -package(default_visibility = ["//rules_byc/internal:__subpackages__"]) - -exports_files([ - "k8s.bzl", - "k8s.bash", -]) diff --git a/rules_byc/BUILD b/rules_resf/BUILD similarity index 100% rename from rules_byc/BUILD rename to rules_resf/BUILD diff --git a/rules_byc/defs.bzl b/rules_resf/defs.bzl similarity index 82% rename from rules_byc/defs.bzl rename to rules_resf/defs.bzl index f5f320f0..af379c80 100644 --- a/rules_byc/defs.bzl +++ b/rules_resf/defs.bzl @@ -1,30 +1,30 @@ -load("//rules_byc/internal/byc_bundle:byc_bundle.bzl", _byc_bundle = "byc_bundle", _byc_bundle_run = "byc_bundle_run") -load("//rules_byc/internal/k8s:k8s.bzl", _k8s_apply = "k8s_apply") -load("//rules_byc/internal/container:container.bzl", _container = "container", _migration_tar = "migration_tar") +load("//rules_resf/internal/resf_bundle:resf_bundle.bzl", _resf_bundle = "resf_bundle", _resf_bundle_run = "resf_bundle_run") +load("//rules_resf/internal/k8s:k8s.bzl", _k8s_apply = "k8s_apply") +load("//rules_resf/internal/container:container.bzl", _container = "container", _migration_tar = "migration_tar") load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_to_json") load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") load("@com_github_atlassian_bazel_tools//:multirun/def.bzl", "multirun") -byc_bundle = _byc_bundle +resf_bundle = _resf_bundle k8s_apply = _k8s_apply container = _container migration_tar = _migration_tar -BYCDEPLOY_OUTS_BASE = [ +RESFDEPLOY_OUTS_BASE = [ "001-ns-sa.yaml", "003-deployment.yaml", "004-svc-vs-dr.yaml", ] -BYCDEPLOY_OUTS_MIGRATE = BYCDEPLOY_OUTS_BASE + [ +RESFDEPLOY_OUTS_MIGRATE = RESFDEPLOY_OUTS_BASE + [ "002-migrate.yaml", ] -BYCDEPLOY_OUTS_CUSTOM = BYCDEPLOY_OUTS_BASE + [ +RESFDEPLOY_OUTS_CUSTOM = RESFDEPLOY_OUTS_BASE + [ "005-custom.yaml", ] -BYCDEPLOY_OUTS_MIGRATE_CUSTOM = BYCDEPLOY_OUTS_BASE + [ +RESFDEPLOY_OUTS_MIGRATE_CUSTOM = RESFDEPLOY_OUTS_BASE + [ "002-migrate.yaml", "005-custom.yaml", ] @@ -104,23 +104,23 @@ def peridot_k8s(name, src, tags = [], outs = [], static = False, prod_only = Fal tags = ["manual"], ) -def byc_frontend(name, tags = [], **kwargs): - _byc_bundle( +def resf_frontend(name, tags = [], **kwargs): + _resf_bundle( name = "{}.bundle".format(name), build = True, tags = tags + [ "manual", - "byc_frontend_bundle", + "resf_frontend_bundle", ], **kwargs ) - _byc_bundle_run( + _resf_bundle_run( name = "{}.server".format(name), build = False, tags = tags + [ "manual", - "byc_frontend_server", + "resf_frontend_server", "ibazel_notify_changes", "ibazel_live_reload", ], diff --git a/rules_byc/internal/BUILD b/rules_resf/internal/BUILD similarity index 100% rename from rules_byc/internal/BUILD rename to rules_resf/internal/BUILD diff --git a/rules_resf/internal/container/BUILD b/rules_resf/internal/container/BUILD new file mode 100644 index 00000000..fe773298 --- /dev/null +++ b/rules_resf/internal/container/BUILD @@ -0,0 +1,3 @@ +package(default_visibility = ["//rules_resf/internal:__subpackages__"]) + +exports_files(["container.bzl"]) diff --git a/rules_byc/internal/container/container.bzl b/rules_resf/internal/container/container.bzl similarity index 100% rename from rules_byc/internal/container/container.bzl rename to rules_resf/internal/container/container.bzl diff --git a/rules_resf/internal/k8s/BUILD b/rules_resf/internal/k8s/BUILD new file mode 100644 index 00000000..5d3eabb5 --- /dev/null +++ b/rules_resf/internal/k8s/BUILD @@ -0,0 +1,6 @@ +package(default_visibility = ["//rules_resf/internal:__subpackages__"]) + +exports_files([ + "k8s.bzl", + "k8s.bash", +]) diff --git a/rules_byc/internal/k8s/k8s.bash b/rules_resf/internal/k8s/k8s.bash similarity index 100% rename from rules_byc/internal/k8s/k8s.bash rename to rules_resf/internal/k8s/k8s.bash diff --git a/rules_byc/internal/k8s/k8s.bzl b/rules_resf/internal/k8s/k8s.bzl similarity index 96% rename from rules_byc/internal/k8s/k8s.bzl rename to rules_resf/internal/k8s/k8s.bzl index 174494ae..1f6a4630 100644 --- a/rules_byc/internal/k8s/k8s.bzl +++ b/rules_resf/internal/k8s/k8s.bzl @@ -59,7 +59,7 @@ k8s_apply = rule( default = Label("@bazel_tools//tools/bash/runfiles"), ), "_k8s_bash": attr.label( - default = Label("//rules_byc/internal/k8s:k8s.bash"), + default = Label("//rules_resf/internal/k8s:k8s.bash"), allow_single_file = True, ), }, diff --git a/rules_byc/internal/byc_bundle/BUILD b/rules_resf/internal/resf_bundle/BUILD similarity index 89% rename from rules_byc/internal/byc_bundle/BUILD rename to rules_resf/internal/resf_bundle/BUILD index 426d526d..68d56da9 100644 --- a/rules_byc/internal/byc_bundle/BUILD +++ b/rules_resf/internal/resf_bundle/BUILD @@ -1,7 +1,7 @@ -package(default_visibility = ["//rules_byc/internal:__subpackages__"]) +package(default_visibility = ["//rules_resf/internal:__subpackages__"]) load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") -load(":byc_bundle.bzl", "WEBPACK_DATA") +load(":resf_bundle.bzl", "WEBPACK_DATA") exports_files([ "assembler.js", @@ -15,7 +15,7 @@ exports_files([ "index.hbs", "index_no_mobile.hbs", "index_internal.hbs", - "byc_bundle.bzl", + "resf_bundle.bzl", "run_child.mjs", "packserver.bash", ]) diff --git a/rules_byc/internal/byc_bundle/babel.config.js b/rules_resf/internal/resf_bundle/babel.config.js similarity index 100% rename from rules_byc/internal/byc_bundle/babel.config.js rename to rules_resf/internal/resf_bundle/babel.config.js diff --git a/rules_byc/internal/byc_bundle/index.hbs b/rules_resf/internal/resf_bundle/index.hbs similarity index 100% rename from rules_byc/internal/byc_bundle/index.hbs rename to rules_resf/internal/resf_bundle/index.hbs diff --git a/rules_byc/internal/byc_bundle/index_internal.hbs b/rules_resf/internal/resf_bundle/index_internal.hbs similarity index 100% rename from rules_byc/internal/byc_bundle/index_internal.hbs rename to rules_resf/internal/resf_bundle/index_internal.hbs diff --git a/rules_byc/internal/byc_bundle/index_no_mobile.hbs b/rules_resf/internal/resf_bundle/index_no_mobile.hbs similarity index 100% rename from rules_byc/internal/byc_bundle/index_no_mobile.hbs rename to rules_resf/internal/resf_bundle/index_no_mobile.hbs diff --git a/rules_byc/internal/byc_bundle/packserver.bash b/rules_resf/internal/resf_bundle/packserver.bash similarity index 100% rename from rules_byc/internal/byc_bundle/packserver.bash rename to rules_resf/internal/resf_bundle/packserver.bash diff --git a/rules_byc/internal/byc_bundle/byc_bundle.bzl b/rules_resf/internal/resf_bundle/resf_bundle.bzl similarity index 91% rename from rules_byc/internal/byc_bundle/byc_bundle.bzl rename to rules_resf/internal/resf_bundle/resf_bundle.bzl index 3ef2a193..219a4758 100644 --- a/rules_byc/internal/byc_bundle/byc_bundle.bzl +++ b/rules_resf/internal/resf_bundle/resf_bundle.bzl @@ -109,11 +109,6 @@ def get_inputs(ctx, config, dep_files_attr, dep_attr, index_html = None, extra = if ctx.file.license_banner: direct_inputs += [ctx.file.license_banner] - if ctx.version_file: - direct_inputs += [ctx.version_file] - - if ctx.info_file: - direct_inputs += [ctx.info_file] return direct_inputs @@ -209,8 +204,6 @@ def write_webpack_config(ctx, plugins = [], root_dir = None, filename = "_%s.web "TMPL_module_mappings": str(mappings), "TMPL_output_format": output_format, "TMPL_indexHtml": index_html.short_path if index_html != None else "null", - "TMPL_stamp_data": "\"%s\"" % ctx.version_file.path if ctx.version_file else "undefined", - "TMPL_stable_stamp_data": "\"%s\"" % ctx.info_file.path if ctx.info_file else "undefined", "TMPL_target": str(ctx.label), "TMPL_title": ctx.attr.title if ctx.attr.title else "Peridot", "TMPL_body_script": ctx.attr.script, @@ -272,7 +265,7 @@ def packserver(ctx, webpack_config, webpack_inputs): executable = out_file, )] -def _byc_bundle(ctx): +def _resf_bundle(ctx): index_html = ctx.file.index_html config = write_webpack_config(ctx, index_html = index_html) webpack_config = config["webpack"] @@ -298,10 +291,10 @@ def _byc_bundle(ctx): return packserver(ctx, webpack_config, direct_inputs) WEBPACK_DATA = [ - "//rules_byc/internal/byc_bundle:babel.config.js", - "//rules_byc/internal/byc_bundle:tailwind.config.js", - "//rules_byc/internal/byc_bundle:index.hbs", - "//rules_byc/internal/byc_bundle:tsconfig.json", + "//rules_resf/internal/resf_bundle:babel.config.js", + "//rules_resf/internal/resf_bundle:tailwind.config.js", + "//rules_resf/internal/resf_bundle:index.hbs", + "//rules_resf/internal/resf_bundle:tsconfig.json", "@npm//@babel/plugin-transform-modules-commonjs", "@npm//@babel/preset-env", "@npm//@babel/preset-react", @@ -338,7 +331,7 @@ WEBPACK_DATA = [ "@npm//core-js-pure", ] -BYC_BUNDLE_ATTRS = { +resf_bundle_ATTRS = { "title": attr.string(), "script": attr.string( default = "", @@ -351,7 +344,7 @@ BYC_BUNDLE_ATTRS = { default = "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap", ), "index_html": attr.label( - default = Label("//rules_byc/internal/byc_bundle:index.hbs"), + default = Label("//rules_resf/internal/resf_bundle:index.hbs"), allow_single_file = True, ), "prefix": attr.string( @@ -390,11 +383,11 @@ BYC_BUNDLE_ATTRS = { aspects = [module_mappings_aspect, node_modules_aspect], ), "_webpack_config_tmpl": attr.label( - default = Label("//rules_byc/internal/byc_bundle:webpack.config.js"), + default = Label("//rules_resf/internal/resf_bundle:webpack.config.js"), allow_single_file = True, ), "_webpack": attr.label( - default = Label("//rules_byc/internal/byc_bundle:webpack"), + default = Label("//rules_resf/internal/resf_bundle:webpack"), executable = True, cfg = "host", allow_files = True, @@ -414,21 +407,21 @@ BYC_BUNDLE_ATTRS = { allow_files = True, ), "_run_child": attr.label( - default = Label("//rules_byc/internal/byc_bundle:run_child"), + default = Label("//rules_resf/internal/resf_bundle:run_child"), executable = True, cfg = "host", allow_files = True, ), "_run_child_script": attr.label( - default = Label("//rules_byc/internal/byc_bundle:run_child.mjs"), + default = Label("//rules_resf/internal/resf_bundle:run_child.mjs"), allow_single_file = True, ), "_packserver": attr.label( - default = Label("//rules_byc/internal/byc_bundle:packserver.bash"), + default = Label("//rules_resf/internal/resf_bundle:packserver.bash"), allow_single_file = True, ), "_tsconfig": attr.label( - default = Label("//rules_byc/internal/byc_bundle:tsconfig.json"), + default = Label("//rules_resf/internal/resf_bundle:tsconfig.json"), allow_single_file = True, ), "entrypoint": attr.string( @@ -438,15 +431,15 @@ BYC_BUNDLE_ATTRS = { mandatory = False, ), "_babel_config": attr.label( - default = Label("//rules_byc/internal/byc_bundle:babel.config.js"), + default = Label("//rules_resf/internal/resf_bundle:babel.config.js"), allow_single_file = True, ), "tailwind_config": attr.label( - default = Label("//rules_byc/internal/byc_bundle:tailwind.config.js"), + default = Label("//rules_resf/internal/resf_bundle:tailwind.config.js"), allow_single_file = True, ), "_base_tailwind_config": attr.label( - default = Label("//rules_byc/internal/byc_bundle:tailwind.config.js"), + default = Label("//rules_resf/internal/resf_bundle:tailwind.config.js"), allow_single_file = True, ), "_bash_runfiles": attr.label( @@ -457,13 +450,13 @@ BYC_BUNDLE_ATTRS = { ), } -byc_bundle = rule( - implementation = _byc_bundle, - attrs = BYC_BUNDLE_ATTRS, +resf_bundle = rule( + implementation = _resf_bundle, + attrs = resf_bundle_ATTRS, ) -byc_bundle_run = rule( - implementation = _byc_bundle, - attrs = BYC_BUNDLE_ATTRS, +resf_bundle_run = rule( + implementation = _resf_bundle, + attrs = resf_bundle_ATTRS, executable = True, ) diff --git a/rules_byc/internal/byc_bundle/run_child.mjs b/rules_resf/internal/resf_bundle/run_child.mjs similarity index 100% rename from rules_byc/internal/byc_bundle/run_child.mjs rename to rules_resf/internal/resf_bundle/run_child.mjs diff --git a/rules_byc/internal/byc_bundle/tailwind.config.js b/rules_resf/internal/resf_bundle/tailwind.config.js similarity index 97% rename from rules_byc/internal/byc_bundle/tailwind.config.js rename to rules_resf/internal/resf_bundle/tailwind.config.js index 8b2642d3..c2d393e0 100644 --- a/rules_byc/internal/byc_bundle/tailwind.config.js +++ b/rules_resf/internal/resf_bundle/tailwind.config.js @@ -73,9 +73,9 @@ module.exports = { mode: 'jit', purge: [ path.join(projectPath, '**/*.{jsx,tsx,vue}'), - path.join(projectPath, '../rules_byc/internal/byc_bundle/*.hbs'), + path.join(projectPath, '../rules_resf/internal/resf_bundle/*.hbs'), path.resolve(path.join('.', projectDir, '**/*.{jsx,tsx,vue}')), - path.resolve('./rules_byc/internal/byc_bundle/*.hbs'), + path.resolve('./rules_resf/internal/resf_bundle/*.hbs'), ], plugins: [require('@tailwindcss/forms')], theme: { diff --git a/rules_byc/internal/byc_bundle/tailwind.config.nopreflight.js b/rules_resf/internal/resf_bundle/tailwind.config.nopreflight.js similarity index 100% rename from rules_byc/internal/byc_bundle/tailwind.config.nopreflight.js rename to rules_resf/internal/resf_bundle/tailwind.config.nopreflight.js diff --git a/rules_byc/internal/byc_bundle/tsconfig.json b/rules_resf/internal/resf_bundle/tsconfig.json similarity index 100% rename from rules_byc/internal/byc_bundle/tsconfig.json rename to rules_resf/internal/resf_bundle/tsconfig.json diff --git a/rules_byc/internal/byc_bundle/webpack.config.js b/rules_resf/internal/resf_bundle/webpack.config.js similarity index 88% rename from rules_byc/internal/byc_bundle/webpack.config.js rename to rules_resf/internal/resf_bundle/webpack.config.js index fe3448e6..7561d85d 100644 --- a/rules_byc/internal/byc_bundle/webpack.config.js +++ b/rules_resf/internal/resf_bundle/webpack.config.js @@ -49,9 +49,6 @@ const resolve = path.resolve; // eslint-disable-line // Env variables const dev = process.env.NODE_ENV !== 'production'; -const bannerFile = TMPL_banner_file; -const stampData = TMPL_stamp_data; -const stableStampData = TMPL_stable_stamp_data; const title = 'TMPL_title'; const moduleMappings = TMPL_module_mappings; const rawName = 'TMPL_global_name'; @@ -64,7 +61,6 @@ const inputs = [TMPL_inputs]; const bodyScript = 'TMPL_body_script'; const headStyle = 'TMPL_head_style'; const typekit = 'TMPL_typekit'; -const noSuffixFrontend = TMPL_no_suffix_frontend; Object.keys(moduleMappings).forEach((k) => { moduleMappings[k] = resolve(process.cwd(), moduleMappings[k]); @@ -80,32 +76,8 @@ const modules = [ resolve(process.cwd()), ]; -const volatileStatus = {}; -if (!dev && stampData) { - const versionTag = fs.readFileSync(stampData, { encoding: 'utf-8' }); - const vsSplit = versionTag.split('\n'); - for (const vss of vsSplit) { - const vskp = vss.split(' '); - volatileStatus[vskp[0]] = vskp[1]; - } -} - -const stableStatus = {}; -if (!dev && stableStampData) { - const versionTag = fs.readFileSync(stableStampData, { encoding: 'utf-8' }); - const vsSplit = versionTag.split('\n'); - for (const vss of vsSplit) { - const vskp = vss.split(' '); - stableStatus[vskp[0]] = vskp[1]; - } -} - const fileName = `${name}.bundle${dev ? '' : '.min'}`; -const stage = stableStatus['STABLE_STAGE'] || '-qa'; -const stageNoDash = stage.replace(/^-/, ''); -const ns = `${rawName}${noSuffixFrontend ? '' : '-frontend'}`; - const apiUrl = process.env.API_URL; const apiKey = process.env.API_KEY; @@ -237,8 +209,6 @@ const webpackConfig = { 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), 'process.env.API_URL': JSON.stringify(apiUrl), 'process.env.API_KEY': JSON.stringify(apiKey), - 'process.env.BYC_ENV': JSON.stringify(stageNoDash), - 'process.env.STABLE_STAGE': JSON.stringify(stage), }), ...devPlugins, ...prodPlugins, @@ -254,7 +224,7 @@ const webpackConfig = { options: { configFile: resolve( process.cwd(), - 'rules_byc/internal/byc_bundle/babel.config.js' + 'rules_resf/internal/resf_bundle/babel.config.js' ), plugins: [dev && require.resolve('react-refresh/babel')].filter( Boolean diff --git a/servicecatalog/common.go b/servicecatalog/common.go index fc966a33..ac06abb2 100644 --- a/servicecatalog/common.go +++ b/servicecatalog/common.go @@ -37,7 +37,7 @@ import ( ) func SvcName(svc string, protocol string) string { - env := os.Getenv("BYC_ENV") + env := os.Getenv("RESF_ENV") return fmt.Sprintf("%s-%s-%s-service", svc, protocol, env) } @@ -50,7 +50,7 @@ func SvcNameGrpc(svc string) string { } func Endpoint(svcName string, ns string, port string) string { - if forceNs := os.Getenv("BYC_FORCE_NS"); forceNs != "" { + if forceNs := os.Getenv("RESF_FORCE_NS"); forceNs != "" { ns = forceNs } return fmt.Sprintf("%s.%s.svc.cluster.local%s", svcName, ns, port) @@ -62,8 +62,8 @@ func EndpointHttp(svcName string, ns string) string { } func NS(ns string) string { - if os.Getenv("BYC_ENV") == "dev" { - return os.Getenv("BYC_NS") + if os.Getenv("RESF_ENV") == "dev" { + return os.Getenv("RESF_NS") } return ns } diff --git a/spicedb/deploy/BUILD.bazel b/spicedb/deploy/BUILD.bazel index 46f47203..d6e827ad 100644 --- a/spicedb/deploy/BUILD.bazel +++ b/spicedb/deploy/BUILD.bazel @@ -1,5 +1,5 @@ load("@io_bazel_rules_jsonnet//jsonnet:jsonnet.bzl", "jsonnet_library") -load("//rules_byc:defs.bzl", "BYCDEPLOY_OUTS_MIGRATE", "peridot_k8s") +load("//rules_resf:defs.bzl", "RESFDEPLOY_OUTS_MIGRATE", "peridot_k8s") jsonnet_library( name = "common", @@ -11,7 +11,7 @@ jsonnet_library( peridot_k8s( name = "spicedb", src = "deploy.jsonnet", - outs = BYCDEPLOY_OUTS_MIGRATE, + outs = RESFDEPLOY_OUTS_MIGRATE, force_normal_tags = True, deps = [ ":common", diff --git a/spicedb/deploy/deploy.jsonnet b/spicedb/deploy/deploy.jsonnet index b74c28b2..342c08df 100644 --- a/spicedb/deploy/deploy.jsonnet +++ b/spicedb/deploy/deploy.jsonnet @@ -1,8 +1,8 @@ -local bycdeploy = import 'ci/bycdeploy.jsonnet'; +local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local common = import 'spicedb/deploy/common.jsonnet'; -bycdeploy.new({ +RESFDEPLOY.new({ name: 'spicedb', replicas: 1, dbname: 'spicedb', diff --git a/temporalutils/client.go b/temporalutils/client.go index ee57b066..c9db980a 100644 --- a/temporalutils/client.go +++ b/temporalutils/client.go @@ -33,6 +33,10 @@ package temporalutils import ( "context" "crypto/tls" + "os" + "strings" + "time" + "github.com/sirupsen/logrus" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -40,9 +44,6 @@ import ( "go.temporal.io/sdk/client" "google.golang.org/grpc" "google.golang.org/grpc/credentials" - "os" - "strings" - "time" ) func AddFlags(pflags *pflag.FlagSet) { @@ -70,7 +71,7 @@ func NewClient(opts client.Options) (client.Client, error) { opts.HostPort = temporalHostPort - bycNs := os.Getenv("BYC_NS") + bycNs := os.Getenv("RESF_NS") temporalNamespace := os.Getenv("TEMPORAL_NAMESPACE") if temporalNamespace != "" { bycNs = temporalNamespace diff --git a/utils/aws.go b/utils/aws.go index d2abe5a6..a5c2c51c 100644 --- a/utils/aws.go +++ b/utils/aws.go @@ -31,11 +31,12 @@ package utils import ( + "os" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/spf13/viper" - "os" ) func NewAwsSession(cfg *aws.Config) (*session.Session, error) { @@ -63,7 +64,7 @@ func NewAwsSession(cfg *aws.Config) (*session.Session, error) { cfg.Region = aws.String(os.Getenv("AWS_REGION")) } - if os.Getenv("LOCALSTACK_ENDPOINT") != "" && os.Getenv("BYC_ENV") == "dev" { + if os.Getenv("LOCALSTACK_ENDPOINT") != "" && os.Getenv("RESF_ENV") == "dev" { cfg.Endpoint = aws.String(os.Getenv("LOCALSTACK_ENDPOINT")) cfg.Credentials = credentials.NewStaticCredentials("test", "test", "") } diff --git a/utils/env.go b/utils/env.go index d7c40a8f..7cd47c08 100644 --- a/utils/env.go +++ b/utils/env.go @@ -34,5 +34,5 @@ import "os" // GetKubeNS only works when the apps run in Kubernetes func GetKubeNS() string { - return os.Getenv("BYC_NS") + return os.Getenv("RESF_NS") } diff --git a/utils/flags.go b/utils/flags.go index abeda2db..4ddccbb6 100644 --- a/utils/flags.go +++ b/utils/flags.go @@ -35,11 +35,12 @@ import ( "math/rand" "net/url" "os" - "peridot.resf.org/servicecatalog" "strconv" "strings" "time" + "peridot.resf.org/servicecatalog" + "github.com/sirupsen/logrus" "github.com/spf13/pflag" "github.com/spf13/viper" @@ -93,10 +94,10 @@ func AddFlags(f *pflag.FlagSet, config *FlagConfig) { issuer := "https://hdr.build.resf.org/" jwks := fmt.Sprintf("%s/.well-known/jwks.json", servicecatalog.HydraPublic()) - if os.Getenv("BYC_ENV") == "" || (os.Getenv("BYC_ENV") == "dev" && os.Getenv("LOCALSTACK_ENDPOINT") != "") { + if os.Getenv("RESF_ENV") == "" || (os.Getenv("RESF_ENV") == "dev" && os.Getenv("LOCALSTACK_ENDPOINT") != "") { issuer = "https://hdr-dev.internal.pdev.resf.localhost/" - } else if os.Getenv("BYC_ENV") != "prod" { - issuer = fmt.Sprintf("https://hdr-%s.internal.build.resf.org/", os.Getenv("BYC_ENV")) + } else if os.Getenv("RESF_ENV") != "prod" { + issuer = fmt.Sprintf("https://hdr-%s.internal.build.resf.org/", os.Getenv("RESF_ENV")) } f.String("oidc.issuer", issuer, "OpenID Connect Issuer for the authentication interceptor") From d2034e7c44fca34c8d0220fcee5fc1e212f58716 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sun, 30 Oct 2022 09:07:41 +0100 Subject: [PATCH 2/5] Upgrade gazelle --- WORKSPACE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 94880a75..a3181afe 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -40,10 +40,10 @@ http_archive( http_archive( name = "bazel_gazelle", - sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb", + sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", ], ) From bd03ada0d5c6a6b95c5894f0dff3c9de236ff941 Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sun, 30 Oct 2022 09:18:01 +0100 Subject: [PATCH 3/5] Fix references to resfdeploy --- apollo/cmd/apollo/ci/deploy.jsonnet | 4 ++-- apollo/cmd/apollostarter/ci/deploy.jsonnet | 4 ++-- apollo/cmd/apolloworker/ci/deploy.jsonnet | 4 ++-- apollo/ui/deploy.jsonnet | 4 ++-- ci/{bycdeploy.jsonnet => resfdeploy.jsonnet} | 0 hydra/deploy/admin/deploy.jsonnet | 4 ++-- hydra/deploy/public/deploy.jsonnet | 4 ++-- obsidian/cmd/v1/obsidian/ci/deploy.jsonnet | 4 ++-- obsidian/ui/deploy.jsonnet | 4 ++-- peridot/cmd/v1/keykeeper/ci/deploy.jsonnet | 4 ++-- peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet | 4 ++-- peridot/cmd/v1/peridotserver/ci/deploy.jsonnet | 4 ++-- peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet | 4 ++-- peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet | 4 ++-- peridot/ui/deploy.jsonnet | 4 ++-- spicedb/deploy/deploy.jsonnet | 4 ++-- 16 files changed, 30 insertions(+), 30 deletions(-) rename ci/{bycdeploy.jsonnet => resfdeploy.jsonnet} (100%) diff --git a/apollo/cmd/apollo/ci/deploy.jsonnet b/apollo/cmd/apollo/ci/deploy.jsonnet index 0f72c301..a3a2b469 100644 --- a/apollo/cmd/apollo/ci/deploy.jsonnet +++ b/apollo/cmd/apollo/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'apollo', replicas: 1, dbname: 'apollo', diff --git a/apollo/cmd/apollostarter/ci/deploy.jsonnet b/apollo/cmd/apollostarter/ci/deploy.jsonnet index 795dfe2e..eb8ad810 100644 --- a/apollo/cmd/apollostarter/ci/deploy.jsonnet +++ b/apollo/cmd/apollostarter/ci/deploy.jsonnet @@ -1,4 +1,4 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; @@ -6,7 +6,7 @@ local utils = import 'ci/utils.jsonnet'; local site = std.extVar('site'); -RESFDEPLOY.new({ +resfdeploy.new({ name: 'apollostarter', replicas: 1, dbname: 'apollo', diff --git a/apollo/cmd/apolloworker/ci/deploy.jsonnet b/apollo/cmd/apolloworker/ci/deploy.jsonnet index 8d604bf3..3b882024 100644 --- a/apollo/cmd/apolloworker/ci/deploy.jsonnet +++ b/apollo/cmd/apolloworker/ci/deploy.jsonnet @@ -1,4 +1,4 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; @@ -6,7 +6,7 @@ local utils = import 'ci/utils.jsonnet'; local site = std.extVar('site'); -RESFDEPLOY.new({ +resfdeploy.new({ name: 'apolloworker', replicas: 1, dbname: 'apollo', diff --git a/apollo/ui/deploy.jsonnet b/apollo/ui/deploy.jsonnet index bd1b9768..9b9b8bbb 100644 --- a/apollo/ui/deploy.jsonnet +++ b/apollo/ui/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local frontend = import 'ci/frontend.jsonnet'; local tag = std.extVar('tag'); -RESFDEPLOY.new({ +resfdeploy.new({ name: 'apollo-frontend', backend: false, migrate: false, diff --git a/ci/bycdeploy.jsonnet b/ci/resfdeploy.jsonnet similarity index 100% rename from ci/bycdeploy.jsonnet rename to ci/resfdeploy.jsonnet diff --git a/hydra/deploy/admin/deploy.jsonnet b/hydra/deploy/admin/deploy.jsonnet index 4e1e29d1..fe9b66f9 100644 --- a/hydra/deploy/admin/deploy.jsonnet +++ b/hydra/deploy/admin/deploy.jsonnet @@ -1,9 +1,9 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local common = import 'hydra/deploy/common.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'hydra-admin', replicas: 1, dbname: 'hydra', diff --git a/hydra/deploy/public/deploy.jsonnet b/hydra/deploy/public/deploy.jsonnet index a6af07c0..761f3c94 100644 --- a/hydra/deploy/public/deploy.jsonnet +++ b/hydra/deploy/public/deploy.jsonnet @@ -1,9 +1,9 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local common = import 'hydra/deploy/common.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'hydra-public', replicas: 1, dbname: 'hydra', diff --git a/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet b/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet index 47503d35..8a8c353f 100644 --- a/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet +++ b/obsidian/cmd/v1/obsidian/ci/deploy.jsonnet @@ -1,8 +1,8 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'obsidian', dbname: 'obsidian', backend: true, diff --git a/obsidian/ui/deploy.jsonnet b/obsidian/ui/deploy.jsonnet index c9afb7f7..34925b51 100644 --- a/obsidian/ui/deploy.jsonnet +++ b/obsidian/ui/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local frontend = import 'ci/frontend.jsonnet'; local tag = std.extVar('tag'); -RESFDEPLOY.new({ +resfdeploy.new({ name: 'obsidian-frontend', backend: false, migrate: false, diff --git a/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet b/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet index 0b2e9575..91200dd9 100644 --- a/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet +++ b/peridot/cmd/v1/keykeeper/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'keykeeper', replicas: if kubernetes.prod() then 3 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet b/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet index 19a84da8..3bfb658a 100644 --- a/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet +++ b/peridot/cmd/v1/peridotephemeral/ci/deploy.jsonnet @@ -1,4 +1,4 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; @@ -14,7 +14,7 @@ local provisionWorkerRole(metadata) = kubernetes.define_role_v2(metadata, 'provi } ]); -RESFDEPLOY.new({ +resfdeploy.new({ name: 'peridotephemeral', replicas: if kubernetes.prod() then if site == 'extarches' then 5 else 10 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet b/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet index 8bcf5a1e..023382a9 100644 --- a/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet +++ b/peridot/cmd/v1/peridotserver/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'peridotserver', replicas: if kubernetes.prod() then 5 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet b/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet index 443b0e00..15f44396 100644 --- a/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet +++ b/peridot/cmd/v1/yumrepofs/ci/deploy.jsonnet @@ -1,9 +1,9 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local utils = import 'ci/utils.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'yumrepofs', replicas: if kubernetes.prod() then 3 else 1, dbname: 'peridot', diff --git a/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet b/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet index f4f2b140..ba0929a1 100644 --- a/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet +++ b/peridot/cmd/v1/yumrepofsupdater/ci/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local db = import 'ci/db.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local temporal = import 'ci/temporal.jsonnet'; local utils = import 'ci/utils.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'yumrepofsupdater', replicas: if kubernetes.prod() then 4 else 1, dbname: 'peridot', diff --git a/peridot/ui/deploy.jsonnet b/peridot/ui/deploy.jsonnet index 60e20ab8..e8f888cd 100644 --- a/peridot/ui/deploy.jsonnet +++ b/peridot/ui/deploy.jsonnet @@ -1,10 +1,10 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local frontend = import 'ci/frontend.jsonnet'; local tag = std.extVar('tag'); -RESFDEPLOY.new({ +resfdeploy.new({ name: 'peridot-frontend', backend: false, migrate: false, diff --git a/spicedb/deploy/deploy.jsonnet b/spicedb/deploy/deploy.jsonnet index 342c08df..53ffd8ac 100644 --- a/spicedb/deploy/deploy.jsonnet +++ b/spicedb/deploy/deploy.jsonnet @@ -1,8 +1,8 @@ -local RESFDEPLOY = import 'ci/RESFDEPLOY.jsonnet'; +local resfdeploy = import 'ci/resfdeploy.jsonnet'; local kubernetes = import 'ci/kubernetes.jsonnet'; local common = import 'spicedb/deploy/common.jsonnet'; -RESFDEPLOY.new({ +resfdeploy.new({ name: 'spicedb', replicas: 1, dbname: 'spicedb', From 5d5970f797ff9ea8a093d0e456bdba7c085b725f Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sun, 30 Oct 2022 09:27:01 +0100 Subject: [PATCH 4/5] Downgrade gazelle again and switch to bazel-diff --- BUILD.bazel | 6 ++++++ WORKSPACE | 36 +++++++++++++++--------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 8df9bee4..844e400c 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -29,6 +29,12 @@ gazelle( name = "gazelle", ) +java_binary( + name = "bazel-diff", + main_class = "com.bazel_diff.Main", + runtime_deps = ["@bazel_diff//jar"], +) + nogo( name = "nogo", config = "nogo.json", diff --git a/WORKSPACE b/WORKSPACE index a3181afe..c99b96fd 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,7 +3,7 @@ workspace( managed_directories = {"@npm": ["node_modules"]}, ) -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_jar") # --start python-- load("//wrksp:python_download.bzl", "python_download") @@ -40,10 +40,10 @@ http_archive( http_archive( name = "bazel_gazelle", - sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e", + sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", - "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz", ], ) @@ -100,23 +100,6 @@ go_repository( version = "v0.0.0-20210514164344-f6687ab2804c", ) -# --start target-determinator-- -http_archive( - name = "bazel_contrib_target_determinator", - sha256 = "1245f255cf5b857181adb7606a45a738ac4404278f33b3dc0ce0097ec70ccbb3", - strip_prefix = "target-determinator-61d25f5e13a4b2205b338531b929464e3ed5eb3d", - urls = ["https://github.com/bazel-contrib/target-determinator/archive/61d25f5e13a4b2205b338531b929464e3ed5eb3d.tar.gz"], -) - -load("@bazel_contrib_target_determinator//:third_party/go/deps.bzl", td_go_dependencies = "go_dependencies") - -td_go_dependencies() - -load("@bazel_contrib_target_determinator//:third_party/go/bazel_differ_deps.bzl", td_differ_go_dependencies = "go_dependencies") - -td_differ_go_dependencies() -# --end target-determinator-- - gazelle_dependencies() load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies") @@ -224,6 +207,17 @@ load("//wrksp:atlassian_deps.bzl", "atlassian_deps") atlassian_deps() # --end atlassian-- +# --start bazel-diff-- + +http_jar( + name = "bazel_diff", + sha256 = "59f2a614f90b4c2a6c83f1e6146d8722dfaac3a1d8f42734dcbb6ccf373a1cbd", + urls = [ + "https://github.com/Tinder/bazel-diff/releases/download/4.0.5/bazel-diff_deploy.jar", + ], +) +# --end bazel-diff-- + new_local_repository( name = "raw_ts_library", build_file = "//rules_raw_ts_library:BUILD", From dc186243239be9e921e16c6a595c3779bf37b8bc Mon Sep 17 00:00:00 2001 From: Mustafa Gezen Date: Sun, 30 Oct 2022 09:44:59 +0100 Subject: [PATCH 5/5] Add config to build impacted frontends --- config/jobs/presubmits.yaml | 18 ++++++++++++++++++ hack/build_impacted_frontend.sh | 16 ++++++++++++++++ hack/frontend_build.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100755 hack/build_impacted_frontend.sh create mode 100644 hack/frontend_build.sh diff --git a/config/jobs/presubmits.yaml b/config/jobs/presubmits.yaml index 0f59c7bf..9bff83ce 100644 --- a/config/jobs/presubmits.yaml +++ b/config/jobs/presubmits.yaml @@ -50,6 +50,24 @@ presubmits: command: - hack/non_manual_build.sh + - name: pull-peridot-build-impacted-frontend + branches: + - main + always_run: true + decorate: true + spec: + tolerations: + - key: peridot.rockylinux.org/workflow-tolerates-arch + operator: Equal + value: amd64 + effect: NoSchedule + nodeSelector: + peridot.rockylinux.org/workflow-tolerates-arch: amd64 + containers: + - image: quay.io/peridot/ci:v0.3.16 + command: + - hack/frontend_build.sh + - name: pull-peridot-gofmt-check branches: - main diff --git a/hack/build_impacted_frontend.sh b/hack/build_impacted_frontend.sh new file mode 100755 index 00000000..5da67b82 --- /dev/null +++ b/hack/build_impacted_frontend.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -o errexit + +source hack/bazel_setup.sh + +starting_query="attr(tags, 'resf_frontend_bundle'," + +for t in `cat impacted_targets`; do + starting_query="$starting_query $t union" +done + +starting_query=${starting_query%" union"} +starting_query="$starting_query)" + +$BAZEL_B $($BAZEL_QR "$starting_query") diff --git a/hack/frontend_build.sh b/hack/frontend_build.sh new file mode 100644 index 00000000..2dc41354 --- /dev/null +++ b/hack/frontend_build.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -o errexit + +source hack/bazel_setup.sh + +bazel_bin="$(which bazel)" +workspace_dir="$(pwd)" + +$BAZEL_B //:bazel-diff + +# Generate starting hashes +git checkout "$PULL_BASE_SHA" --quiet +bazel-bin/bazel-diff generate-hashes -w "$workspace_dir" -b "$bazel_bin" starting_hashes_json + +# Generate ending hashes +git checkout "$PULL_PULL_SHA" --quiet +bazel-bin/bazel-diff generate-hashes -w "$workspace_dir" -b "$bazel_bin" ending_hashes_json + +# Get impacted targets +bazel-bin/bazel-diff get-impacted-targets -sh starting_hashes_json -fh ending_hashes_json impacted_targets + +# Build impacted targets +hack/build_impacted_frontend.sh + +