This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myrepo=my_repo_name | |
aws ecr list-images --repository-name $myrepo --query 'imageIds[?type(imageTag)!=`string`].[imageDigest]' --output text | while read line; do aws ecr batch-delete-image --repository-name $myrepo --image-ids imageDigest=$line; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'cookbook::default' do | |
context 'When applying cookbooks on an Ubuntu instance' do | |
let(:chef_run) do | |
runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04') | |
runner.converge(described_recipe) | |
end | |
it 'converges successfully' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EC2_NAME_SUFIX=`date "+%Y%m%d%H%M"` | |
# Query AWS if exists an AMI with TAG SHA1 = $CI_BUILD_REF | |
EXISTING_AMI=$(aws ec2 describe-images \ | |
--filter="Name=tag-key,Values=SHA1,Name=tag-value,Values=$CI_BUILD_REF") | |
# Extract the AMI ID | |
AMI_ID=$(echo $EXISTING_AMI |jq ".Images[] .ImageId" |sed -e 's/^"//' -e 's/"$//') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- quality | |
- unitTests | |
- compliance | |
- build | |
- deploy | |
rubocop: | |
stage: quality | |
script: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -rf vendor/* | |
# Group all recipes and cookbooks for provisioning | |
chef exec berks vendor vendor/cookbooks | |
chef exec berks install | |
########################################################## | |
# Deregister any existing image for this commit revision | |
# Note: $CI_BUILD_REF is authomatically exported by GitLab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"aws_access_key_id": "{{env `AWS_ACCESS_KEY_ID` }}", | |
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY` }}", | |
"aws_region": "{{env `AWS_REGION` }}", | |
"ebs_optimized": "{{env `AMI_EBS_OPTIMIZED` }}", | |
"source_ami": "{{env `AWS_SOURCE_AMI` }}", | |
"instance_type": "{{env `AMI_INSTANCE_TYPE` }}", | |
"associate_public_ip_address": "{{env `AMI_ASSOCIATE_PUBLIC_IP_ADDRESS` }}", | |
"vpc_id": "{{env `AMI_VPC_ID` }}", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
KEY_NAME=$1 | |
PEM_NAME="${KEY_NAME}-key.pem" | |
CERTIFICATE_NAME="${KEY_NAME}-certificate.pem" | |
openssl genrsa 2048 > $PEM_NAME | |
openssl req -new -x509 -nodes -sha1 -days 365 -key $PEM_NAME -outform PEM > $CERTIFICATE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'foodcritic' | |
gem 'rubocop' | |
gem 'kitchen-docker' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name 'techtalk' | |
maintainer 'The Authors' | |
maintainer_email 'you@example.com' | |
license 'all_rights' | |
description 'Installs/Configures techtalk' | |
long_description 'Installs/Configures techtalk' | |
version '0.1.0' | |
# If you upload to Supermarket you should set this so your cookbook | |
# gets a `View Issues` link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute 'install docker' do | |
command 'curl -sSL https://get.docker.com/ | sh' | |
end | |
execute 'restart docker service' do | |
command 'sudo service docker restart' | |
end | |
execute 'run application container' do | |
command 'docker run -d -p 80:3000 --restart=always nandotorres/mean-todo' |
NewerOlder