mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-18 08:58:30 +00:00
Merge pull request #17 from mstg/miscchanges-1
This commit is contained in:
commit
7e5f6f932a
@ -82,12 +82,12 @@ go_repository(
|
|||||||
go_repository(
|
go_repository(
|
||||||
name = "com_github_ProtonMail_go_crypto",
|
name = "com_github_ProtonMail_go_crypto",
|
||||||
importpath = "github.com/ProtonMail/go-crypto",
|
importpath = "github.com/ProtonMail/go-crypto",
|
||||||
|
patch_args = ["-p1"],
|
||||||
|
patches = [
|
||||||
|
"//patches:0001-Key-ID-subpacket-should-not-be-hashed-or-critical-fo.patch",
|
||||||
|
],
|
||||||
sum = "h1:J2FzIrXN82q5uyUraeJpLIm7U6PffRwje2ORho5yIik=",
|
sum = "h1:J2FzIrXN82q5uyUraeJpLIm7U6PffRwje2ORho5yIik=",
|
||||||
version = "v0.0.0-20220113124808-70ae35bab23f",
|
version = "v0.0.0-20220113124808-70ae35bab23f",
|
||||||
patches = [
|
|
||||||
"//patches:0001-Key-ID-subpacket-should-not-be-hashed-or-critical-fo.patch",
|
|
||||||
],
|
|
||||||
patch_args = ["-p1"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go_repository(
|
go_repository(
|
||||||
|
@ -53,6 +53,9 @@ const { auth } = expressOidc;
|
|||||||
export default async function(opts) {
|
export default async function(opts) {
|
||||||
// Create a new app for health checks.
|
// Create a new app for health checks.
|
||||||
const appZ = express();
|
const appZ = express();
|
||||||
|
appZ.get('/healthz', ((req, res) => {
|
||||||
|
res.end();
|
||||||
|
}));
|
||||||
appZ.get('/_/healthz', ((req, res) => {
|
appZ.get('/_/healthz', ((req, res) => {
|
||||||
res.end();
|
res.end();
|
||||||
}));
|
}));
|
||||||
@ -83,15 +86,19 @@ export default async function(opts) {
|
|||||||
console.log(`Using clientID: ${opts.clientID}`);
|
console.log(`Using clientID: ${opts.clientID}`);
|
||||||
console.log(`Using baseURL: ${opts.baseURL}`);
|
console.log(`Using baseURL: ${opts.baseURL}`);
|
||||||
|
|
||||||
if (opts.issuerBaseURL.endsWith('.localhost') || opts.issuerBaseURL.endsWith('.localhost/')) {
|
if ((opts.issuerBaseURL.endsWith('.localhost')
|
||||||
const kong = 'kong-proxy.kong.svc.cluster.local'
|
|| opts.issuerBaseURL.endsWith('.localhost/'))
|
||||||
|
&& process.env['BYC_ENV']) {
|
||||||
|
const kong = 'kong-proxy.kong.svc.cluster.local';
|
||||||
const urlObject = new URL(opts.issuerBaseURL);
|
const urlObject = new URL(opts.issuerBaseURL);
|
||||||
console.warn(`Forcing ${urlObject.hostname} to resolve to ${kong}`);
|
console.warn(`Forcing ${urlObject.hostname} to resolve to ${kong}`);
|
||||||
const lookup = async () => {
|
const lookup = async () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// noinspection HttpUrlsUsage
|
// noinspection HttpUrlsUsage
|
||||||
dns.lookup(kong, { family: 4 }, (err, address, family) => {
|
dns.lookup(kong, { family: 4 }, (err, address, family) => {
|
||||||
if(err) reject(err);
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
resolve(address);
|
resolve(address);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -99,11 +106,13 @@ export default async function(opts) {
|
|||||||
const internalServiceResolve = await lookup();
|
const internalServiceResolve = await lookup();
|
||||||
evilDns.add(urlObject.hostname, internalServiceResolve);
|
evilDns.add(urlObject.hostname, internalServiceResolve);
|
||||||
// Disable TLS verification for development
|
// Disable TLS verification for development
|
||||||
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0
|
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
authRequired: (process.env['DISABLE_AUTH_ENFORCE'] && process.env['DISABLE_AUTH_ENFORCE'] === 'false') || !!!opts.disableAuthEnforce,
|
authRequired: process.env['DISABLE_AUTH_ENFORCE']
|
||||||
|
? process.env['DISABLE_AUTH_ENFORCE'] === 'false'
|
||||||
|
: !!!opts.disableAuthEnforce,
|
||||||
// Disable telemetry
|
// Disable telemetry
|
||||||
enableTelemetry: false,
|
enableTelemetry: false,
|
||||||
// Use dev secret is none is present (Prod requires a secret so not a security issue)
|
// Use dev secret is none is present (Prod requires a secret so not a security issue)
|
||||||
@ -115,7 +124,6 @@ export default async function(opts) {
|
|||||||
clientID: opts.clientID,
|
clientID: opts.clientID,
|
||||||
// The specific application should supply a dev secret while prod secrets should be set as an env variable
|
// The specific application should supply a dev secret while prod secrets should be set as an env variable
|
||||||
clientSecret: opts.clientSecret,
|
clientSecret: opts.clientSecret,
|
||||||
// We're currently only using the Rocky issuer
|
|
||||||
issuerBaseURL: opts.issuerBaseURL,
|
issuerBaseURL: opts.issuerBaseURL,
|
||||||
idpLogout: true,
|
idpLogout: true,
|
||||||
authorizationParams: {
|
authorizationParams: {
|
||||||
@ -138,13 +146,50 @@ export default async function(opts) {
|
|||||||
// Remember, authentication done here is only for simplicity purposes.
|
// Remember, authentication done here is only for simplicity purposes.
|
||||||
// The authentication token is then passed on to the API.
|
// The authentication token is then passed on to the API.
|
||||||
// Bypassing auth here doesn't accomplish anything.
|
// Bypassing auth here doesn't accomplish anything.
|
||||||
|
let middlewares = [];
|
||||||
|
|
||||||
|
|
||||||
|
// If requireEmailSuffix is present, let's validate post callback
|
||||||
|
// that the signed in email ends with a suffix in the allowlist
|
||||||
|
// 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(
|
||||||
|
',');
|
||||||
|
}
|
||||||
|
if (requireEmailSuffix) {
|
||||||
|
middlewares.push((req, res, next) => {
|
||||||
|
const email = req.oidc?.user?.email;
|
||||||
|
if (!email) {
|
||||||
|
return next('No email found in the user object');
|
||||||
|
}
|
||||||
|
const suffixes = requireEmailSuffix;
|
||||||
|
let isAllowed = false;
|
||||||
|
for (const suffix of suffixes) {
|
||||||
|
if (email.endsWith(suffix)) {
|
||||||
|
isAllowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAllowed) {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
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) => {
|
app.use((req, res, next) => {
|
||||||
try {
|
try {
|
||||||
auth(config)(req, res, next);
|
auth(config)(req, res, next);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
});
|
}, [middlewares]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently in dev, webpack is handling all file serving
|
// Currently in dev, webpack is handling all file serving
|
||||||
@ -200,9 +245,11 @@ export default async function(opts) {
|
|||||||
// Make it possible to override api url using an env variable.
|
// Make it possible to override api url using an env variable.
|
||||||
// Example: /api can be set with URL_API
|
// Example: /api can be set with URL_API
|
||||||
// Example 2: /manage/api can be set with URL_MANAGE_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 = prod ? (process.env[prodEnvName] || opts.apis[x].prodApiUrl) : opts.apis[x].devApiUrl;
|
const apiUrl = prod ? (process.env[prodEnvName]
|
||||||
|
|| opts.apis[x].prodApiUrl) : opts.apis[x].devApiUrl;
|
||||||
|
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
target: apiUrl,
|
target: apiUrl,
|
||||||
@ -265,7 +312,7 @@ export default async function(opts) {
|
|||||||
webpackMildCompile(compiler);
|
webpackMildCompile(compiler);
|
||||||
|
|
||||||
const wdm = webpackDevMiddleware(compiler, {
|
const wdm = webpackDevMiddleware(compiler, {
|
||||||
publicPath: opts.webpackConfig.output.publicPath,
|
publicPath: opts.webpackConfig.output.publicPath
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(history());
|
app.use(history());
|
||||||
@ -279,7 +326,8 @@ export default async function(opts) {
|
|||||||
// For SPAs, the only HTML page is the index page
|
// For SPAs, the only HTML page is the index page
|
||||||
if (res.get('content-type').indexOf('text/html') !== -1) {
|
if (res.get('content-type').indexOf('text/html') !== -1) {
|
||||||
// Run through handlebars compiler with our template parameters
|
// Run through handlebars compiler with our template parameters
|
||||||
newData = hbs.handlebars.compile(data.toString())(templateParams(req));
|
newData = hbs.handlebars.compile(data.toString())(
|
||||||
|
templateParams(req));
|
||||||
} else {
|
} else {
|
||||||
// No new data, just return old data
|
// No new data, just return old data
|
||||||
newData = data;
|
newData = data;
|
||||||
|
@ -32,8 +32,20 @@
|
|||||||
|
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
|
export function envOverridable(svcName, protocol, x) {
|
||||||
|
const envName = `${svcName}_${protocol}_ENDPOINT_OVERRIDE`.toUpperCase();
|
||||||
|
const envValue = process.env[envName];
|
||||||
|
if (envValue) {
|
||||||
|
return envValue;
|
||||||
|
}
|
||||||
|
return x();
|
||||||
|
}
|
||||||
|
|
||||||
export function svcName(svc, protocol) {
|
export function svcName(svc, protocol) {
|
||||||
let env = process.env['BYC_ENV'];
|
let env = process.env['BYC_ENV'];
|
||||||
|
if (!env) {
|
||||||
|
env = 'dev';
|
||||||
|
}
|
||||||
return `${svc}-${protocol}-${env}-service`;
|
return `${svc}-${protocol}-${env}-service`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,6 +54,10 @@ export function svcNameHttp(svc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function endpoint(generatedServiceName, ns, port) {
|
export function endpoint(generatedServiceName, ns, port) {
|
||||||
|
const forceNs = process.env['BYC_FORCE_NS'];
|
||||||
|
if (forceNs) {
|
||||||
|
ns = forceNs;
|
||||||
|
}
|
||||||
return `${generatedServiceName}.${ns}.svc.cluster.local${port}`;
|
return `${generatedServiceName}.${ns}.svc.cluster.local${port}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,20 +33,29 @@
|
|||||||
// noinspection JSUnresolvedFunction
|
// noinspection JSUnresolvedFunction
|
||||||
// noinspection ES6PreferShortImport
|
// noinspection ES6PreferShortImport
|
||||||
|
|
||||||
import { svcNameHttp, endpointHttp, NS } from '../../../common/frontend_server/upstream.mjs';
|
import {
|
||||||
|
svcNameHttp,
|
||||||
|
endpointHttp,
|
||||||
|
NS,
|
||||||
|
envOverridable
|
||||||
|
} from '../../../common/frontend_server/upstream.mjs';
|
||||||
import pkg from '@ory/hydra-client';
|
import pkg from '@ory/hydra-client';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
const { Configuration, PublicApi, AdminApi } = pkg;
|
const { Configuration, PublicApi, AdminApi } = pkg;
|
||||||
|
|
||||||
export function hydraPublicUrl() {
|
export function hydraPublicUrl() {
|
||||||
const svc = svcNameHttp('hydra-public');
|
return envOverridable('hydra_public', 'http', () => {
|
||||||
return endpointHttp(svc, NS('hydra-public'), ':4444');
|
const svc = svcNameHttp('hydra-public');
|
||||||
|
return endpointHttp(svc, NS('hydra-public'), ':4444');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hydraAdminUrl() {
|
function hydraAdminUrl() {
|
||||||
const svc = svcNameHttp('hydra-admin');
|
return envOverridable('hydra_admin', 'http', () => {
|
||||||
return endpointHttp(svc, NS('hydra-admin'), ':4445');
|
const svc = svcNameHttp('hydra-admin');
|
||||||
|
return endpointHttp(svc, NS('hydra-admin'), ':4445');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const hydraAdmin = new AdminApi(
|
const hydraAdmin = new AdminApi(
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"@babel/preset-typescript": "^7.10.4",
|
"@babel/preset-typescript": "^7.10.4",
|
||||||
"@bazel/buildifier": "^5.1.0",
|
"@bazel/buildifier": "^5.1.0",
|
||||||
"@bazel/hide-bazel-files": "^1.7.0",
|
"@bazel/hide-bazel-files": "^1.7.0",
|
||||||
"@bazel/typescript": "^5.5.2",
|
"@bazel/typescript": "^3.7.0",
|
||||||
"@emotion/react": "^11.8.1",
|
"@emotion/react": "^11.8.1",
|
||||||
"@emotion/styled": "^11.8.1",
|
"@emotion/styled": "^11.8.1",
|
||||||
"@heroicons/react": "^1.0.1",
|
"@heroicons/react": "^1.0.1",
|
||||||
|
@ -578,6 +578,10 @@ func (c *Controller) CreateK8sPodActivity(ctx context.Context, req *ProvisionWor
|
|||||||
Name: "REAL_BUILD_ARCH",
|
Name: "REAL_BUILD_ARCH",
|
||||||
Value: imageArch,
|
Value: imageArch,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "TEMPORAL_NAMESPACE",
|
||||||
|
Value: viper.GetString("temporal.namespace"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "KEYKEEPER_GRPC_ENDPOINT_OVERRIDE",
|
Name: "KEYKEEPER_GRPC_ENDPOINT_OVERRIDE",
|
||||||
Value: os.Getenv("KEYKEEPER_GRPC_ENDPOINT_OVERRIDE"),
|
Value: os.Getenv("KEYKEEPER_GRPC_ENDPOINT_OVERRIDE"),
|
||||||
|
@ -213,7 +213,7 @@ func (s *Server) SignArtifactActivity(ctx context.Context, artifactId string, ke
|
|||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
s.log.Errorf("failed to add error details to status: %v", err2)
|
s.log.Errorf("failed to add error details to status: %v", err2)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("failed to sign artifact %s: %v\nlogs: %s", artifact.Name, err, outBuf.String())
|
return nil, statusErr
|
||||||
}
|
}
|
||||||
_, err = s.storage.PutObject(newObjectKey, localPath)
|
_, err = s.storage.PutObject(newObjectKey, localPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -251,6 +251,8 @@ func (s *Server) SignArtifactActivity(ctx context.Context, artifactId string, ke
|
|||||||
"--checksig", localPath,
|
"--checksig", localPath,
|
||||||
}
|
}
|
||||||
cmd := gpgCmdEnv(exec.Command("rpm", opts...))
|
cmd := gpgCmdEnv(exec.Command("rpm", opts...))
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Errorf("failed to verify artifact %s: %v", artifact.Name, err)
|
s.log.Errorf("failed to verify artifact %s: %v", artifact.Name, err)
|
||||||
@ -260,11 +262,8 @@ func (s *Server) SignArtifactActivity(ctx context.Context, artifactId string, ke
|
|||||||
}
|
}
|
||||||
var tries int
|
var tries int
|
||||||
for {
|
for {
|
||||||
res, err := rpmSign()
|
res, _ := rpmSign()
|
||||||
if err == nil {
|
err := verifySig()
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
err = verifySig()
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,9 @@ func (s *Server) GetBlob(ctx context.Context, req *yumrepofspb.GetBlobRequest) (
|
|||||||
if err := req.ValidateAll(); err != nil {
|
if err := req.ValidateAll(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.Arch == "i386" {
|
||||||
|
req.Arch = "i686"
|
||||||
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(req.Blob, ".sqlite.gz") {
|
if strings.HasSuffix(req.Blob, ".sqlite.gz") {
|
||||||
s3Req, _ := s.s3.GetObjectRequest(&s3.GetObjectInput{
|
s3Req, _ := s.s3.GetObjectRequest(&s3.GetObjectInput{
|
||||||
|
@ -44,6 +44,9 @@ func (s *Server) GetRepoMd(_ context.Context, req *yumrepofspb.GetRepoMdRequest)
|
|||||||
if err := req.ValidateAll(); err != nil {
|
if err := req.ValidateAll(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.Arch == "i386" {
|
||||||
|
req.Arch = "i686"
|
||||||
|
}
|
||||||
|
|
||||||
latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch)
|
latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -66,6 +69,9 @@ func (s *Server) GetRepoMdSignature(_ context.Context, req *yumrepofspb.GetRepoM
|
|||||||
if err := req.ValidateAll(); err != nil {
|
if err := req.ValidateAll(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.Arch == "i386" {
|
||||||
|
req.Arch = "i686"
|
||||||
|
}
|
||||||
|
|
||||||
latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch)
|
latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -88,6 +94,9 @@ func (s *Server) GetPublicKey(_ context.Context, req *yumrepofspb.GetPublicKeyRe
|
|||||||
if err := req.ValidateAll(); err != nil {
|
if err := req.ValidateAll(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.Arch == "i386" {
|
||||||
|
req.Arch = "i686"
|
||||||
|
}
|
||||||
|
|
||||||
key, err := s.db.GetDefaultKeyForProject(req.ProjectId)
|
key, err := s.db.GetDefaultKeyForProject(req.ProjectId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -104,6 +113,9 @@ func (s *Server) GetUrlMappings(_ context.Context, req *yumrepofspb.GetUrlMappin
|
|||||||
if err := req.ValidateAll(); err != nil {
|
if err := req.ValidateAll(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.Arch == "i386" {
|
||||||
|
req.Arch = "i686"
|
||||||
|
}
|
||||||
|
|
||||||
latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch)
|
latestRevision, err := s.db.GetLatestActiveRepositoryRevisionByProjectIdAndNameAndArch(req.ProjectId, req.RepoName, req.Arch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -51,6 +51,9 @@ func (s *Server) GetRpm(ctx context.Context, req *yumrepofspb.GetRpmRequest) (*y
|
|||||||
if err := req.ValidateAll(); err != nil {
|
if err := req.ValidateAll(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if req.Arch == "i386" {
|
||||||
|
req.Arch = "i686"
|
||||||
|
}
|
||||||
|
|
||||||
fileName := fmt.Sprintf("%s/%s.rpm", req.ParentTaskId, strings.TrimSuffix(req.FileName, ".rpm"))
|
fileName := fmt.Sprintf("%s/%s.rpm", req.ParentTaskId, strings.TrimSuffix(req.FileName, ".rpm"))
|
||||||
if len(req.ParentTaskId) == 1 {
|
if len(req.ParentTaskId) == 1 {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
||||||
load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push", "container_layer")
|
load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer", "container_push")
|
||||||
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
|
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
|
||||||
|
|
||||||
REGISTRY_VARIANT = "aws"
|
REGISTRY_VARIANT = "aws"
|
||||||
@ -63,10 +63,10 @@ def container(image_name, files, tars_to_layer = [], base = "//bases/bazel/go",
|
|||||||
|
|
||||||
if len(server_files) > 0:
|
if len(server_files) > 0:
|
||||||
nodejs_image(
|
nodejs_image(
|
||||||
name = "%s_image_node" %image_name,
|
name = "%s_image_node" % image_name,
|
||||||
entry_point = server_entrypoint,
|
entry_point = server_entrypoint,
|
||||||
data = server_files,
|
data = server_files,
|
||||||
base = ":%s_image" % image_name
|
base = ":%s_image" % image_name,
|
||||||
)
|
)
|
||||||
|
|
||||||
container_push(
|
container_push(
|
||||||
@ -88,4 +88,3 @@ def container(image_name, files, tars_to_layer = [], base = "//bases/bazel/go",
|
|||||||
}) if should_use_aws_format and not disable_conditional else tag,
|
}) if should_use_aws_format and not disable_conditional else tag,
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,6 +50,9 @@ func SvcNameGrpc(svc string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Endpoint(svcName string, ns string, port string) string {
|
func Endpoint(svcName string, ns string, port string) string {
|
||||||
|
if forceNs := os.Getenv("BYC_FORCE_NS"); forceNs != "" {
|
||||||
|
ns = forceNs
|
||||||
|
}
|
||||||
return fmt.Sprintf("%s.%s.svc.cluster.local%s", svcName, ns, port)
|
return fmt.Sprintf("%s.%s.svc.cluster.local%s", svcName, ns, port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,15 @@
|
|||||||
package servicecatalog
|
package servicecatalog
|
||||||
|
|
||||||
func HydraPublic() string {
|
func HydraPublic() string {
|
||||||
svcName := SvcNameHttp("hydra-public")
|
return envOverridable("hydra_public", "http", func() string {
|
||||||
return EndpointHttp(svcName, NS("hydra-public")) + ":4444"
|
svcName := SvcNameHttp("hydra-public")
|
||||||
|
return EndpointHttp(svcName, NS("hydra-public")) + ":4444"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func HydraAdmin() string {
|
func HydraAdmin() string {
|
||||||
svcName := SvcNameHttp("hydra-admin")
|
return envOverridable("hydra_admin", "http", func() string {
|
||||||
return EndpointHttp(svcName, NS("hydra-admin")) + ":4445"
|
svcName := SvcNameHttp("hydra-admin")
|
||||||
|
return EndpointHttp(svcName, NS("hydra-admin")) + ":4445"
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SpiceDB() string {
|
func SpiceDB() string {
|
||||||
svcName := SvcNameGrpc("spicedb")
|
return envOverridable("spicedb", "grpc", func() string {
|
||||||
return Endpoint(svcName, NS("spicedb"), ":50051")
|
svcName := SvcNameGrpc("spicedb")
|
||||||
|
return Endpoint(svcName, NS("spicedb"), ":50051")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func SpiceDBCredentials() []grpc.DialOption {
|
func SpiceDBCredentials() []grpc.DialOption {
|
||||||
|
@ -9,6 +9,7 @@ go_library(
|
|||||||
"//vendor/github.com/sirupsen/logrus",
|
"//vendor/github.com/sirupsen/logrus",
|
||||||
"//vendor/github.com/spf13/pflag",
|
"//vendor/github.com/spf13/pflag",
|
||||||
"//vendor/github.com/spf13/viper",
|
"//vendor/github.com/spf13/viper",
|
||||||
|
"//vendor/go.temporal.io/api/workflowservice/v1:workflowservice",
|
||||||
"//vendor/go.temporal.io/sdk/client",
|
"//vendor/go.temporal.io/sdk/client",
|
||||||
"@org_golang_google_grpc//:go_default_library",
|
"@org_golang_google_grpc//:go_default_library",
|
||||||
"@org_golang_google_grpc//credentials",
|
"@org_golang_google_grpc//credentials",
|
||||||
|
@ -31,14 +31,18 @@
|
|||||||
package temporalutils
|
package temporalutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
"go.temporal.io/api/workflowservice/v1"
|
||||||
"go.temporal.io/sdk/client"
|
"go.temporal.io/sdk/client"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AddFlags(pflags *pflag.FlagSet) {
|
func AddFlags(pflags *pflag.FlagSet) {
|
||||||
@ -66,5 +70,32 @@ func NewClient(opts client.Options) (client.Client, error) {
|
|||||||
|
|
||||||
opts.HostPort = temporalHostPort
|
opts.HostPort = temporalHostPort
|
||||||
|
|
||||||
|
bycNs := os.Getenv("BYC_NS")
|
||||||
|
temporalNamespace := os.Getenv("TEMPORAL_NAMESPACE")
|
||||||
|
if temporalNamespace != "" {
|
||||||
|
bycNs = temporalNamespace
|
||||||
|
}
|
||||||
|
if opts.Namespace != "" {
|
||||||
|
bycNs = opts.Namespace
|
||||||
|
}
|
||||||
|
if bycNs == "" {
|
||||||
|
bycNs = "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
nscl, err := client.NewNamespaceClient(opts)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
dur := 5 * 24 * time.Hour
|
||||||
|
err = nscl.Register(context.TODO(), &workflowservice.RegisterNamespaceRequest{
|
||||||
|
Namespace: bycNs,
|
||||||
|
WorkflowExecutionRetentionPeriod: &dur,
|
||||||
|
})
|
||||||
|
if err != nil && !strings.Contains(err.Error(), "Namespace already exists") {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
opts.Namespace = bycNs
|
||||||
|
viper.Set("temporal.namespace", bycNs)
|
||||||
|
|
||||||
return client.NewClient(opts)
|
return client.NewClient(opts)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user