Skip to content

Instantly share code, notes, and snippets.

@dataday
dataday / credentials-management.md
Last active October 22, 2023 06:47
docker + docker credential helpers + pass + gpg2 + coffee

Credentials Management

This guide describes setting out a credential storage mechanism that is shared between the root account, aka releasr, and jenkins account. It intends to support and persist access credentials that are needed when authenticating with external services, primarily Docker Hub, for users wishing to access remote Docker images as part of their containerised services.

The following diagram aims to describe the control flow this setup intends to support.

Credentials Management

This guide is a first, and a tad complicated sorry, pass at setting this up. It got us over the line for a couple of uses cases as well as working with automated build jobs.

@dataday
dataday / git-weight-loss.sh
Created August 1, 2018 09:52
Provides the ability to remove the top 5 heavy references from projects (to be tested)
#!/usr/bin/env bash
# description: This script provides the ability to remove the top 5 heavy references from projects
# author: dataday
# version: 0.1.0
# defaults
EXEC=$(realpath -L "${0#./}")
EXEC_BASE="${EXEC%/*}"
EXEC_NAME=$(basename "$EXEC")
#!/usr/bin/env python
import argparse
import logging
import requests
import math
import os
import re
import sys
from retry.api import retry_call
from urllib.parse import urlparse
@dataday
dataday / assume_role.sh
Created March 23, 2018 13:23
A wrapper to assume a specified role via AWS Security Token Service (STS)
#!/usr/bin/env bash
## A wrapper to assume a specified role via AWS Security Token Service (STS)
#
# Access to some AWS services can require specific role privileges in order to work
# The script requests and returns the AWS credentials needed to perform certain tasks by assuming a specified role
# The script interacts with AWS Security Token Service (STS) in order to assume the desired role
#
# The following command could be used if you wanted to assume the JenkinsAutomationRole to query AWS services
# Please note not all options are required as it will depend on the environment the script is invoked against
#
@dataday
dataday / manage-bucket.rb
Created November 27, 2017 11:44
Manages AWS hosted S3 bucket content via the aws-sdk for Ruby
#!/usr/bin/env ruby
# Manages AWS hosted S3 bucket content via the aws-sdk for Ruby.
# @author: dataday
# Example input:
# bundle exec ruby exe/bucket.rb bucket service-cookbook --create-bucket
# bundle exec ruby exe/bucket.rb bucket service-cookbook --delete-bucket
# bundle exec ruby exe/bucket.rb bucket service-cookbook --list-objects
# bundle exec ruby exe/bucket.rb bucket service-cookbook --upload-object local/file.suffix remote/path
@dataday
dataday / Dockerfile.CentOS6.php7
Created August 24, 2017 15:13
Dockerfile.Centos6.php7 for use on CI ahead of AWS release
FROM registry.ci.api.domain.co.uk/rmp/centos6:base
MAINTAINER dataday <dataday@domain.co.uk>
VOLUME /usr/share/webapp-base
WORKDIR /usr/share/webapp-base
# machine dependencies
RUN yum update -y && yum install -y epel-release
RUN rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RUN rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
@dataday
dataday / project-gruntfile.js
Created August 24, 2017 15:09
Gruntfile for use with Symfony webapp
module.exports = function (grunt) {
// passed environment via Makefile
var env = process.env.APP_TARGET_ENV;
// sets task type based on environment
var task_type = (['int', 'test', 'live'].indexOf(env) >= 0) ?
'dist' :
'dev';
#!/usr/bin/env bash
#
# Author: dataday
# created: 23/02/2016
#
# Description:
# Runs release (delivery pipeline) or
# development tasks locally or on CI
#
# fail on error
@dataday
dataday / release_pipeline.sh
Last active February 11, 2020 10:23
CI release script, uses Github API and internal release manager API to validate and release projects
#!/usr/bin/env bash
#
# Author: dataday
# created: 23/02/2016
#
# Description:
# Runs release tasks on CI (Delivery Pipeline)
# For input variables see $SCRIPT_ROOT/environment-ci
# debug: $0 2>&1 | tee $SCRIPT_ROOT/release.log
#
@dataday
dataday / Dockerfile.centos7
Created August 24, 2017 13:26
Dockerfile for CentOS7
FROM centos:centos7
MAINTAINER dataday <dataday@domain.co.uk>
COPY repositories/ /etc/yum.repos.d/
RUN yum update -y && yum install -y yum-utils
COPY bashrc /tmp/bashrc
RUN cat "/tmp/bashrc" >> ~/.bashrc && rm -f /tmp/bashrc