-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use gemspec executable (the only one or the first specified executable) as default gem entry point for tebako package #233
Comments
I keep looking at https://github.com/tamatebako/tebako?tab=readme-ov-file#packaging-scenarios-with-ruby and find it mostly confusing, mainly because I don't really know what combination is being used from that table, which leads to surprises. I think a better approach might be to instead use flags in the press method or have different press commands. For example, I'd like to give tebako a Gemfile and reference a binary in there like this: ruby "3.3.6"
source "https://rubygems.org"
gem "terminalwire", "~> 0.3.0.alpha" Then I'd want to run a command like this to generate my executable: $ tebako press -b Gemfile -e terminalwire-exec The Similarly, perhaps I could pass a gem or gem path into press: $ tebako press -g terminalwire -v "0.3.0.alpha1" -e terminalwire-exec Files might work like this: $ tebako press -b Gemfile -f my-one-off-script.rb -o my-app This approach would take a lot of the guess work and wondering out of how the binary is being built and probably yield better error messages for misconfigurations. |
IMHO there is nothing that is confusing in these rules. One does not need to be Ruby programmer or software engineer to understand them. I do not think that passing |
Frankly, I do not understand the message above Here follows a piece of real tebako log. Lines starting with
|
Thanks for listing that out! I think I can put together a
This can then be passed into
It gets confusing when what should be the same commands fails differently on different platforms. I currently have a # This works from macOS
$ tebako press -r gem/terminalwire -e terminalwire-exec -R 3.3.6 -o build/macos/amd64/bin/terminalwire-exec
Tebako executable packager version 0.12.1
No prefix specified, using ~/.tebako
Running tebako press at /Users/bradgessler/.tebako
Mode: 'bundle'
Ruby version: '3.3.6'
Project root: '/Users/bradgessler/Projects/terminalwire/ruby/gem/terminalwire'
Application entry point: 'terminalwire-exec'
Package file name: '/Users/bradgessler/Projects/terminalwire/ruby/build/macos/amd64/bin/terminalwire-exec'
Loging level: 'error'
Package working directory: '<Host current directory>'
# Lots of log messages ...
[ 94%] Building CXX object CMakeFiles/tebako-fs.dir/src/tebako-main.cpp.o
[ 94%] Building CXX object CMakeFiles/tebako-fs.dir/Users/bradgessler/.tebako/deps/src/tebako/tebako-fs.cpp.o
[100%] Linking CXX static library libtebako-fs.a
[100%] Built target tebako-fs
-- Running finalize script
... building tebako package
... @ make ruby -j12
... @ make -j12
Created tebako package at "/Users/bradgessler/Projects/terminalwire/ruby/build/macos/amd64/bin/terminalwire-exec"
[100%] Built target tebako But a similar command fails inside an Ubuntu Tebako container:
The log messages make sense, but the error messages don't because I don't understand how tebako arrives at different conclusions about the presence of `bin/terminalwire. I'm sure I'm doing something stupid or not interpreting the log files correctly, but that's true for most things in software development. |
I'm usually right when I say this 😂 I've worked out that when tebako builds this gem inside of a container, its running into this, which is the default Gem::Specification.new do |spec|
# code ...
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
ls.readlines("\x0", chomp: true).reject do |f|
(f == gemspec) ||
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
end
end
# code
end When I run this from irb inside the container, I get nothing back: root@0ac7b8e44b97:/host/gem/terminalwire# irb
irb(main):001:0> IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL).read
=> "" When I run from the host machine, I get something back: irb(main):023> IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL).read
=> ".env\u0000.github/workflows/Dockerfile\u0000.github/workflows/main.yml\u0000.gitignore\u0000.rspec\u0000Brewfile\u0000CHANGELOG.md\u0000CODE_OF_CONDUCT.md\u0000Gemfile\u0000Gemfile.lock\u0000LICENSE.txt\u0000README.md\u0000Rakefile\u0000bin/console\u0000bin/setup\u0000builder/build.sh\u0000builder/template/app/.gitkeep\u0000builder/template/bin/.gitkeep\u0000builder/template/lib/.gitkeep\u0000builder/template/lib/boot.rb\u0000builder/template/lib/boot.sh\u0000builder/template/vendor/.gitkeep\u0000examples/exec/localrails\u0000gem/terminalwire-client/lib/terminalwire-client.rb\u0000gem/terminalwire-client/lib/terminalwire/client.rb\u0000gem/terminalwire-client/lib/terminalwire/client/entitlement.rb\u0000gem/terminalwire-client/lib/terminalwire/client/entitlement/environment_variables.rb\u0000gem/terminalwire-client/lib/terminalwire/client/entitlement/paths.rb\u0000gem/terminalwire-client/lib/terminalwire/client/entitlement/policy.rb\u0000gem/terminalwire-client/lib/terminalwire/client/entitlement/schemes.rb\u0000gem/terminalwire-client/lib/terminalwire/client/exec.rb\u0000gem/terminalwire-client/lib/terminalwire/client/handler.rb\u0000gem/terminalwire-client/lib/terminalwire/client/resource.rb\u0000gem/terminalwire-client/lib/terminalwire/client/server_license_verification.rb\u0000gem/terminalwire-client/spec/entitlement/environment_variables_spec.rb\u0000gem/terminalwire-client/spec/entitlement/paths_spec.rb\u0000gem/terminalwire-client/spec/entitlement/policy_spec.rb\u0000gem/terminalwire-client/spec/entitlement/schemes_spec.rb\u0000gem/terminalwire-client/spec/entitlement_spec.rb\u0000gem/terminalwire-client/spec/resource_spec.rb\u0000gem/terminalwire-client/spec/spec_helper.rb\u0000gem/terminalwire-client/terminalwire-client.gemspec\u0000gem/terminalwire-core/lib/terminalwire-core.rb\u0000gem/terminalwire-core/lib/terminalwire.rb\u0000gem/terminalwire-core/lib/terminalwire/adapter.rb\u0000gem/terminalwire-core/lib/terminalwire/cache.rb\u0000gem/terminalwire-core/lib/terminalwire/logging.rb\u0000gem/terminalwire-core/lib/terminalwire/transport.rb\u0000gem/terminalwire-core/lib/terminalwire/version.rb\u0000gem/terminalwire-core/spec/cache_spec.rb\u0000gem/terminalwire-core/spec/spec_helper.rb\u0000gem/terminalwire-core/spec/terminalwire_spec.rb\u0000gem/terminalwire-core/terminalwire-core.gemspec\u0000gem/terminalwire-rails/lib/generators/terminalwire/install/USAGE\u0000gem/terminalwire-rails/lib/generators/terminalwire/install/install_generator.rb\u0000gem/terminalwire-rails/lib/generators/terminalwire/install/templates/application_terminal.rb.tt\u0000gem/terminalwire-rails/lib/generators/terminalwire/install/templates/bin/terminalwire\u0000gem/terminalwire-rails/lib/generators/terminalwire/install/templates/main_terminal.rb\u0000gem/terminalwire-rails/lib/terminalwire-rails.rb\u0000gem/terminalwire-rails/lib/terminalwire/rails.rb\u0000gem/terminalwire-rails/terminalwire-rails.gemspec\u0000gem/terminalwire-server/lib/terminalwire-server.rb\u0000gem/terminalwire-server/lib/terminalwire/server.rb\u0000gem/terminalwire-server/lib/terminalwire/server/context.rb\u0000gem/terminalwire-server/lib/terminairb(main):024> I'm pretty sure |
Running this from the container: $ git config --global --add safe.directory '*' And mounting the project root as a volume, with access to the git repo, results in a successful build. This is a bit brittle though because if the person running press doesn't have their git repo mounted, nothing will build. |
@bradgessler thank you for reporting this issue I suggest the following approach
If step 2 works and step 3 works but step 4 fails or step 5 fails it is tebako container or tebako issue. |
I'm confused about this step:
I searched through the list of tebako commands on the README.md and I'm not sure what it means to "enter container". My mental model for this is based on how Docker works, which means I'd run some sort of command like Is there a command I can run to "enter [a Tebako] container"? Or do I extract the contents of a tebako package somewhere, do a bunch of things to it, and then somehow package it back up? Thanks for any pointers on how I'd approach this 🙏 |
This response was generated by ChatGpt What Does It Mean to "Enter a Docker Container" and How to Do It?Entering a Docker container means accessing the environment inside the running container. This allows you to execute commands, inspect files, and debug processes directly within the container. Steps to Enter a Docker Container1. List Running ContainersTo identify the container you want to enter, list all currently running containers: docker ps This command will display a table of running containers with details such as CONTAINER ID, NAME, and status. 2. Use docker exec to Enter the ContainerOnce you know the CONTAINER ID or NAME, use the docker exec command to start an interactive shell session inside the container:
Replace
3. Use docker attach (Alternative)You can also attach directly to the main process of the container:
However, this method is less flexible and may inadvertently stop the container if you type exit. It's better suited for monitoring container output. 4. Access a Stopped ContainerIf the container is not running, start it first:
5.Exiting the ContainerFor |
@bradgessler I think @maxirmx was referring to the Tebako CI Containers which can be used to build Tebako packages. The relevant documentation is here: |
I think it's better if we force the user to define their executable because "choosing the first" is not a good solution. If there is one we can use it. If there are multiple then the user must choose? |
Originally posted by @ronaldtse in #215 (comment)
The text was updated successfully, but these errors were encountered: