Skip to content

Instantly share code, notes, and snippets.

View Noordsestern's full-sized avatar
😈
Kill your heroes and fight

Markus Noordsestern

😈
Kill your heroes and fight
View GitHub Profile
@Noordsestern
Noordsestern / deploy-cronjob.sh
Last active October 10, 2023 11:22
Medium: Carbon Aware Computing
score-humanitec delta
--org $HUMANITEC_ORG
--app $APPLICATION_ID
--env $TARGET_ENVIRONMENT
--token $HUMANITEC_TOKEN
--file score.yaml
--extensions humanitec.cronjob.yaml
--deploy
@Noordsestern
Noordsestern / hello-world-container.yaml
Created October 10, 2023 11:12
Medium: Carbon Aware Computing
apiVersion: score.dev/v1b1
metadata:
name: score-cronjob
containers:
greeter:
image: hello-world:latest
@Noordsestern
Noordsestern / humanitec-cronjob.yaml
Created October 10, 2023 11:10
Medium: Carbon Aware Computing
apiVersion: humanitec.org/v1b1
profile: "humanitec/default-cronjob"
spec:
schedules:
carbon-efficient:
containers:
score-cronjob:
args: []
command: []
@Noordsestern
Noordsestern / gitlab-ci-cronjob-carbon.yaml
Last active October 10, 2023 11:18
Medium: Carbon Aware Computing
Get Carbon Optimized Schedule:
stage: api
image: python:3-alpine
variables:
REGION: germanywestcentral
CRONJOB_DURATION: 10
before_script:
- pip3 install chevron pyyaml
script:
# get carbon optimized timestamps
@Noordsestern
Noordsestern / example.json
Created October 10, 2023 10:44
Medium: Carbon Aware Computing
[
{
"location": "de",
"windowSize": 10,
"optimalDataPoints": [
{
"timestamp": "2023-10-10T10:43:28+00:00",
"value": 34.938
}
]
@Noordsestern
Noordsestern / gitlab-ci.yaml
Last active August 22, 2023 09:22
Deploy Wtih Score with wget
Deploy With Score:
stage: deploy
image: golang:1.19
variables:
HUMANITEC_ORG: noordsestern
APPLICATION_ID: score-cronjob
TARGET_ENVIRONMENT: development
before_script:
- wget https://github.com/score-spec/score-humanitec/releases/download/0.6.0/score-humanitec_0.6.0_linux_amd64.tar.gz
- tar -xvzf score-humanitec_0.6.0_linux_amd64.tar.gz
@Noordsestern
Noordsestern / complex_mustache_score.yaml
Last active August 22, 2023 08:48
Example for complex mustache templating with Score
image: python:3-alpine
before_script:
- pip3 install chevron pyyaml
script:
- >
echo "{
'CARBON_OPTIMIZED_HOURS':$CARBON_OPTIMIZED_HOURS,
'CARBON_OPTIMIZED_MINUTES':$CARBON_OPTIMIZED_MINUTES,
'IMAGE':'${IMAGE_NAME}:$CI_PIPELINE_IID',
'FTP_URL':$FTP_URL,
@Noordsestern
Noordsestern / score-mustache.sh
Created August 21, 2023 20:58
Parameterize Score template with Chevron
echo "{'IMAGE_VERSION':${CI_PIPELINE_IID}" > mustache_data.json
chevron -d mustache_data.json score.yaml > score.yaml
@Noordsestern
Noordsestern / mustache_score.yaml
Created August 21, 2023 20:53
Score mustache template
apiVersion: score.dev/v1b1
metadata:
name: score-cronjob
containers:
greeter:
image: hello-world:{{ IMAGE_VERSION }}
@Noordsestern
Noordsestern / wish_score_parameter.yaml
Created August 21, 2023 20:45
Score with sample parameter
apiVersion: score.dev/v1b1
metadata:
name: score-cronjob
containers:
greeter:
image: hello-world:${IMAGE_TAG}