Cleaning up file based variables. ERROR: Job failed: exit code 1

Viewed 2703

I am using gitlab-ci to automate build and release. In the last job, I want to upload the artifacts to a remote server using lftp.

$(pwd)/publish/ address is the artifacts that were generated in the previous job. And all variables declared in the gitlab Settings --> CI / CD.

This the job yaml code:

upload-job:
    stage: upload
    image: mwienk/docker-lftp:latest
    tags:
        - dotnet
    only:
        - master
    script:
        - lftp -e "open $HOST; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete $(pwd)/publish/ wwwroot/; bye"

Note that lftp transfers my files, however, I'm not sure all of my files are transferred.

I added echo "All files Transfered." but it never runs.

There is no error and warning in the pipeline log but I got the following error:

enter image description here

I don't know what is it for. Have anyone faced the error and have found any solution?

1 Answers

Finally, I solved the problem by some changes in lft command parameters.

The point in troubleshooting ERROR: Job failed: exit code 1 is that to use commands with the verbose parameter that return sufficient log to enable you to troubleshoot the problem. Another important point is to know how to debug shell scripts such as bash, powershell, or etc.

Also, you can run and test commands directly in a shell, it is helpful.

The following links are helpful to troubleshoot command-line scripts:

How to debug a bash script?

5 Simple Steps On How To Debug a Bash Shell Script

Use the PowerShell Debugger to Troubleshoot Scripts

For lftp logging:

How to enable lftp protocol logging?

Related