diff --git a/CHANGELOG.md b/CHANGELOG.md index 4910d66a..d252de09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,13 +14,19 @@ Changes since the last non-beta release. _Please add entries here for your pull requests that have not yet been released._ +## [4.1.0] - 2024-12-17 + ### Fixed - Fixed issue where `run` command fails when runner workload has ENV but original workload does not. [PR 227](https://github.com/shakacode/control-plane-flow/pull/227) by [Rafael Gomes](https://github.com/rafaelgomesxyz). - - Fixed potential infinite loop that could occur for a command if one of the execution steps fails and gets stuck. [PR 217](https://github.com/shakacode/control-plane-flow/pull/217) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr). - - Fixed issue where app cannot be deleted because one of the workloads has a volumeset in-use. [PR 245](https://github.com/shakacode/control-plane-flow/pull/245) by [Zakir Dzhamaliddinov](https://github.com/zzaakiirr). +- Fixed `resolv` may be not properly required [PR 250](https://github.com/shakacode/control-plane-flow/pull/250) by [Sergey Tarasov](https://github.com/dzirtusss). + +### Added + +- Added `--docker-context` option to `build-image` command. [PR 250](https://github.com/shakacode/control-plane-flow/pull/250) by [Sergey Tarasov](https://github.com/dzirtusss). + ### Changed @@ -274,7 +280,8 @@ Deprecated `cpl` gem. New gem is `cpflow`. First release. -[Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v4.0.0...HEAD +[Unreleased]: https://github.com/shakacode/control-plane-flow/compare/v4.1.0...HEAD +[4.1.0]: https://github.com/shakacode/control-plane-flow/compare/v4.0.0...v4.1.0 [4.0.0]: https://github.com/shakacode/control-plane-flow/compare/v3.0.1...v4.0.0 [3.0.1]: https://github.com/shakacode/control-plane-flow/compare/v3.0.0...v3.0.1 [3.0.0]: https://github.com/shakacode/control-plane-flow/compare/v2.2.4...v3.0.0 diff --git a/Gemfile.lock b/Gemfile.lock index 78bec0b6..1fdcdd83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cpflow (4.0.1) + cpflow (4.1.0) dotenv (~> 2.8.1) jwt (~> 2.8.1) psych (~> 5.1.0) diff --git a/lib/command/base.rb b/lib/command/base.rb index 54a16f1b..9a1fe746 100644 --- a/lib/command/base.rb +++ b/lib/command/base.rb @@ -443,6 +443,17 @@ def self.add_app_identity_option(required: false) } end + def self.docker_context_option + { + name: :docker_context, + params: { + desc: "Path to the docker build context directory", + type: :string, + required: false + } + } + end + def self.use_digest_ref_option(required: false) { name: :use_digest_ref, diff --git a/lib/command/build_image.rb b/lib/command/build_image.rb index 6a75c509..6d56402a 100644 --- a/lib/command/build_image.rb +++ b/lib/command/build_image.rb @@ -5,7 +5,8 @@ class BuildImage < Base NAME = "build-image" OPTIONS = [ app_option(required: true), - commit_option + commit_option, + docker_context_option ].freeze ACCEPTS_EXTRA_OPTIONS = true DESCRIPTION = "Builds and pushes the image to Control Plane" @@ -34,9 +35,12 @@ def call # rubocop:disable Metrics/MethodLength build_args = [] build_args.push("GIT_COMMIT=#{commit}") if commit + docker_context = config.options[:docker_context] || config.app_dir + cp.image_build(image_url, dockerfile: dockerfile, docker_args: config.args, - build_args: build_args) + build_args: build_args, + docker_context: docker_context) push_path = "/org/#{config.org}/image/#{image_name}" diff --git a/lib/command/deploy_image.rb b/lib/command/deploy_image.rb index 16ec07b0..081ed4a1 100644 --- a/lib/command/deploy_image.rb +++ b/lib/command/deploy_image.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "resolv" + module Command class DeployImage < Base NAME = "deploy-image" diff --git a/lib/core/controlplane.rb b/lib/core/controlplane.rb index 601bd032..e1665a03 100644 --- a/lib/core/controlplane.rb +++ b/lib/core/controlplane.rb @@ -90,7 +90,7 @@ def query_images(a_gvc = gvc, a_org = org, partial_gvc_match: nil) api.query_images(org: a_org, gvc: a_gvc, gvc_op_type: gvc_op) end - def image_build(image, dockerfile:, docker_args: [], build_args: []) + def image_build(image, dockerfile:, docker_context:, docker_args: [], build_args: []) # https://docs.controlplane.com/guides/push-image#step-2 # Might need to use `docker buildx build` if compatiblitity issues arise cmd = "docker build --platform=linux/amd64 -t #{image} -f #{dockerfile}" @@ -98,7 +98,7 @@ def image_build(image, dockerfile:, docker_args: [], build_args: []) cmd += " #{docker_args.join(' ')}" if docker_args.any? build_args.each { |build_arg| cmd += " --build-arg #{build_arg}" } - cmd += " #{config.app_dir}" + cmd += " #{docker_context}" perform!(cmd) end diff --git a/lib/cpflow/version.rb b/lib/cpflow/version.rb index b42c4a5e..d224a513 100644 --- a/lib/cpflow/version.rb +++ b/lib/cpflow/version.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Cpflow - VERSION = "4.0.1" + VERSION = "4.1.0" MIN_CPLN_VERSION = "3.1.0" end