Skip to content

Instantly share code, notes, and snippets.

View rm3l's full-sized avatar

Armel Soro rm3l

View GitHub Profile
@rm3l
rm3l / test-fetch-gh.js
Last active February 27, 2025 08:12
Simple NodeJS script that polls GH using node-fetch
const readline = require('readline');
const URL = 'https://api.github.com';
const TIMEOUT_MS = 10000; // Aligning with the default timeout settings in RHDH/Backstage
let requestInterval = 3000;
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
@rm3l
rm3l / app-config-rhdh.yaml
Created July 21, 2024 21:01
my-rhdh-cr-example
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config-rhdh
data:
"app-config-rhdh.yaml": |
backend:
auth:
externalAccess:
- type: legacy
apiVersion: backstage.io/v1alpha1
kind: User
metadata:
namespace: default
name: rm3l
spec:
profile:
displayName: rm3l
picture: https://blah.com/fname
memberOf:
@rm3l
rm3l / configureGlobalFetch.ts
Created May 2, 2024 14:22 — forked from zicklag/configureGlobalFetch.ts
Configuring a Global Proxy for Undici That Kind of Supports the `no_proxy` Environment Variable.
/**
* Importing this modules will configure the global undici agent, which is used to provide
* global `fetch()` support, to use an http proxy if present during development. Unfortunately
* undici doesn't come with this functionality so we implement a solution that is not fully
* correct as to the way that proxy environment variables are supposed to be parsed.
*
* This only goes into effect during development, though, and it's functional enough for that
* purpose.
*/
---
apiVersion: rhdh.redhat.com/v1alpha1
kind: Backstage
metadata:
name: backstage-with-sidecar
spec:
# TODO: you may want to add app-config files, dynamic plugins config, extra env vars, etc. in the 'application' field.
# application: {}
rawRuntimeConfig:
backstageConfig: backstage-with-sidecar-runtime-config
@rm3l
rm3l / backstage-with-sidecar-container.yaml
Created March 20, 2024 09:14
RHDH CR with oauth2-proxy sidecar container
---
apiVersion: rhdh.redhat.com/v1alpha1
kind: Backstage
metadata:
name: backstage-with-sidecar
spec:
# TODO: you may want to add app-config files, dynamic plugins config, extra env vars, etc. in the 'application' field.
# application: {}
rawRuntimeConfig:
backstageConfig: backstage-with-sidecar-runtime-config
#!/bin/bash
#
# Copyright (c) 2023 Red Hat, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
apiVersion: v1
kind: Namespace
metadata:
name: imageswap-system
labels:
app: imageswap
resource: namespace
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
@rm3l
rm3l / oc-pull-secret-update-global.sh
Last active December 21, 2023 20:28 — forked from nickboldt/oc-pull-secret-update-global.sh
add tokens/pwds for quay.io (and/or for registry.redhat.io) to your openshift's global or per-project pull secret
#!/bin/bash
# set your own logins!
#QUAY_USER="****"
#QUAY_TOKEN="****"
#RRIO_USERNAME="****"
#RRIO_PASSWORD="****"
# login to quay.io
REGISTRY="quay.io"
@rm3l
rm3l / prepare-commit-msg
Created September 7, 2023 11:39
Git hook for adding `Signed-off-by` to commit message - inspired from https://stackoverflow.com/a/46536244
#!/bin/sh
NAME=$(git config user.name)
EMAIL=$(git config user.email)
if [ -z "$NAME" ]; then
echo "empty git config user.name"
exit 1
fi