Skip to content

Instantly share code, notes, and snippets.

# Script to find resources in AWS by an specific tag missing
# Example basic execution: python find_untagged_resources.py EMNF
# Example of more complex execution: python find_untagged_resources.py EMNF --keywords jenkins,monitor,feedback,certification
# Credits to https://medium.com/@CevoAustralia/using-the-new-resource-tagging-api-in-anger-1bfb2fe38242
# Taken some of its code and modified for the needs with a some (a lot) of modifications
import boto3
import sys
import csv
import argparse
node('devops') {
// Clean up the workspace so that we always start from scratch.
stage('cleanup') {
step([$class: 'WsCleanup'])
}
stage('Update Caseflow Certification Demo Env'){
docker.image('python:alpine3.8').inside("--user root") {
stage('Install Dependencies') {
sh """
{
"ansible_job_id": "84511952105.3597",
"attempts": 2,
"changed": true,
"cmd": "source ../caseflow-certification_env.sh && bin/rake db:migrate",
"delta": "0:00:01.474488",
"end": "2019-04-02 11:07:01.767814",
"finished": 1,
"rc": 0,
"start": "2019-04-02 11:07:00.293326",
@enriquemanuel
enriquemanuel / serverless.yml
Created January 28, 2019 22:12
AWS DMS and DB Monitor sls project
service: appeals
frameworkVersion: ">=1.0.0 <2.0.0"
package:
individually: true
exclude:
- .git/**
- lib/**
- .venv/**
- .venvdev/**
- .vscode/**
import argparse
import boto3
import logging
import sys
from botocore.exceptions import ClientError, WaiterError
def main():
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S')
parser = argparse.ArgumentParser(description='')
## FIND LATEST AMI
- name: Find the latest Base AMI
vars_files:
- vars/faster-certification.yml
ec2_ami_find:
ami_tags:
app_project: "dsva-appeals"
application: "certification-base-ami"
latest: "true"
sort: name
@enriquemanuel
enriquemanuel / getIntoSpoke.sh
Last active October 31, 2018 20:37
Connect to the Spoke VPC automatically
#!/bin/bash
#input vars:
# stage: [prod, staging]
# aws_profile: [default]
bold=$(tput bold)
normal=$(tput sgr0)
USAGE=$(cat <<-END
@enriquemanuel
enriquemanuel / Dockerfile
Last active October 4, 2018 14:17
[wip] Caseflow build docker image and store it in ECR with the dockerfile and have the startup script start upon request
FROM ruby:2.5.1-slim
MAINTAINER Development and Operations team @ Department of Veterans Affairs
# Build variables
ENV BUILD build-essential postgresql-client libaio1 libpq-dev libsqlite3-dev curl software-properties-common apt-transport-https
ENV CASEFLOW git nodejs yarn
# Environment (system) variables
ENV LD_LIBRARY_PATH="/opt/oracle/instantclient_12_1:$LD_LIBRARY_PATH" \
ORACLE_HOME="/opt/oracle/instantclient_12_1" \
def helper_findLineUploadRemainingOfFile(bucket, key, filename, commands_list, start, end):
s3 = boto3.resource('s3')
command_found = False
with open('/tmp/{}_temp'.format(filename), 'w+') as new_file:
for command in commands_list:
line = f"{start} {command} {end}"
new_file.write(line)
# upload the file
file_n_path = "/tmp/{filename}_temp".format(filename= filename)
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.2-node-browsers
environment:
- DBUS_SESSION_BUS_ADDRESS: /dev/null
- RAILS_ENV: test
- NODE_ENV: test
- MOCHA_FILE: /home/circleci/test-results/mocha/mocha.xml