bosh-gen 0.100.0 → 0.101.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d062566b9b0850bc0d26317746e952bbd28d3d38506cf9632e8707f185a2680
4
- data.tar.gz: 7d0db77312618f805f71bfe29cc07c34b6b39c0d92adda337698d8af4557e57b
3
+ metadata.gz: 2b78a94705fa08c3bf3fdf40185d6337754d8a5d35d18a4e0e9fb3afcff9f7ff
4
+ data.tar.gz: 7b90bac834ecee203a1f81c68e80a2e9280016fb22993c877b2a3e5250d01008
5
5
  SHA512:
6
- metadata.gz: 1de50c9609a17a30cfbbf2f19438000fc72ff9120f53cc986a3ff5f503b4c7981a84afc939901753c693badd08c401e2f0e95abb4a949b2c88b109a85696f32f
7
- data.tar.gz: 8e512697f3822f1789326988b45a3b4468d66a0e3fdd77bc6e2071c0b521472d7bca7836c3803453da70ee6e55dc4ef3744778cb08964fa4b116fc4a7f2b4a3c
6
+ metadata.gz: 1bb8f1c5c0ac93c85710675f3322415233cb99cdb4ba94fba36ca98ed69464e5000c3d3e9e34e67c8c8a4f87094874da5a3eac818492fc027a6fad7c5c625ee1
7
+ data.tar.gz: a020deced1a75cc829af9f337251a66dd8e9a37e03148b86609ecfb1bba8de8ad2d520c549bee9db008fab1b0795afdc2e3ed72879edc1b411429345519d3bc3
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  stemcells:
3
3
  - alias: default
4
- os: ubuntu-trusty
4
+ os: ubuntu-xenial
5
5
  version: latest
6
6
 
7
7
  update:
@@ -33,55 +33,15 @@ module Bosh::Gen
33
33
  end
34
34
 
35
35
  def packaging
36
- create_file package_dir("packaging") do
37
- <<-SHELL.gsub(/^\s{10}/, '')
38
- set -e # exit immediately if a simple command exits with a non-zero status
39
- set -u # report the usage of uninitialized variables
40
-
41
- # Available variables
42
- # $BOSH_COMPILE_TARGET - where this package & spec'd source files are available
43
- # $BOSH_INSTALL_TARGET - where you copy/install files to be included in package
44
-
45
- mkdir -p $BOSH_INSTALL_TARGET/apt
46
-
47
- for DEB in $(ls -1 apt/#{name}/*.deb); do
48
- echo "Installing $(basename $DEB)"
49
- dpkg -x $DEB $BOSH_INSTALL_TARGET/apt
50
- done
51
-
52
- cp -a apt/#{name}/profile.sh $BOSH_INSTALL_TARGET/
53
- SHELL
54
- end
55
- end
56
-
57
- def package_specification
58
- src_files = ["apt/#{name}/profile.sh", "apt/#{name}/*.deb"]
59
- config = { "name" => name, "dependencies" => dependencies, "files" => src_files }
60
- create_file package_dir("spec"), YAML.dump(config)
61
- end
62
-
63
- def common_helpers
64
- directory 'src/apt'
65
- chmod 'src/apt/fetch_debs.sh', 0755
66
- end
67
-
68
- def vagrantfile
69
- copy_file 'Vagrantfile'
36
+ directory 'packages'
37
+ directory 'jobs'
70
38
  end
71
39
 
72
40
  def show_instructions
73
41
  say "Next steps:", :green
74
42
  say <<-README.gsub(/^ /, '')
75
- 1. Edit src/apt/#{name}/aptfile to specify list of debian packages to install
76
- 2. Provision vagrant and run script to fetch debian packages:
77
-
78
- vagrant up
79
- vagrant ssh -c '/vagrant/src/apt/fetch_debs.sh #{name}'
80
- vagrant destroy
81
-
82
- You can search for aptitude debian packages using apt-cache:
83
-
84
- vagrant ssh -c 'apt-cache search #{name} | sort'
43
+ 1. Edit packages/#{name}/packaging to specify list of debian packages to install
44
+ 2. Add "#{name}-pkg-install" job into deployment manifest
85
45
  README
86
46
  end
87
47
 
@@ -0,0 +1,5 @@
1
+ ---
2
+ name: <%= name %>-pkg-install
3
+ packages: ["<%= name %>"]
4
+ templates:
5
+ bin/pre-start.sh: bin/pre-start
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ set -x
4
+ cd /var/vcap/packages/<%= name %>/apt/cache/archives
5
+ . install-packages.sh
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+
3
+ set -eux
4
+
5
+ # SEE BELOW to specify the Debian packages to install
6
+
7
+ baseDir=$BOSH_INSTALL_TARGET
8
+ cacheDir="$baseDir/apt/cache"
9
+ mkdir -p "$cacheDir"
10
+
11
+ # https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1577926
12
+ ls -al /tmp
13
+ chmod 1777 /tmp
14
+
15
+ apt-get install -y apt-transport-https apt-utils
16
+
17
+ curl -sL https://raw.githubusercontent.com/starkandwayne/homebrew-cf/master/public.key | apt-key add -
18
+ echo "deb http://apt.starkandwayne.com stable main" | tee /etc/apt/sources.list.d/starkandwayne.list
19
+ apt-get update
20
+ apt-get install install-debs-in-order
21
+
22
+ apt-get update
23
+
24
+ ######################################
25
+ #
26
+ # Add list of packages to install here
27
+ apt-get install -o debug::nolocking=true -o dir::cache=$cacheDir -y -d \
28
+ <%= deb_package_name %>
29
+ #
30
+ ######################################
31
+
32
+ cd $cacheDir/archives
33
+ install-debs-in-order . > install-packages.sh
@@ -0,0 +1,4 @@
1
+ ---
2
+ name: <%= name %>
3
+ dependencies: []
4
+ files: []
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Gen
3
- VERSION = "0.100.0"
3
+ VERSION = "0.101.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.100.0
4
+ version: 0.101.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-03 00:00:00.000000000 Z
11
+ date: 2018-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -206,10 +206,11 @@ files:
206
206
  - lib/bosh/gen/generators/new_release_generator/templates/src/.gitkeep
207
207
  - lib/bosh/gen/generators/package_apt_generator.rb
208
208
  - lib/bosh/gen/generators/package_apt_generator/templates/.gitkeep
209
- - lib/bosh/gen/generators/package_apt_generator/templates/Vagrantfile
210
- - lib/bosh/gen/generators/package_apt_generator/templates/src/apt/%name%/aptfile.tt
211
- - lib/bosh/gen/generators/package_apt_generator/templates/src/apt/%name%/profile.sh.tt
212
- - lib/bosh/gen/generators/package_apt_generator/templates/src/apt/fetch_debs.sh
209
+ - lib/bosh/gen/generators/package_apt_generator/templates/jobs/%name%-pkg-install/monit
210
+ - lib/bosh/gen/generators/package_apt_generator/templates/jobs/%name%-pkg-install/spec.tt
211
+ - lib/bosh/gen/generators/package_apt_generator/templates/jobs/%name%-pkg-install/templates/bin/pre-start.sh
212
+ - lib/bosh/gen/generators/package_apt_generator/templates/packages/%name%/packaging.tt
213
+ - lib/bosh/gen/generators/package_apt_generator/templates/packages/%name%/spec.tt
213
214
  - lib/bosh/gen/generators/package_docker_image_generator.rb
214
215
  - lib/bosh/gen/generators/package_docker_image_generator/templates/jobs/%job_name%/monit.tt
215
216
  - lib/bosh/gen/generators/package_docker_image_generator/templates/jobs/%job_name%/spec.tt
@@ -1,13 +0,0 @@
1
- # Vagrant used to allow non-Ubuntu hosts to execute
2
- # apt-get commands to fetch debian packages.
3
- Vagrant.configure('2') do |config|
4
-
5
- config.vm.hostname='boshrelease-builder'
6
- config.vm.box = "ubuntu/xenial64"
7
-
8
- # Need NFS enabled, and hence a private network for virtualbox
9
- # as discussed in this project's patch
10
- # https://github.com/reidab/citizenry/commit/590ca245b9a4fc96c55ab7bc3bbafa38583f8cda
11
- config.vm.network "private_network", ip: "192.168.50.5"
12
- config.vm.synced_folder ".", "/vagrant", type: "nfs"
13
- end
@@ -1,5 +0,0 @@
1
- export PATH="/var/vcap/packages/<%= name %>/apt/usr/bin:$PATH"
2
- export LD_LIBRARY_PATH="/var/vcap/packages/<%= name %>/apt/usr/lib:${LD_LIBRARY_PATH:-}"
3
- export INCLUDE_PATH="/var/vcap/packages/<%= name %>/apt/usr/include:${INCLUDE_PATH:-}"
4
- export CPATH="$INCLUDE_PATH"
5
- export CPPPATH="$INCLUDE_PATH"
@@ -1,70 +0,0 @@
1
- set -e # exit immediately if a simple command exits with a non-zero status
2
- set -u # report the usage of uninitialized variables
3
- set -o pipefail # return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status
4
-
5
- # Usage: src/common/fetch_debs.sh postgresql [src/apt/postgresql]
6
- #
7
- # src/common/fetch_debs.sh postgresql
8
- # src/common/fetch_debs.sh postgresql src/apt/postgresql
9
- #
10
- PACKAGE_NAME=$1
11
- RELEASE_DIR=${RELEASE_DIR:-/vagrant}
12
- if [[ "${2:-X}" == "X" ]]; then
13
- PACKAGE_SRC_DIR=$RELEASE_DIR/src/apt/$PACKAGE_NAME
14
- else
15
- PACKAGE_SRC_DIR=$RELEASE_DIR/$2
16
- fi
17
- APTFILE=$PACKAGE_SRC_DIR/aptfile
18
- APT_CACHE_DIR="$RELEASE_DIR/tmp/apt/cache/$PACKAGE_NAME"
19
- APT_STATE_DIR="$RELEASE_DIR/tmp/apt/state"
20
- BLOBS_DIR=$RELEASE_DIR/blobs/apt/$PACKAGE_NAME
21
-
22
- function error() {
23
- echo " ! $*" >&2
24
- exit 1
25
- }
26
-
27
- function topic() {
28
- echo "-----> $*"
29
- }
30
-
31
- function indent() {
32
- c='s/^/ /'
33
- case $(uname) in
34
- Darwin) sed -l "$c";;
35
- *) sed -u "$c";;
36
- esac
37
- }
38
-
39
- topic "Environment information"
40
- echo $0 | indent
41
- uname -a | indent
42
- pwd | indent
43
-
44
- # Invoke apt-get to ensure it exists
45
- if [[ "$(which apt-get)X" == "X" ]]; then
46
- error "Cannot find apt-get executable. Run this script within a Debian/Ubuntu environment."
47
- fi
48
- which apt-get | indent
49
-
50
- echo $APTFILE | indent
51
- if [[ ! -f $APTFILE ]]; then
52
- error "Missing source file $APTFILE"
53
- fi
54
-
55
- mkdir -p "$APT_CACHE_DIR/archives/partial"
56
- mkdir -p "$APT_STATE_DIR/lists/partial"
57
- mkdir -p $BLOBS_DIR
58
-
59
- APT_OPTIONS="-o debug::nolocking=true -o dir::cache=$APT_CACHE_DIR -o dir::state=$APT_STATE_DIR"
60
-
61
- topic "Updating apt caches"
62
- apt-get $APT_OPTIONS update | indent
63
-
64
- for PACKAGE in $(cat $APTFILE); do
65
- topic "Fetching .debs for $PACKAGE"
66
- apt-get $APT_OPTIONS -y -d install $PACKAGE | indent
67
- done
68
-
69
- topic "Copying .debs to blobs"
70
- cp -a $APT_CACHE_DIR/archives/*.deb $BLOBS_DIR/