dip 8.2.6 → 8.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2024ed1872b11b03b134cef94a5e15bd0525f93ab6e61de7bf6cfe971b43ebd
4
- data.tar.gz: 13100418400bb01c4a1843559b7349aae4468a802ed9ea0ba2536840f11a9eb8
3
+ metadata.gz: b1251c437797a56125f593a350dde6c3709f70936a6cc274949d0b2b58dd814f
4
+ data.tar.gz: d1e4d3484bdc41ed6281d14a7ce324146cd1768989c3e3f3fa09fc412d72bf2d
5
5
  SHA512:
6
- metadata.gz: d018d6a84f98cd8778a9672f6764ca80ffdd590738b4f3649c1176f586f2dcf8679cb365576211fb094d008410a69ff9160642354de396973392761498d694ba
7
- data.tar.gz: f2eb077654301b798ef2ff43a93b610c3ddea668e437cc016c22944b8acb3a546fe259f42cd1f3366cca114c799e8c939cd670f140f8163e578c535413f5c064
6
+ metadata.gz: 1dafa2c574e88f414a498ed0e3cbeaab047085ee0232977fcf1900ef92637c333cab39dc9d9ae1e5eaf93843949e3bd62a9c61f23f46ba83711cd0aecf83412c
7
+ data.tar.gz: 3ce49864159703c73ac8811a5a9f8d295192f3dc0be569a7d6708a5084013a2464de89b67cb1982edd888dec7284d44761959b85fa02b62e23b95547b5ef70fc
data/README.md CHANGED
@@ -20,6 +20,14 @@ The dip is a CLI dev–tool that provides native-like interaction with a Dockeri
20
20
 
21
21
  [![asciicast](https://asciinema.org/a/210236.svg)](https://asciinema.org/a/210236)
22
22
 
23
+ ## Quick start with AI
24
+
25
+ [dip-skill](https://github.com/kalashnikovisme/dip-skill) helps you quickly configure a `dip` environment for your project. It detects the tech stack and bootstraps `dip.yml`, compose files, and Dockerfiles.
26
+
27
+ ```sh
28
+ npx skills add kalashnikovisme/dip-skill
29
+ ```
30
+
23
31
  ## Installation
24
32
 
25
33
  ```sh
@@ -178,8 +186,16 @@ provision:
178
186
  - dip clean_cache
179
187
  - dip compose up -d pg redis
180
188
  - dip bash -c ./bin/setup
189
+
190
+ preflight:
191
+ - ./bin/check-credentials
192
+ - test -f .env
181
193
  ```
182
194
 
195
+ `preflight` is an array of shell commands that dip runs before any command that touches a running container or cluster: `dip compose ...` (and its aliases `dip up`, `dip build`, `dip stop`, `dip down`), `dip ktl ...`, and `dip run ...` (including the interaction shorthand `dip <name>`). If any command exits non-zero, dip aborts before the underlying operation runs. Useful for verifying credentials are present, required files exist, env vars are set, etc.
196
+
197
+ Not triggered by `dip down --all` (cross-project teardown), `dip ssh`, `dip infra`, or `dip provision`.
198
+
183
199
  ### Predefined environment variables
184
200
 
185
201
  #### $DIP_OS
@@ -492,7 +508,6 @@ If validation fails, you'll get detailed error messages indicating what needs to
492
508
  You can skip validation by setting `DIP_SKIP_VALIDATION` environment variable.
493
509
 
494
510
  Add `# yaml-language-server: $schema=https://raw.githubusercontent.com/bibendi/dip/refs/heads/master/schema.json` to the top of your dip.yml to get schema validation in VSCode. Read more about [YAML Language Server](https://github.com/redhat-developer/vscode-yaml?tab=readme-ov-file#associating-schemas).
495
-
496
511
  ## Changelog
497
512
 
498
513
  See [CHANGELOG.md](CHANGELOG.md).
data/lib/dip/cli.rb CHANGED
@@ -49,7 +49,10 @@ module Dip
49
49
 
50
50
  desc "compose CMD [OPTIONS]", "Run Docker Compose commands"
51
51
  def compose(*argv)
52
+ require_relative "commands/preflight"
52
53
  require_relative "commands/compose"
54
+
55
+ Dip::Commands::Preflight.new.execute
53
56
  Dip::Commands::Compose.new(*argv).execute
54
57
  end
55
58
 
@@ -84,7 +87,10 @@ module Dip
84
87
 
85
88
  desc "ktl CMD [OPTIONS]", "Run kubectl commands"
86
89
  def ktl(*argv)
90
+ require_relative "commands/preflight"
87
91
  require_relative "commands/kubectl"
92
+
93
+ Dip::Commands::Preflight.new.execute
88
94
  Dip::Commands::Kubectl.new(*argv).execute
89
95
  end
90
96
 
@@ -96,8 +102,10 @@ module Dip
96
102
  if argv.empty? || options[:help]
97
103
  invoke :help, ["run"]
98
104
  else
105
+ require_relative "commands/preflight"
99
106
  require_relative "commands/run"
100
107
 
108
+ Dip::Commands::Preflight.new.execute
101
109
  Dip::Commands::Run.new(
102
110
  *argv,
103
111
  **options.to_h.transform_keys!(&:to_sym)
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../command"
4
+
5
+ module Dip
6
+ module Commands
7
+ class Preflight < Dip::Command
8
+ def execute
9
+ Dip.config.preflight.each do |command|
10
+ exec_subprocess(command)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/dip/config.rb CHANGED
@@ -20,10 +20,11 @@ module Dip
20
20
  kubectl: {},
21
21
  infra: {},
22
22
  interaction: {},
23
- provision: []
23
+ provision: [],
24
+ preflight: []
24
25
  }.freeze
25
26
 
26
- TOP_LEVEL_KEYS = %i[environment compose kubectl infra interaction provision].freeze
27
+ TOP_LEVEL_KEYS = %i[environment compose kubectl infra interaction provision preflight].freeze
27
28
 
28
29
  ConfigKeyMissingError = Class.new(ArgumentError)
29
30
 
data/lib/dip/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dip
4
- VERSION = "8.2.6"
4
+ VERSION = "8.3.0"
5
5
  end
data/schema.json CHANGED
@@ -175,6 +175,16 @@
175
175
  ]
176
176
  ]
177
177
  },
178
+ "preflight": {
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string"
182
+ },
183
+ "description": "Shell commands to run before any `dip compose` subcommand. A non-zero exit aborts the command.",
184
+ "examples": [
185
+ ["./bin/check-credentials", "test -f .env"]
186
+ ]
187
+ },
178
188
  "environment": {
179
189
  "$ref": "#/definitions/environment_vars"
180
190
  },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dip
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.6
4
+ version: 8.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bibendi
@@ -231,6 +231,7 @@ files:
231
231
  - lib/dip/commands/infra/service.rb
232
232
  - lib/dip/commands/kubectl.rb
233
233
  - lib/dip/commands/list.rb
234
+ - lib/dip/commands/preflight.rb
234
235
  - lib/dip/commands/provision.rb
235
236
  - lib/dip/commands/run.rb
236
237
  - lib/dip/commands/runners/base.rb