conjur-debify 3.0.0.pre.1043 → 3.0.0.pre.1118

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. metadata +5 -78
  4. data/.dockerignore +0 -1
  5. data/.gitignore +0 -22
  6. data/.project +0 -18
  7. data/.rvmrc +0 -60
  8. data/CHANGELOG.md +0 -246
  9. data/CONTRIBUTING.md +0 -16
  10. data/Dockerfile +0 -33
  11. data/Gemfile +0 -2
  12. data/Jenkinsfile +0 -116
  13. data/LICENSE.txt +0 -22
  14. data/README.md +0 -303
  15. data/Rakefile +0 -75
  16. data/bin/debify +0 -5
  17. data/build.sh +0 -8
  18. data/ci/test.sh +0 -8
  19. data/debify.gemspec +0 -36
  20. data/distrib/conjur_creds.rb +0 -7
  21. data/distrib/docker-debify +0 -50
  22. data/distrib/entrypoint.sh +0 -19
  23. data/distrib/script +0 -1
  24. data/distrib/secrets +0 -1
  25. data/distrib/secrets.yml +0 -2
  26. data/example/Gemfile +0 -9
  27. data/example/Gemfile.lock +0 -32
  28. data/example/debify.sh +0 -3
  29. data/example/distrib/postinstall.sh +0 -8
  30. data/example/docker-compose.yml +0 -11
  31. data/example/net-test.sh +0 -7
  32. data/example/test.sh +0 -4
  33. data/features/detect_version.feature +0 -12
  34. data/features/package.feature +0 -23
  35. data/features/sandbox.feature +0 -23
  36. data/features/step_definitions/debify_steps.rb +0 -29
  37. data/features/support/env.rb +0 -12
  38. data/features/support/hooks.rb +0 -29
  39. data/features/support/world.rb +0 -10
  40. data/features/test.feature +0 -24
  41. data/image-tags +0 -23
  42. data/lib/conjur/debify/Dockerfile.fpm +0 -13
  43. data/lib/conjur/debify/action/publish.rb +0 -136
  44. data/lib/conjur/debify/utils.rb +0 -16
  45. data/lib/conjur/debify/version.rb +0 -5
  46. data/lib/conjur/debify.rb +0 -850
  47. data/lib/conjur/fpm/Dockerfile +0 -26
  48. data/lib/conjur/fpm/debify_utils.sh +0 -32
  49. data/lib/conjur/fpm/package.sh +0 -107
  50. data/lib/conjur/publish/Dockerfile +0 -5
  51. data/publish-rubygem.sh +0 -10
  52. data/push-image.sh +0 -6
  53. data/secrets.yml +0 -3
  54. data/spec/action/publish_spec.rb +0 -54
  55. data/spec/data/Makefile +0 -5
  56. data/spec/data/test.tar +0 -0
  57. data/spec/debify_utils_spec.rb +0 -55
  58. data/spec/spec_helper.rb +0 -1
  59. data/spec/utils_spec.rb +0 -22
  60. data/tag-image.sh +0 -6
  61. data/test.sh +0 -6
@@ -1,29 +0,0 @@
1
-
2
- When /^I get help for "([^"]*)"$/ do |app_name|
3
- @app_name = app_name
4
- step %(I run `#{app_name} help`)
5
- end
6
-
7
- # Add more step definitions here
8
-
9
- When /^I start a container named "(.*?)"(?: on network "(.*?)")*$/ do |name, net_name|
10
- if net_name
11
- network = Docker::Network.create(net_name)
12
- networks << network
13
- end
14
-
15
- options = {
16
- 'name' => name,
17
- 'Image' => 'nginx'
18
- }
19
- options['HostConfig'] = { 'NetworkMode' => net_name } if net_name
20
-
21
- container = Docker::Container.create(options)
22
- container.start!
23
- containers << container
24
- end
25
-
26
- When /^I successfully start a sandbox for "(.*?)" with arguments "(.*?)"$/ do |project, args|
27
- step %Q{I successfully run `env DEBUG=true GLI_DEBUG=true debify sandbox -d ../../#{project} #{args}`}
28
- containers << Docker::Container.get("#{project}-sandbox")
29
- end
@@ -1,12 +0,0 @@
1
- require 'aruba/cucumber'
2
- require 'docker-api'
3
-
4
- ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
5
- LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
6
-
7
- Aruba.configure do |config|
8
- config.exit_timeout = 1200
9
- # not a best practice from aruba's point of view
10
- # but the only solution I've found to have docker credentials context
11
- config.home_directory = ENV['HOME']
12
- end
@@ -1,29 +0,0 @@
1
- Before do
2
- # Using "announce" causes massive warnings on 1.9.2
3
- @puts = true
4
- @original_rubylib = ENV['RUBYLIB']
5
- ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
6
- end
7
-
8
- After do
9
- ENV['RUBYLIB'] = @original_rubylib
10
- end
11
-
12
- Around do |scenario, block|
13
- # Note that self in an Around hook is the instance of the world
14
- # (here, a DebifyWorld) for the current scenario.
15
- initialize
16
- begin
17
- block.call
18
- ensure
19
- unless ENV['KEEP_CONTAINERS']
20
- containers.each do |c|
21
- c.remove(force: true)
22
- end
23
-
24
- networks.each do |n|
25
- n.remove
26
- end
27
- end
28
- end
29
- end
@@ -1,10 +0,0 @@
1
- module DebifyWorld
2
- attr_accessor :containers, :networks
3
-
4
- def initialize
5
- @containers = []
6
- @networks = []
7
- end
8
- end
9
-
10
- World(DebifyWorld)
@@ -1,24 +0,0 @@
1
- @announce-output
2
- Feature: Testing
3
-
4
- Background:
5
- Given I successfully run `env DEBUG=true GLI_DEBUG=true debify package -d ../../example -v 0.0.1 example -- --post-install /distrib/postinstall.sh`
6
-
7
- Scenario: 'example' project can be tested successfully
8
- When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull example test.sh`
9
- Then the stderr should contain "Test succeeded"
10
-
11
- Scenario: 'example' project can be tested when linked to another container
12
- Given I start a container named "other_host"
13
- When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull --link other_host example net-test.sh`
14
- Then the stderr should contain "Test succeeded"
15
-
16
- Scenario: 'example' project can be tested on a network other than the default
17
- Given I start a container named "other_host" on network "test-net"
18
- When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull --net test-net example net-test.sh`
19
- Then the stderr should contain "Test succeeded"
20
-
21
- Scenario: 'example' project can be tested on a network other than the default with a host aliased
22
- Given I start a container named "another_host" on network "test-net"
23
- When I successfully run `env DEBUG=true GLI_DEBUG=true debify test -t 5.0-stable -v 0.0.1 -d ../../example --no-pull --link another_host:other_host --net test-net example net-test.sh`
24
- Then the stderr should contain "Test succeeded"
data/image-tags DELETED
@@ -1,23 +0,0 @@
1
- #!/bin/bash -e
2
-
3
- : ${BRANCH_NAME:=$(git symbolic-ref --short HEAD)}
4
-
5
- show_master_tags() {
6
- IFS=. read MAJOR MINOR PATCH <<< "$(<VERSION)"
7
- TAG="$MAJOR.$MINOR.$PATCH"
8
- echo "latest $TAG $MAJOR.$MINOR"
9
- }
10
-
11
- show_branch_tags() {
12
- # tail and tr, to remove the grottiness from the detect-version
13
- # output
14
- local version="$(DEBIFY_IMAGE=debify:$(<VERSION) ./docker-debify detect-version | tail -1 | tr -d '\r')"
15
-
16
- echo "$BRANCH_NAME $version"
17
- }
18
-
19
- if [[ "$BRANCH_NAME" == "master" ]]; then
20
- show_master_tags
21
- else
22
- show_branch_tags
23
- fi
@@ -1,13 +0,0 @@
1
- FROM @@image@@
2
-
3
- RUN mkdir -p /src/opt/conjur/project
4
-
5
- WORKDIR /src/opt/conjur/project
6
-
7
- COPY Gemfile ./
8
- COPY Gemfile.lock ./
9
-
10
- COPY . .
11
- ADD debify.sh /
12
-
13
- WORKDIR /src
@@ -1,136 +0,0 @@
1
- module Conjur::Debify
2
- module Action
3
- class Publish
4
-
5
- def detect_component
6
- branch = ENV['GIT_BRANCH'] || ENV['BRANCH_NAME'] || `git rev-parse --abbrev-ref HEAD`.strip
7
- if %w(master origin/master).include?(branch)
8
- 'stable'
9
- else
10
- branch.gsub('/', '.')
11
- end
12
- end
13
-
14
- attr_reader :distribution, :project_name, :cmd_options
15
- def initialize(distribution, project_name, cmd_options)
16
- @distribution = distribution
17
- @project_name = project_name
18
- @cmd_options = cmd_options
19
- end
20
-
21
- def run
22
- dir = cmd_options[:dir] || '.'
23
- dir = File.expand_path(dir)
24
- raise "Directory #{dir} does not exist or is not a directory" unless File.directory?(dir)
25
-
26
- Dir.chdir dir do
27
- version = cmd_options[:version] || detect_version
28
-
29
- publish_image = create_image
30
- DebugMixin.debug_write "Built base publish image '#{publish_image.id}'\n"
31
-
32
- art_url = cmd_options[:url]
33
- deb_art_repo = cmd_options[:repo]
34
-
35
- art_user = ENV['ARTIFACTORY_USER']
36
- art_password = ENV['ARTIFACTORY_PASSWORD']
37
- unless art_user && art_password
38
- art_user, art_password = fetch_art_creds
39
- end
40
-
41
- # Publish deb package
42
- component = cmd_options[:component] || detect_component
43
- deb_info = "#{distribution}/#{component}/amd64"
44
- package_name = "conjur-#{project_name}_#{version}_amd64.deb"
45
- publish_package(
46
- publish_image: publish_image,
47
- art_url: art_url,
48
- art_user: art_user,
49
- art_password: art_password,
50
- art_repo: deb_art_repo,
51
- package_name: package_name,
52
- dir: dir,
53
- deb_info: deb_info
54
- )
55
-
56
- # Publish RPM package
57
- # The rpm builder replaces dashes with underscores in the version
58
- rpm_version = version.tr('-', '_')
59
- package_name = "conjur-#{project_name}-#{rpm_version}-1.x86_64.rpm"
60
- rpm_art_repo = cmd_options['rpm-repo']
61
- publish_package(
62
- publish_image: publish_image,
63
- art_url: art_url,
64
- art_user: art_user,
65
- art_password: art_password,
66
- art_repo: rpm_art_repo,
67
- package_name: package_name,
68
- dir: dir
69
- )
70
- end
71
- end
72
-
73
- def create_image
74
- Docker::Image.build_from_dir File.expand_path('../../publish', File.dirname(__FILE__)), tag: "debify-publish", &DebugMixin::DOCKER
75
- end
76
-
77
- def fetch_art_creds
78
- require 'conjur/cli'
79
- require 'conjur/authn'
80
- Conjur::Config.load
81
- Conjur::Config.apply
82
- conjur = Conjur::Authn.connect nil, noask: true
83
-
84
- account = Conjur.configuration.account
85
- username_var = [account, "variable", "ci/artifactory/users/jenkins/username"].join(':')
86
- password_var = [account, "variable", 'ci/artifactory/users/jenkins/password'].join(':')
87
- [conjur.resource(username_var).value, conjur.resource(password_var).value]
88
- end
89
-
90
- def publish_package(
91
- publish_image:,
92
- art_url:,
93
- art_user:,
94
- art_password:,
95
- art_repo:,
96
- package_name:,
97
- dir:,
98
- deb_info: nil
99
- )
100
-
101
- cmd_args = [
102
- "jfrog", "rt", "upload",
103
- "--url", art_url,
104
- "--user", art_user,
105
- "--password", art_password,
106
- ]
107
-
108
- cmd_args += ["--deb", deb_info] if deb_info
109
- cmd_args += [package_name, "#{art_repo}/"]
110
-
111
- options = {
112
- 'Image' => publish_image.id,
113
- 'Cmd' => cmd_args,
114
- 'Binds' => [
115
- [ dir, "/src" ].join(':')
116
- ]
117
- }
118
- options['Privileged'] = true if Docker.version['Version'] >= '1.10.0'
119
-
120
- publish(options)
121
- end
122
-
123
- def publish(options)
124
- container = Docker::Container.create(options)
125
- begin
126
- container.tap(&:start!).streaming_logs(follow: true, stdout: true, stderr: true) { |stream, chunk| puts "#{chunk}" }
127
- status = container.wait
128
- raise "Failed to publish package" unless status['StatusCode'] == 0
129
- ensure
130
- container.delete(force: true)
131
- end
132
- end
133
-
134
- end
135
- end
136
- end
@@ -1,16 +0,0 @@
1
- require 'rubygems/package'
2
-
3
- module Conjur::Debify::Utils
4
- module_function
5
-
6
- # copy a file from container to the current working directory
7
- def copy_from_container container, path
8
- tar = StringIO.new
9
- container.archive_out(path) { |chunk| tar.write chunk }
10
- tar.rewind
11
- Gem::Package::TarReader.new(tar).each do |entry|
12
- File.write entry.full_name, entry.read
13
- end
14
- end
15
- end
16
-
@@ -1,5 +0,0 @@
1
- module Conjur
2
- module Debify
3
- VERSION = File.read(File.expand_path('../../../VERSION', __dir__))
4
- end
5
- end