Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
@kvaps
kvaps / duplocated_vms.sh
Last active March 16, 2020 18:23
OpenNeubla script to find duplicated VMs on the hosts
#/bin/sh
onehost list -x | xmlstarlet sel -t -v '/HOST_POOL/HOST/VMS/ID' -n | sort | uniq -c | sort | while read dup vm; do
if [ "$dup" != "1" ]; then
echo "vm $vm duplicated $dup times, on hosts:"
onehost list -x | xmlstarlet sel -t -v "/HOST_POOL/HOST[VMS/ID/.=${vm}]/ID" -n
fi
done
@kvaps
kvaps / one_xmlrpc_client.sh
Last active February 4, 2020 19:54
OpenNebula API debug tool
#!/bin/bash
#
# Example usage:
# ./one_xmlrpc_client.sh one.vmpool.info i4:-1 i4:-1 i4:-1 i4:-1
#
print_value() {
case "$1" in
string:*) echo ' <param><value><string>'${1##string:}'</string></value></param>' ;;
i4:*) echo ' <param><value><i4>'${1##i4:}'</i4></value></param>' ;;
local job = {
script: ['echo 123'],
only: { refs: ['tags'] },
};
local ref(x) = { only+: { refs+: [x] } };
job + ref('prod')
local job = {
script: ['echo 123'],
only: { refs: ['tags'] },
};
local ref(x) = { only+: { refs: [x] } };
job + ref('prod')
// Import our library
local jobs = import 'lib/jobs.libsonnet';
// Define override functions
local ref(x) = { only+: { refs: [x] } };
local tag(x) = { tags: [x] };
local submodule(x) = { variables+: { GIT_SUBMODULE_STRATEGY: x } };
{
// Building docker-images
{
// Task for uilding docker-image
dockerImage(name):: {
tags: ['build'],
stage: 'build',
image: {
name: 'gcr.io/kaniko-project/executor:debug-v0.15.0',
entrypoint: [''],
},
script: [
deploy:{{ environment }}:{{ app }}:
stage: deploy
tags:
- {{ environment }}
script:
- qbec apply {{ environment }} --root deploy/{{ app }} --force:k8s-context __incluster__ --wait --yes
only:
changes:
- deploy/{{ app }}/**/*
refs:
build:{{ image }}:
stage: build
tags:
- build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/dockerfiles/{{ image }}/Dockerfile --destination $CI_REGISTRY_IMAGE/{{ image }}:$CI_COMMIT_TAG
# Indices
- source: /content\/(.+?)_index\.(md|html)/
public: '\1'
# Pages
- source: /content\/(.+?)\.(md|html)/
public: '\1/'
// this file has the param overrides for the default environment
local base = import './base.libsonnet';
local slug = std.extVar('qbec.io/tag');
local subdomain = std.extVar('subdomain');
base {
components+: {
website+: {
name: 'example-docs-' + slug,
domain: subdomain + '.docs.example.org',