0

I am new to gitlab-ci and learning it. I am trying to push my deb package on remote server. I am able to do it when I am running individual commands mentioned in gitlab-ci.yml manually in ubunty/debian docker container. The deb package shows up in the remote server.

But when trying to do it on gitlab-ci then it show me the this error:

Loading packages...
[!] Unable to read file release-1.0.25.deb: unsupported tar compression in release-1.0.25.deb: control.tar.zst
ERROR: some files failed to be added
[!] Some files were skipped due to errors:
  release-1.0.25.deb
ECHO sudo aptly snapshot create release-1.0.25-unstable_2022.12.13-05.56.24 from repo unstable
Snapshot release-1.0.25-unstable_2022.12.13-05.56.24 successfully created.
You can run 'aptly publish snapshot release-1.0.25-unstable_2022.12.13-05.56.24' to publish snapshot as Debian repository.
ECHO sudo aptly publish -passphrase=abc switch xenial release-1.0.25-unstable_2022.12.13-05.56.24
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
gpg: cannot open tty `/dev/tty': No such device or address
ERROR: unable to publish: unable to detached sign file: exit status 2
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

Here is the part of gitlab-ci.yml which pushes the code to remote:

publish to remote:
  stage: publish-to-remote
  image: debian:latest
  before_script:
    - apt-get update 
    - apt-get install sshpass -y
    - apt-get install aptly -y
    - apt-get install sudo -y
  script:
     - sshpass -p abc ssh -oStrictHostKeyChecking=no abc@something.com mkdir -p /home/
     - md5sum build/$DebFileName.deb
     - sshpass -p abc scp -oStrictHostKeyChecking=no build/$DebFileName.deb abc@something.com:/home/
     - chmod +x ./publishToRemote.sh
     - ./publishToRemote.sh

I have this thing in my publishToRemote.sh

echo "making time"
file_name=release-1.0.25
current_time=$(date "+%Y.%m.%d-%H.%M.%S")

sshpass -p abc ssh -t -oStrictHostKeyChecking=no abc@something.com '
echo "doing cd"
cd /home/

echo "ECHO sudo aptly repo add unstable '$file_name'.deb"
sudo aptly repo add unstable '$file_name'.deb

echo "ECHO sudo aptly snapshot create '$file_name'-unstable_'$current_time' from repo unstable"
sudo aptly snapshot create '$file_name'-unstable_'$current_time' from repo unstable

echo "ECHO sudo aptly publish -passphrase=abc switch xenial '$file_name'-unstable_'$current_time'"
sudo aptly admin -passphrase=abc switch xenial '$file_name'-unstable_'$current_time'

To resolve this, I downloaded the deb package made by gitlab-ci and tried to untar it manually on mac, it is getting untared properly. But when I am trying to do it on the remote server it shows the same thing. I also check the md5sum of the deb file before the scp and then on the server(manually) after the scp. And they both are same, so there is no issue in the integrity of the deb file.

Any pointers would be very helpful!!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.