Merge pull request #44 from mstg/frontend-build-test

Frontend cleanup and CI
This commit is contained in:
resf-prow[bot] 2022-10-30 08:51:06 +00:00 committed by GitHub
commit 09da3253c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 357 additions and 291 deletions

View File

@ -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",

View File

@ -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", //...)'`

View File

@ -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")
@ -207,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",

View File

@ -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"],
)

View File

@ -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',

View File

@ -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",
],

View File

@ -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',

View File

@ -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",
],

View File

@ -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',

View File

@ -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()

View File

@ -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"],
)

View File

@ -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,

View File

@ -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();
}

View File

@ -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(
<BrowserRouter>

View File

@ -9,7 +9,7 @@
value: 'production',
},
{
name: 'BYC_SECRET',
name: 'RESF_SECRET',
valueFrom: true,
secret: {
name: 'server',

View File

@ -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,
},

View File

@ -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',
},

View File

@ -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;

View File

@ -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`;
}

View File

@ -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

16
hack/build_impacted_frontend.sh Executable file
View File

@ -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")

26
hack/frontend_build.sh Normal file
View File

@ -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

View File

@ -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",

View File

@ -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',

View File

@ -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",

View File

@ -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',

View File

@ -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"
}

View File

@ -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 {

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply")
load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply(
name = "certmanager",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply")
load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply(
name = "externaldns",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply")
load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply(
name = "istio-dev",

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "k8s_apply")
load("//rules_resf:defs.bzl", "k8s_apply")
k8s_apply(
name = "istio-prod",

View File

@ -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",

View File

@ -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)

View File

@ -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"],
)

View File

@ -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,

View File

@ -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 == "" {

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "migration_tar")
load("//rules_resf:defs.bzl", "migration_tar")
package(default_visibility = ["//visibility:public"])

View File

@ -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"],
)

View File

@ -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,

View File

@ -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();
}

View File

@ -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",

View File

@ -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"],
)

View File

@ -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',

View File

@ -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",

View File

@ -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",

View File

@ -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',

View File

@ -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"],
)

View File

@ -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',

View File

@ -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"],
)

View File

@ -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',

View File

@ -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"],
)

View File

@ -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',

View File

@ -1,4 +1,4 @@
load("//rules_byc:defs.bzl", "migration_tar")
load("//rules_resf:defs.bzl", "migration_tar")
package(default_visibility = ["//visibility:public"])

View File

@ -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"],
)

View File

@ -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,

View File

@ -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();
}

View File

@ -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",

View File

@ -1,3 +0,0 @@
package(default_visibility = ["//rules_byc/internal:__subpackages__"])
exports_files(["container.bzl"])

View File

@ -1,6 +0,0 @@
package(default_visibility = ["//rules_byc/internal:__subpackages__"])
exports_files([
"k8s.bzl",
"k8s.bash",
])

View File

@ -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",
],

View File

@ -0,0 +1,3 @@
package(default_visibility = ["//rules_resf/internal:__subpackages__"])
exports_files(["container.bzl"])

View File

@ -0,0 +1,6 @@
package(default_visibility = ["//rules_resf/internal:__subpackages__"])
exports_files([
"k8s.bzl",
"k8s.bash",
])

View File

@ -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,
),
},

View File

@ -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",
])

View File

@ -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,
)

View File

@ -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: {

View File

@ -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

View File

@ -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
}

View File

@ -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",

View File

@ -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',

View File

@ -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

View File

@ -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", "")
}

View File

@ -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")
}

View File

@ -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")