shiplane 0.2.7 → 0.2.10

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: 7b5ceb3e3ec92da5d153b204c2f3d8e8d9108bc354c2690f6d9de39b69ee1893
4
- data.tar.gz: f4e5b7340fa59249d4a3ffdfc2ce0f612a6c3faaf49208feebfb12fa0853f099
3
+ metadata.gz: a5bade01c9a02846ef6c34f6a66d5c303c2ab83dda7a50ac5793bb40bad600e2
4
+ data.tar.gz: 159d3cb160e84f1fc0876b68b2e8ac2590c6c068dcc527dd100a368f4b20b52d
5
5
  SHA512:
6
- metadata.gz: 74ce1231080dca4313fa9ed5c37c3197c2fd7e3d05ce275c13e1c0a4aac0a1a8c1f4d0a224b423141cdfc5633c57ad490c46834a8045395948ff9f082ff351dd
7
- data.tar.gz: f627396ec65b1f5cba4215567d7b0559b91501e5336a3d03a560877d589b0eb452b8380bac1602931be97c7f98c978c53d2fe7713eb080b7600f558429ce6f87
6
+ metadata.gz: b226b6449b15e3d3d38b9c505969d87fedee62588ae7f2dc1e18555a6fa83f602241915e9d95a13a3d859ede4434238c912f7ecfe72733e309d05ede4826c4cc
7
+ data.tar.gz: 195bb3504c830b9dd4d28a122ab8c1b599a174162b15e61a44a2a1c53884a6f0815ce010302bf531b04633d4972551502e25d6e4ca41f2fff6c6eb3d03d53bf7
data/README.md CHANGED
@@ -118,6 +118,33 @@ You can build a docker container based on the HEAD of your current branch like s
118
118
  bundle exec cap production shiplane
119
119
  ```
120
120
 
121
+ ### Environment Variables
122
+ Shiplane uses specific .env files to make sure that a given build environment contains the appropriate environment variables. These are used for 3 separate purposes:
123
+ - The environment that the Shiplane process is running in. For example, if you want to authenticate with a Github private repo, you will need to set the GITHUB_TOKEN environment variable in your .env file so that Shiplane can authenticate.
124
+ - The buildtime step of building the container. If your container needs environment variables to be set during buildtime so that the container can be built, you will need these builtime env variables. Examples might include a Github Token used to pull dependencies from private repositories on Github during buildtime. These variables will not be stored in your container, but you may need to remove any traces of these variables that might be stored in your container as side effects if your dependency ecosystem does this. For example, Ruby Gems downloaded during buildtime using an Github Token will result in that token being stored in the Gemfile.lock file. The [examples folder](examples/rails_app/.shiplane/production_dockerfile_stages) provide an example of a means of removing this after bundling. You may consider a similar step during your build process.
125
+ - The runtime environment may require some environment variables. For example, you might have a bunch of ENVIRONMENT VARIABLES necessary for your application to run (less secure, but simpler), or, you might need an environment variable to access a vault somewhere containing other runtime ENVIRONMENT VARIABLES (more secure, slightly more difficult), or, you may have none at all and use another mechanism to inject appropriate settings (you have more control over this, but the most difficult).
126
+
127
+ ## Important ENVIRONMENT VARIABLES for the Shiplane Process
128
+ ```sh
129
+ GITHUB_TOKEN=XXXXXXXXXX # required if pulling from a private Github Repository
130
+ BITBUCKET_TOKEN=XXXXXXXXXX # required if pulling from a private Bitbucket Repository
131
+ BITBUCKET_USERNAME=XXXXXXXXXX # required if pulling from a private Bitbucket Repository
132
+ ```
133
+
134
+ ## Important ENVIRONMENT VARIABLES for buildtime
135
+ ```sh
136
+ DOCKERHUB_PASSWORD=XXXXXXXXXX # deprecated but still supported token/password specifically for DOCKERHUB
137
+ DOCKERHUB_USERNAME=XXXXXXXXXX # deprecated but still supported username specifically for DOCKERHUB
138
+ SHIPLANE_CONTAINER_REGISTRY_TOKEN=XXXXXXXXXX # Token for container registry authentication
139
+ SHIPLANE_CONTAINER_REGISTRY_USERNAME=XXXXXXXXXX # Username for container registry authentication
140
+ RAISE_EXCEPTIONS_ON_FAILED_BUILD=true # Tells Shiplane to stop on a failed build and raise an exception. Defaults to 'false'
141
+ ```
142
+ ## Important ENVIRONMENT VARIABLES for runtime
143
+ # Rails Environment Variable sample
144
+ ```sh
145
+ RAILS_MASTER_KEY=XXXXXXXXXX
146
+ ```
147
+
121
148
  #### Deploying
122
149
  Shiplane provides tasks to help you deploy your code. These tasks depend on your deployment framework, but each task appropriately launches your docker containers on your selected framework.
123
150
 
@@ -1,17 +1,18 @@
1
1
  project:
2
2
  appname: <%= app_name %>
3
3
  version_control: git
4
- # The origin url on Github
5
- # origin: username/repo_title
4
+ version_control_host: github # alternately, use `bitbucket` if your application is hosted on BitBucket
5
+ # The origin url on Github or Bitbucket
6
+ origin: #username/<%= app_name %>
6
7
  bootstrap:
7
8
  env_file: .env.production
8
9
  chef-bootstrapper:
9
- package_name: chefdk_3.13.1-1_amd64.deb
10
- package_url: https://packages.chef.io/files/stable/chefdk/3.13.1/ubuntu/16.04/chefdk_3.13.1-1_amd64.deb
10
+ package_name: chefdk_3.6.57-1_amd64.deb
11
+ package_url: https://packages.chef.io/files/stable/chefdk/3.6.57/ubuntu/18.04/chefdk_3.6.57-1_amd64.deb
11
12
  build:
12
13
  registry:
13
14
  # url: ghcr.io # for Github Container Service. Should work for similar services such as Gitlab
14
- # url: :dockerhub # for default Dockerhub Service
15
+ # url: dockerhub # for default Dockerhub Service
15
16
  settings_folder: .shiplane
16
17
  environment_file: .env.production
17
18
  compose_filepath: docker-compose.yml
@@ -20,7 +21,7 @@ build:
20
21
  artifacts:
21
22
  container-name:
22
23
  tag: <%= app_name %>-base:latest
23
- repo: kirillian2/<%= app_name %>
24
+ repo: #username/<%= app_name %>
24
25
  ports:
25
26
  - "3000:3000"
26
27
  compose:
@@ -40,8 +41,8 @@ deploy:
40
41
  requires_sudo: false
41
42
  # Put SSH options here
42
43
  # ssh_options:
43
- # user: a_user
44
- # keys: "path/to/ssh/keys"
44
+ # user: <%= ENV['SSH_USERNAME_ENV_VARIABLE_HERE'] %>
45
+ # keys: <%= ENV['PATH_TO_SSH_KEYS_HERE'] %>
45
46
  # forward_agent: true
46
47
  # auth_methods:
47
48
  # - publickey
@@ -53,7 +53,7 @@ module Shiplane
53
53
  end
54
54
  rescue StepFailureException => e
55
55
  puts e.message
56
- raise if ENV['RAISE_EXCEPTIONS_ON_FAILED_BUILD']
56
+ raise if ENV['RAISE_EXCEPTIONS_ON_FAILED_BUILD'] == 'true'
57
57
  end
58
58
 
59
59
  def steps(artifact_name, attributes)
@@ -147,7 +147,7 @@ module Shiplane
147
147
  end
148
148
 
149
149
  def dockerhub?
150
- registry_configuration['url'] == :dockerhub
150
+ registry_configuration['url'].to_s == 'dockerhub'
151
151
  end
152
152
 
153
153
  def token_auth?
@@ -21,12 +21,37 @@ module Shiplane
21
21
  @appname ||= project_config['appname']
22
22
  end
23
23
 
24
+ def bitbucket_origin?
25
+ project_config['version_control_host'] == 'bitbucket'
26
+ end
27
+
28
+ def github_origin?
29
+ project_config['version_control_host'] == 'github'
30
+ end
31
+
24
32
  def github_token
25
33
  @github_token ||= ENV['GITHUB_TOKEN']
26
34
  end
27
35
 
36
+ def bitbucket_token
37
+ @bitbucket_token ||= ENV['BITBUCKET_APP_PASSWORD']
38
+ end
39
+
40
+ def bitbucket_username
41
+ @bitbucket_username ||= ENV['BITBUCKET_APP_USERNAME']
42
+ end
43
+
28
44
  def git_url
29
- "https://#{github_token ? "#{github_token}@" : ''}github.com/#{project_config['origin']}"
45
+ return github_url if github_origin?
46
+ return bitbucket_url if bitbucket_origin?
47
+ end
48
+
49
+ def github_url
50
+ "https://#{github_token ? "#{github_token}@" : ''}github.com/#{project_config['origin']}/archive/#{sha}.tar.gz"
51
+ end
52
+
53
+ def bitbucket_url
54
+ "https://#{bitbucket_token ? "#{bitbucket_username}:#{bitbucket_token}@" : ''}bitbucket.org/#{project_config['origin']}/get/#{sha}.tar.gz"
30
55
  end
31
56
 
32
57
  def app_directory
@@ -67,7 +92,7 @@ module Shiplane
67
92
  def download_archive
68
93
  return true if File.exist? archive_path
69
94
 
70
- system("curl -L #{git_url}/archive/#{sha}.tar.gz --output #{archive_path}")
95
+ system("curl -L #{git_url} --output #{archive_path}")
71
96
  end
72
97
 
73
98
  def unpack_archive
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shiplane
4
- VERSION = "0.2.7"
4
+ VERSION = "0.2.10"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiplane
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Epperson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-25 00:00:00.000000000 Z
11
+ date: 2022-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shiplane_bootstrappers_chef
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.7
19
+ version: 0.2.10
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.7
26
+ version: 0.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: shiplane_deployers_capistrano_docker
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.7
33
+ version: 0.2.10
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.7
40
+ version: 0.2.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dotenv
43
43
  requirement: !ruby/object:Gem::Requirement