Open ddmytrenko opened 1 month ago
Ok!
I have found the reason and fixed it locally. Plugin's shell script is wrong.
Current version:
#!/usr/bin/env bash
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
go build -o "$THIS_SCRIPT_DIR/_tmp/plugin"
"$THIS_SCRIPT_DIR/_tmp/plugin" $*
So, in the line 3 we are not in $THIS_SCRIPT_DIR
directory. Because the cd
command was local for the first $()
block. We have to change it explicitely:
#!/usr/bin/env bash
THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
go build -C "$THIS_SCRIPT_DIR" -o "./_tmp/plugin"
"$THIS_SCRIPT_DIR/_tmp/plugin" $*
Documentation:
go help build
-C dir
Change to dir before running the command.
Any files named on the command line are interpreted after
changing directories.
If used, this flag must be the first one in the command line.
Hi!
After installing the plugin using (lets call it installation step)
I cannot basically use it because of missing go.mod. Example command:
Output:
When I run the command from any git repository, I receive a bit different error:
So, I tried to run
go mod init
in plugin directory:Output:
A strange thing. There were no go.mod files in
/Users/username/.bitrise/plugins/io/src
directory after installation step.That's why I have also tried to clone the plugin repo manually to
/Users/username/.bitrise/plugins/io/src
. And if I run anybitrise :io
command from that particular directory - it works. If I switch back to the project directory it does not work:I have both bitrise-cli and go properly installed and set up.
Any ideas on how to fix it?
Thanks in advance! Best regards!