github-action icon indicating copy to clipboard operation
github-action copied to clipboard

can not specify my git repository name in git_remote_url

Open skynocover opened this issue 4 years ago • 2 comments

Description of problem

I want to set the github-action, but always tell me git repository not appear.

I already set git repository on dokku and also set git remote url in local. The CICD works well, so I think I might make something wrong on yaml

How reproducible

My yaml setting is below

---
name: 'deploy'

on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Cloning repo
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Push to dokku
        uses: dokku/[email protected]
        with:
          git_remote_url: 'ssh://[email protected]/appname'            
          review_app_name: amber2                                   # fatal: '/amber2' does not appear to be a git repository
          ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

{dokku.ml} is my domain for dokku. {11.11.11.11} is my dokku server ip.

Actual Results

set the git_remote_url as 'ssh://[email protected]:22/amber2', and response

fatal: '/amber2' does not appear to be a git repository

set the git_remote_url as 'ssh://[email protected]:amber2', and response

fatal: Bad port 'amber2'

set the git_remote_url as '[email protected]/amber2', and response

fatal: '[email protected]/amber2' does not appear to be a git repository

set the git_remote_url as '[email protected]:22/amber2', and response

fatal: '22/amber2' does not appear to be a git repository

set the git_remote_url as '[email protected]:amber2', and response

Bad port 'amber2'

Expected Results

The repository should correct set on dokku. I think I do something wrong when I write the yaml.

Environment Information

git information

dokku@dokku:~$ dokku git:report amber2
=====> amber2 git information
       Git deploy branch:             master                   
       Git global deploy branch:      master                   
       Git keep git dir:              false                    
       Git rev env var:               GIT_REV                  
       Git sha:                                                
       Git last updated at:                                    

dokku report amber2 output

dokku@dokku:~ $ dokku report amber2
-----> uname: Linux dokku 5.8.0-1038-gcp #40~20.04.1-Ubuntu SMP Thu Jul 15 11:55:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
-----> memory: 
                     total        used        free      shared  buff/cache   available
       Mem:           1983        1023         172          16         788         789
       Swap:             0           0           0
-----> docker version: 
       Client: Docker Engine - Community
        Version:           20.10.7
        API version:       1.41
        Go version:        go1.13.15
        Git commit:        f0df350
        Built:             Wed Jun  2 11:56:38 2021
        OS/Arch:           linux/amd64
        Context:           default
        Experimental:      true
       
       Server: Docker Engine - Community
        Engine:
         Version:          20.10.7
         API version:      1.41 (minimum version 1.12)
         Go version:       go1.13.15
         Git commit:       b0f5bc3
         Built:            Wed Jun  2 11:54:50 2021
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          1.4.9
         GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
        runc:
         Version:          1.0.1
         GitCommit:        v1.0.1-0-g4144b63
        docker-init:
         Version:          0.19.0
         GitCommit:        de40ad0
-----> docker daemon info: 
       Client:
        Context:    default
        Debug Mode: true
        Plugins:
         app: Docker App (Docker Inc., v0.9.1-beta3)
         buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
         scan: Docker Scan (Docker Inc., v0.8.0)
       
       Server:
        Containers: 8
         Running: 5
         Paused: 0
         Stopped: 3
        Images: 49
        Server Version: 20.10.7
        Storage Driver: overlay2
         Backing Filesystem: extfs
         Supports d_type: true
         Native Overlay Diff: true
         userxattr: false
        Logging Driver: json-file
        Cgroup Driver: cgroupfs
        Cgroup Version: 1
        Plugins:
         Volume: local
         Network: bridge host ipvlan macvlan null overlay
         Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
        Swarm: inactive
        Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: e25210fe30a0a703442421b0f60afac609f950a3
        runc version: v1.0.1-0-g4144b63
        init version: de40ad0
        Security Options:
         apparmor
         seccomp
          Profile: default
        Kernel Version: 5.8.0-1038-gcp
        Operating System: Ubuntu 20.04.2 LTS
        OSType: linux
        Architecture: x86_64
        CPUs: 2
        Total Memory: 1.937GiB
        Name: dokku
        ID: NX5U:4USB:H5U6:4B6C:L3RZ:3Q3Y:S7CX:2V5W:EM6F:GTWM:L3LP:6HSH
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
        Registry: https://index.docker.io/v1/
        Labels:
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false
       
-----> git version: git version 2.25.1
-----> sigil version: 0.6.0
-----> herokuish version: 
       herokuish: 0.5.29
       buildpacks:
         heroku-buildpack-multi     v1.0.0
         heroku-buildpack-ruby      v228
         heroku-buildpack-nodejs    v185
         heroku-buildpack-clojure   v87
         heroku-buildpack-python    v197
         heroku-buildpack-java      v69
         heroku-buildpack-gradle    v35
         heroku-buildpack-scala     v90
         heroku-buildpack-play      v26
         heroku-buildpack-php       v195
         heroku-buildpack-go        v153
         buildpack-nginx            v14
         buildpack-null             v3
-----> dokku version: dokku version 0.24.10
-----> plugn version: plugn: 0.6.1
-----> dokku plugins: 
         00_dokku-standard    0.24.10 enabled    dokku core standard plugin
         20_events            0.24.10 enabled    dokku core events logging plugin
         app-json             0.24.10 enabled    dokku core app-json plugin
         apps                 0.24.10 enabled    dokku core apps plugin
         builder              0.24.10 enabled    dokku core builder plugin
         builder-dockerfile   0.24.10 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.24.10 enabled    dokku core builder-herokuish plugin
         builder-pack         0.24.10 enabled    dokku core builder-pack plugin
         buildpacks           0.24.10 enabled    dokku core buildpacks plugin
         certs                0.24.10 enabled    dokku core certificate management plugin
         checks               0.24.10 enabled    dokku core checks plugin
         common               0.24.10 enabled    dokku core common plugin
         config               0.24.10 enabled    dokku core config plugin
         cron                 0.24.10 enabled    dokku core cron plugin
         docker-options       0.24.10 enabled    dokku core docker-options plugin
         domains              0.24.10 enabled    dokku core domains plugin
         enter                0.24.10 enabled    dokku core enter plugin
         git                  0.24.10 enabled    dokku core git plugin
         letsencrypt          0.12.1 enabled    Automated installation of let's encrypt TLS certificates
         logs                 0.24.10 enabled    dokku core logs plugin
         network              0.24.10 enabled    dokku core network plugin
         nginx-vhosts         0.24.10 enabled    dokku core nginx-vhosts plugin
         plugin               0.24.10 enabled    dokku core plugin plugin
         postgres             1.12.0 enabled    dokku postgres service plugin
         proxy                0.24.10 enabled    dokku core proxy plugin
         ps                   0.24.10 enabled    dokku core ps plugin
         redis                1.15.0 enabled    dokku redis service plugin
         repo                 0.24.10 enabled    dokku core repo plugin
         resource             0.24.10 enabled    dokku core resource plugin
         scheduler-docker-local 0.24.10 enabled    dokku core scheduler-docker-local plugin
         shell                0.24.10 enabled    dokku core shell plugin
         ssh-keys             0.24.10 enabled    dokku core ssh-keys plugin
         storage              0.24.10 enabled    dokku core storage plugin
         tags                 0.24.10 enabled    dokku core tags plugin
         tar                  0.24.10 enabled    dokku core tar plugin
         trace                0.24.10 enabled    dokku core trace plugin
=====> amber2 app information
       App deploy source:             
       App dir:                       /home/dokku/amber2
       App locked:                    false
=====> amber2 builder information
       Builder computed selected:     
       Builder global selected:       
       Builder selected:              
=====> amber2 buildpacks information
       Buildpacks computed stack:     gliderlabs/herokuish:latest
       Buildpacks global stack:       
       Buildpacks list:               
       Buildpacks stack:              
=====> amber2 ssl information
       Ssl dir:                       /home/dokku/amber2/tls   
       Ssl enabled:                   false                    
       Ssl hostnames:                                          
       Ssl expires at:                                         
       Ssl issuer:                                             
       Ssl starts at:                                          
       Ssl subject:                                            
       Ssl verified:                                           
=====> amber2 checks information
       Checks disabled list:          none                     
       Checks skipped list:           none                     
=====> amber2 cron information
       Cron task count:               0
=====> amber2 docker options information
       Docker options build:                                   
       Docker options deploy:         --restart=on-failure:10  
       Docker options run:                                     
=====> amber2 domains information
       Domains app enabled:           true                     
       Domains app vhosts:            amber2.dokku.ml   
       Domains global enabled:        true                     
       Domains global vhosts:         dokku.ml          
=====> amber2 git information
       Git deploy branch:             master                   
       Git global deploy branch:      master                   
       Git keep git dir:              false                    
       Git rev env var:               GIT_REV                  
       Git sha:                                                
       Git last updated at:                                    
=====> amber2 logs information
       Logs computed max size:        10m
       Logs global max size:          10m
       Logs global vector sink:       
       Logs max size:                 
       Logs vector sink:              
=====> amber2 network information
       Network attach post create:    
       Network attach post deploy:    
       Network bind all interfaces:   false
       Network web listeners:         172.17.0.6:5000
=====> amber2 nginx information
       Nginx access log format:                                
       Nginx access log path:         /var/log/nginx/amber2-access.log
       Nginx bind address ipv4:                                
       Nginx bind address ipv6:       ::                       
       Nginx client max body size:                             
       Nginx disable custom config:   false                    
       Nginx error log path:          /var/log/nginx/amber2-error.log
       Nginx global hsts:             true                     
       Nginx computed hsts:           true                     
       Nginx hsts:                                             
       Nginx hsts include subdomains: true                     
       Nginx hsts max age:            15724800                 
       Nginx hsts preload:            false                    
       Nginx proxy buffer size:       4096                     
       Nginx proxy buffering:         on                       
       Nginx proxy buffers:           8 4096                   
       Nginx proxy busy buffers size: 8192                     
       Nginx proxy read timeout:      60s                      
       Nginx last visited at:         1628309201               
       Nginx x forwarded for value:   $remote_addr             
       Nginx x forwarded port value:  $server_port             
       Nginx x forwarded proto value: $scheme                  
       Nginx x forwarded ssl:                                  
=====> amber2 proxy information
       Proxy enabled:                 true
       Proxy port map:                http:80:5000
       Proxy type:                    nginx
=====> amber2 ps information
       Deployed:                      true
       Processes:                     1
       Ps can scale:                  true
       Ps restart policy:             on-failure:10
       Restore:                       true
       Running:                       true
       Status web 1:                  running (CID: 5a2f3cf0e6f)
=====> amber2 resource information
=====> amber2 scheduler-docker-local information
       Scheduler docker local disable chown:                          
=====> amber2 storage information
       Storage build mounts:                                   
       Storage deploy mounts:                                  
       Storage run mounts:                                     

How (deb/make/rpm) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:

I run the dokku on GCP. Use command to install

 wget https://raw.githubusercontent.com/dokku/dokku/v0.24.10/bootstrap.sh
 sudo DOKKU_TAG=v0.24.10 bash bootstrap.sh

If there is anything else information I should provide, please let me know, I will reply as soon as possible. Thank you.

English is not my native language; please excuse typing errors.

skynocover avatar Aug 07 '21 04:08 skynocover

Very late but I had this problem as well. The issue for me was that the repo is not located in "/" on the server. If you're using the default setup then the git remote url should be something like:

ssh://dokku@IP:22/~/MYREPO

Note the ~ to use the home directory

mskog avatar Jan 04 '22 13:01 mskog

@mskog This saved me. Thank you!

savethebyte avatar Jan 24 '22 06:01 savethebyte

Can confirm the example-workflows/build-and-deploy.yml may require a change to work out of the box , needing the home page ~/ as @mskog describes.

To reproduce the issue I've created the following example repo with a corrected git_remote_url:

https://github.com/chrisjsimpson/dokku-action-deploy-minimal/blob/6c886c4cc2358343893c55aa001a9d1311698830/.github/workflows/deploy.yaml#L25

Where

  • DOKKU_HOST is the domain or ip of your dokku server (e.g. example.com or ip e.g 10.0.0.1)
  • DOKKU_APP_NAME is the APP_NAME

Note it is also required to run dokku apps:create APP_NAME manually on the server before running the Github action.

Tested on:

dokku --version
dokku version 0.27.8

chrisjsimpson avatar Nov 01 '22 23:11 chrisjsimpson

@chrisjsimpson would you be willing to try a version that turned on debug mode so I can see what the exact ssh command is thats being executed? I can't ever seem to replicate this bug but others can.

josegonzalez avatar Nov 01 '22 23:11 josegonzalez

@josegonzalez Sure I've contacted you out of bound with debug mode info :+1:

chrisjsimpson avatar Nov 01 '22 23:11 chrisjsimpson

@skynocover please re-open this as it's still being looked at see comment from @josegonzalez

chrisjsimpson avatar Nov 02 '22 19:11 chrisjsimpson

Hi @josegonzalez at your convenience, please may you confirm you received the debug output? (subject: trace logs for: can not specify my git repository name in git_remote_url)

chrisjsimpson avatar Nov 03 '22 18:11 chrisjsimpson

I've added a trace mode option to this action. If someone having this issue can post the output of trying the git_remote_url in the format ssh://[email protected]:22/appname and set trace: 1 in their job step, that would be excellent. My guess is that somehow the parsing we do of the host is broken for some reason.

@chrisjsimpson can you retry sending it, I haven't had a chance to look as I've been sick over the past month :(

josegonzalez avatar Dec 01 '22 04:12 josegonzalez

I ran into this problem as well. And as mentioned above, specifying the path as /~/appname works. Without it, here are some relevant snippets from the log (let me know if you need more):

ssh_remote=ssh://dokku@:22 [...] log-info 'Pushing to Dokku Host'

  • git push --force ssh://dokku@:22/ :refs/heads/master

Pushing to Dokku Host fatal: '/' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Running that same command from the repo locally works.

I've seen another format: [email protected]:appname (i.e., git push [email protected]:appname). However, that one fails since the appname is treated as the port here.

log-info 'Generating SSH_HOST_KEY from ssh-keyscan against :'

  • ssh-keyscan -H -p

Generating SSH_HOST_KEY from ssh-keyscan against : Bad port ''

mschoettle avatar Dec 16 '22 12:12 mschoettle

Okay based on a question in discord, it seems like maybe the problem is that some of ya'll have bad entries in your /home/dokku/.ssh/authorized_keys file. For anyone that has the issue where they need to prefix their entry with ~/ or use a full path, can you check to see if there are any entries in the /home/dokku/.ssh/authorized_keys file that do not have a prefix of command=?

Each entry in /home/dokku/.ssh/authorized_keys must have that in order for Dokku's ssh handling to work, otherwise you are circumventing our ssh hook and thats why you need to use the full path (or something similar). The user on discord had their key twice, the first time without the command= prefix, and the second time with it. Once they removed the bad entry, things worked as expected.

If your SSH public key is only in there once and its only setup incorrectly, please add an ssh key as noted here instead of manually adding to that file.

josegonzalez avatar Dec 28 '22 21:12 josegonzalez

I'm going to close this. I am pretty sure this is related to how folks are setting their SSH keys. If anyone sees this again, please file a new ticket.

josegonzalez avatar Mar 10 '23 18:03 josegonzalez