Giter Club home page Giter Club logo

Comments (6)

ahaywood avatar ahaywood commented on June 21, 2024 1

@hjalmarhoglund Thanks for reporting this. I'm going to tag in another team member who specializes in deployment and will get back o you!

from redwood.

Josh-Walker-GM avatar Josh-Walker-GM commented on June 21, 2024 1

Thanks for testing this so quickly! I agree we've messed up and introduced an even worse error! I'll get a fix and patch out again for this today

from redwood.

Josh-Walker-GM avatar Josh-Walker-GM commented on June 21, 2024

Hey @hjalmarhoglund, would you mind trying out v7.6.1 and confirm that the fix works?

from redwood.

hjalmarhoglund avatar hjalmarhoglund commented on June 21, 2024

Hey @Josh-Walker-GM! Sure, I've upgraded and tested deploying. I believe another error has been introduced. This time, the error affects both the verbose and the none-verbose baremetal deploys.

Running,

yarn rw deploy baremetal production --verbose

gives the output

...
[STARTED] Cloning `main` branch...
SshExecutor::exec running command `gitclone --branch=main --depth=1 [email protected]:hjalmarhoglund/myapp.git 20240522150326` in /var/www/myapp
[FAILED] Error while running command `gitclone --branch=main --depth=1 [email protected]:hjalmarhoglund/myapp.git 20240522150326` in /var/www/myapp
[FAILED] bash: line 1: gitclone: command not found

Running,

yarn rw deploy baremetal production

gives the output

Error while running command `gitclone --branch=main --depth=1 [email protected]:hjalmarhoglund/myapp.git 20240522150713` in /var/www/myapp
bash: line 1: gitclone: command not found
...

The problem

The problem is that git clone [...] becomes gitclone [...].

Looking at the new code for SshExecutor.js we find on lines 13 and 14,

const argsString = args?.join(' ') || ''
const sshCommand = command + argsString

which does not correctly set a space between the command and the first arg.

Proposed fix

I think this could be solved by changing line 13 to:

const argsString = args ? ' ' + args.join(' ') : ''

Testing this in a local Node.js v20.11.1 session:

function testFix(command, args) {
    const argsString = args ? ' ' + args.join(' ') : ''
    const sshCommand = command + argsString
    // See what we end up with
    console.log(sshCommand)
}
const command = 'git'
const args1 = ['clone', '--branch=main']
const args2 = undefined
// Now running the proposed expression of argsString towards both args1 and args2
testFix(command, args1)
testFix(command, args2)

Gives the output

git clone --branch=main
git

Testing if this solves deploying

I try implementing my fix into node_modules/@redwoodjs/cli/dist/commands/deploy/baremetal/SshExecutor.js and run the deploy scripts, both verbose and non-verbose. For me, everything works.

...
async exec(path, command, args) {
    //const argsString = args?.join(" ") || "";
    const argsString = args ? ' ' + args.join(' ') : ''
    const sshCommand = command + argsString;
...

Hope this is of help, and thank you for getting to this as quickly as you did! Let me know if you want me to test anything again.

from redwood.

Josh-Walker-GM avatar Josh-Walker-GM commented on June 21, 2024

Okay v7.6.2 is out with the further fix. Hopefully we didn't break it even more haha!

from redwood.

hjalmarhoglund avatar hjalmarhoglund commented on June 21, 2024

Fantastic! I've tested deploying on v7.6.2. Both verbose and non-verbose works like a charm!

from redwood.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.