mirror of
https://github.com/czhu12/canine.git
synced 2025-12-30 15:49:54 -06:00
revert buildcloud
This commit is contained in:
@@ -6,8 +6,6 @@ require 'ostruct'
|
||||
module Builders
|
||||
class BuildCloud < Builders::Base
|
||||
include K8::Kubeconfig
|
||||
include Builders::Concerns::BuildpackBuilder
|
||||
|
||||
attr_reader :build_cloud_manager
|
||||
|
||||
def initialize(build, build_cloud_manager)
|
||||
@@ -26,43 +24,6 @@ module Builders
|
||||
def build_image(repository_path)
|
||||
@build_cloud_manager.create_local_builder!
|
||||
|
||||
if project.build_configuration.buildpacks?
|
||||
build_with_buildpacks_on_k8s(repository_path)
|
||||
else
|
||||
build_with_dockerfile_on_k8s(repository_path)
|
||||
end
|
||||
end
|
||||
|
||||
def kubeconfig
|
||||
build_cloud_manager.connection.kubeconfig
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Pack publishes during build with --publish flag
|
||||
def publish_during_build?
|
||||
true
|
||||
end
|
||||
|
||||
# Override to run pack command with KUBECONFIG
|
||||
def run_pack_command(command)
|
||||
runner = Cli::RunAndLog.new(build, killable: build)
|
||||
with_kube_config do |kubeconfig_file|
|
||||
# TODO: Verify pack works with k8s builder context
|
||||
# Pack uses docker daemon directly, may need additional configuration
|
||||
# to work with kubernetes builders
|
||||
runner.call(command, envs: { "KUBECONFIG" => kubeconfig_file.path })
|
||||
end
|
||||
rescue Cli::CommandFailedError => e
|
||||
raise Projects::BuildJob::BuildFailure, "Pack build failed: #{e.message}"
|
||||
end
|
||||
|
||||
def build_with_buildpacks_on_k8s(repository_path)
|
||||
build.info("Note: Using pack with Kubernetes builder", color: :yellow)
|
||||
build_with_buildpacks(repository_path)
|
||||
end
|
||||
|
||||
def build_with_dockerfile_on_k8s(repository_path)
|
||||
command = construct_buildx_command(project, repository_path)
|
||||
runner = Cli::RunAndLog.new(build, killable: build)
|
||||
with_kube_config do |kubeconfig_file|
|
||||
@@ -70,6 +31,10 @@ module Builders
|
||||
end
|
||||
end
|
||||
|
||||
def kubeconfig
|
||||
build_cloud_manager.connection.kubeconfig
|
||||
end
|
||||
|
||||
def construct_buildx_command(project, repository_path)
|
||||
command = [ "docker", "buildx", "build" ]
|
||||
command += [ "--builder", build_cloud_manager.build_cloud.name ]
|
||||
@@ -96,4 +61,4 @@ module Builders
|
||||
command
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user