Skip to content

Commit

Permalink
Merge branch 'main' of github.com:shakacode/control-plane-flow into 2…
Browse files Browse the repository at this point in the history
…32-use-image-digest-on-promotion-from-upstream
  • Loading branch information
zzaakiirr committed Dec 18, 2024
2 parents 083ea58 + 44de9a7 commit 46d5c60
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
11 changes: 11 additions & 0 deletions lib/command/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions lib/command/build_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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}"

Expand Down
2 changes: 2 additions & 0 deletions lib/command/deploy_image.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "resolv"

module Command
class DeployImage < Base
NAME = "deploy-image"
Expand Down
4 changes: 2 additions & 2 deletions lib/core/controlplane.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ 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}"
cmd += " --progress=plain" if ControlplaneApiDirect.trace

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
Expand Down
2 changes: 1 addition & 1 deletion lib/cpflow/version.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 46d5c60

Please sign in to comment.