dokku/dokku

`git:sync` fails with “trying to write non-commit object”

AndrewKvalheim opened this issue · 5 comments

Description of problem

I initially deployed an app by manually pushing, then switched to Ansible using dokku_clone. Its dokku git:sync fails with:

cannot update ref 'refs/heads/main': trying to write non-commit object [hash of annotated tag] to branch 'refs/heads/main'

Steps to reproduce

  1. Create an app:

    $ dokku apps:create 'dmarc'
    $ dokku builder:set 'dmarc' selected 'null'
  2. Deploy via git push:

    $ git clone 'https://github.com/AndrewKvalheim/dmarc-report-notifier.git' && cd 'dmarc-report-notifier'
    $ git remote add 'dokku' 'dokku@dokku:dmarc'
    $ git push 'dokku' 'v1.1.4^{commit}:refs/heads/main'
    To dokku:dmarc
     * [new branch]      v1.1.4^{commit} -> main
    $ git push 'dokku' 'v1.1.5^{commit}:refs/heads/main'
    To dokku:dmarc
       c3da094..8283362  v1.1.5^{commit} -> main
  3. Deploy via dokku git:sync:

    $ dokku git:sync 'dmarc' 'https://github.com/AndrewKvalheim/dmarc-report-notifier.git' 'v1.1.5'
    From https://github.com/AndrewKvalheim/dmarc-report-notifier
    * [new tag]         v1.0.0     -> v1.0.0
    * [new tag]         v1.1.0     -> v1.1.0
    * [new tag]         v1.1.1     -> v1.1.1
    * [new tag]         v1.1.2     -> v1.1.2
    * [new tag]         v1.1.3     -> v1.1.3
    * [new tag]         v1.1.4     -> v1.1.4
    * [new tag]         v1.1.5     -> v1.1.5
    + git update-ref refs/heads/main v1.1.5
    fatal: update_ref failed for ref 'refs/heads/main': cannot update ref 'refs/heads/main': trying to write non-commit object a8747d64ce649ce8e78ecd062e34593c07fcab79 to branch 'refs/heads/main'

Additional information

Perhaps the update-ref should be dereferencing annotated tags?

dokku report

dokku report $APP_NAME

$ dokku report 'dmarc'
-----> uname: Linux ubuntu2204.localdomain 5.15.0-101-generic #111-Ubuntu SMP Tue Mar 5 20:16:58 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
                      total        used        free      shared  buff/cache   available
       Mem:            1963         263         123           2        1576        1505
       Swap:           2047          14        2033
-----> docker version:
       Client: Docker Engine - Community
        Version:           25.0.4
        API version:       1.44
        Go version:        go1.21.8
        Git commit:        1a576c5
        Built:             Wed Mar  6 16:32:12 2024
        OS/Arch:           linux/amd64
        Context:           default

       Server: Docker Engine - Community
        Engine:
         Version:          25.0.4
         API version:      1.44 (minimum version 1.24)
         Go version:       go1.21.8
         Git commit:       061aa95
         Built:            Wed Mar  6 16:32:12 2024
         OS/Arch:          linux/amd64
         Experimental:     false
        containerd:
         Version:          1.6.28
         GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
        runc:
         Version:          1.1.12
         GitCommit:        v1.1.12-0-g51d5e94
        docker-init:
         Version:          0.19.0
         GitCommit:        de40ad0
-----> docker daemon info:
       Client: Docker Engine - Community
        Version:    25.0.4
        Context:    default
        Debug Mode: true
        Plugins:
         buildx: Docker Buildx (Docker Inc.)
           Version:  v0.13.0
           Path:     /usr/libexec/docker/cli-plugins/docker-buildx
         compose: Docker Compose (Docker Inc.)
           Version:  v2.24.7
           Path:     /usr/libexec/docker/cli-plugins/docker-compose

       Server:
        Containers: 0
         Running: 0
         Paused: 0
         Stopped: 0
        Images: 2
        Server Version: 25.0.4
        Storage Driver: overlay2
         Backing Filesystem: extfs
         Supports d_type: true
         Using metacopy: false
         Native Overlay Diff: true
         userxattr: false
        Logging Driver: json-file
        Cgroup Driver: systemd
        Cgroup Version: 2
        Plugins:
         Volume: local
         Network: bridge host ipvlan macvlan null overlay
         Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
        Swarm: inactive
        Runtimes: runc io.containerd.runc.v2
        Default Runtime: runc
        Init Binary: docker-init
        containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
        runc version: v1.1.12-0-g51d5e94
        init version: de40ad0
        Security Options:
         apparmor
         seccomp
          Profile: builtin
         cgroupns
        Kernel Version: 5.15.0-101-generic
        Operating System: Ubuntu 22.04.4 LTS
        OSType: linux
        Architecture: x86_64
        CPUs: 2
        Total Memory: 1.918GiB
        Name: ubuntu2204.localdomain
        ID: 7f842350-8cf8-463e-9b26-fea532006d03
        Docker Root Dir: /var/lib/docker
        Debug Mode: false
         File Descriptors: 23
         Goroutines: 46
         System Time: 2024-03-18T17:39:00.595345772Z
         EventsListeners: 0
        Experimental: false
        Insecure Registries:
         127.0.0.0/8
        Live Restore Enabled: false

-----> herokuish version:
       herokuish: v0.7.3
       buildpacks:
         heroku-buildpack-multi     v1.2.0
         heroku-buildpack-ruby      v265
         heroku-buildpack-nodejs    v235
         heroku-buildpack-clojure   v91
         heroku-buildpack-python    v242
         heroku-buildpack-java      v73
         heroku-buildpack-gradle    v39
         heroku-buildpack-scala     v96
         heroku-buildpack-play      v26
         heroku-buildpack-php       v244
         heroku-buildpack-go        v184
         heroku-buildpack-nginx     v25
         buildpack-null             v3
-----> dokku version: dokku version 0.33.9
-----> dokku-event-listener version: 0.15.0build+5268732
-----> dokku-update version: dokku-update 0.7.2
-----> docker-container-healthchecker version: 0.9.0
-----> docker-image-labeler version: 0.6.1build+c6e15a9
-----> git version: git version 2.34.1
-----> lambda-builder version:        0.6.0
-----> netrc version: 0.8.0build+0751c1b
 !     pack binary is not available
-----> plugn version: plugn: 0.13.0build+fd5297a
-----> sigil version: 0.10.1build+e443be0
-----> sshcommand version: sshcommand 0.17.1
-----> dokku plugins:
         00_dokku-standard    0.33.9 enabled    dokku core standard plugin
         20_events            0.33.9 enabled    dokku core events logging plugin
         app-json             0.33.9 enabled    dokku core app-json plugin
         apps                 0.33.9 enabled    dokku core apps plugin
         builder              0.33.9 enabled    dokku core builder plugin
         builder-dockerfile   0.33.9 enabled    dokku core builder-dockerfile plugin
         builder-herokuish    0.33.9 enabled    dokku core builder-herokuish plugin
         builder-lambda       0.33.9 enabled    dokku core builder-lambda plugin
         builder-nixpacks     0.33.9 enabled    dokku core builder-nixpacks plugin
         builder-null         0.33.9 enabled    dokku core builder-null plugin
         builder-pack         0.33.9 enabled    dokku core builder-pack plugin
         buildpacks           0.33.9 enabled    dokku core buildpacks plugin
         caddy-vhosts         0.33.9 enabled    dokku core caddy-vhosts plugin
         certs                0.33.9 enabled    dokku core certificate management plugin
         checks               0.33.9 enabled    dokku core checks plugin
         common               0.33.9 enabled    dokku core common plugin
         config               0.33.9 enabled    dokku core config plugin
         cron                 0.33.9 enabled    dokku core cron plugin
         docker-options       0.33.9 enabled    dokku core docker-options plugin
         domains              0.33.9 enabled    dokku core domains plugin
         enter                0.33.9 enabled    dokku core enter plugin
         git                  0.33.9 enabled    dokku core git plugin
         haproxy-vhosts       0.33.9 enabled    dokku core haproxy-vhosts plugin
         letsencrypt          0.20.3 enabled    Automated installation of let's encrypt TLS certificates
         logs                 0.33.9 enabled    dokku core logs plugin
         network              0.33.9 enabled    dokku core network plugin
         nginx-vhosts         0.33.9 enabled    dokku core nginx-vhosts plugin
         openresty-vhosts     0.33.9 enabled    dokku core openresty-vhosts plugin
         plugin               0.33.9 enabled    dokku core plugin plugin
         ports                0.33.9 enabled    dokku core ports plugin
         proxy                0.33.9 enabled    dokku core proxy plugin
         ps                   0.33.9 enabled    dokku core ps plugin
         registry             0.33.9 enabled    dokku core registry plugin
         repo                 0.33.9 enabled    dokku core repo plugin
         resource             0.33.9 enabled    dokku core resource plugin
         run                  0.33.9 enabled    dokku core run plugin
         scheduler            0.33.9 enabled    dokku core scheduler plugin
         scheduler-docker-local 0.33.9 enabled    dokku core scheduler-docker-local plugin
         scheduler-k3s        0.33.9 enabled    dokku core scheduler-k3s plugin
         scheduler-null       0.33.9 enabled    dokku core scheduler-null plugin
         shell                0.33.9 enabled    dokku core shell plugin
         ssh-keys             0.33.9 enabled    dokku core ssh-keys plugin
         storage              0.33.9 enabled    dokku core storage plugin
         trace                0.33.9 enabled    dokku core trace plugin
         traefik-vhosts       0.33.9 enabled    dokku core traefik-vhosts plugin
=====> dmarc app-json information
       App json computed selected:    app.json
       App json global selected:      app.json
       App json selected:
=====> dmarc app information
       App created at:                1710782759
       App deploy source:             git-push
       App deploy source metadata:    8283362e7ff92d85b46eb3e725da99b50184374e
       App dir:                       /home/dokku/dmarc
       App locked:                    false
=====> dmarc builder information
       Builder build dir:
       Builder computed build dir:
       Builder computed selected:     null
       Builder global build dir:
       Builder global selected:
       Builder selected:              null
=====> dmarc builder-dockerfile information
       Builder dockerfile computed dockerfile path: Dockerfile
       Builder dockerfile global dockerfile path: Dockerfile
       Builder dockerfile dockerfile path:
=====> dmarc builder-herokuish information
       Builder herokuish computed allowed: true
       Builder herokuish global allowed: true
       Builder herokuish allowed:
=====> dmarc builder-lambda information
       Builder lambda computed lambdayml path: lambda.yml
       Builder lambda global lambdayml path: lambda.yml
       Builder lambda lambdayml path:
=====> dmarc builder-nixpacks information
       Builder nixpacks computed nixpackstoml path: nixpacks.toml
       Builder nixpacks global nixpackstoml path: nixpacks.toml
       Builder nixpacks nixpackstoml path:
       Builder nixpacks computed no cache: false
       Builder nixpacks global no cache: false
       Builder nixpacks no cache:
=====> dmarc builder-pack information
       Builder pack computed projecttoml path: project.toml
       Builder pack global projecttoml path: project.toml
       Builder pack projecttoml path:
=====> dmarc buildpacks information
       Buildpacks computed stack:     gliderlabs/herokuish:latest-22
       Buildpacks global stack:
       Buildpacks list:
       Buildpacks stack:
=====> dmarc caddy information
       Caddy image:                   lucaslorentz/caddy-docker-proxy:2.8
       Caddy letsencrypt email:
       Caddy letsencrypt server:      https://acme-v02.api.letsencrypt.org/directory
       Caddy log level:               ERROR
       Caddy polling interval:        5s
       Caddy tls internal:            false
=====> dmarc ssl information
       Ssl dir:                       /home/dokku/dmarc/tls
       Ssl enabled:                   false
       Ssl hostnames:
       Ssl expires at:
       Ssl issuer:
       Ssl starts at:
       Ssl subject:
       Ssl verified:
=====> dmarc checks information
       Checks disabled list:          none
       Checks skipped list:           none
       Checks computed wait to retire: 60
       Checks global wait to retire:  60
       Checks wait to retire:
=====> dmarc docker options information
       Docker options build:
       Docker options deploy:         --restart=on-failure:10
       Docker options run:
=====> dmarc domains information
       Domains app enabled:           true
       Domains app vhosts:            dmarc.dokku.example.com
       Domains global enabled:        true
       Domains global vhosts:         dokku.example.com
=====> dmarc git information
       Git deploy branch:             master
       Git global deploy branch:      main
       Git keep git dir:              false
       Git rev env var:               GIT_REV
       Git sha:
       Git source image:
       Git last updated at:           1710782777
=====> dmarc haproxy information
       Haproxy image:                 byjg/easy-haproxy:4.4.0
       Haproxy letsencrypt email:
       Haproxy letsencrypt server:    https://acme-v02.api.letsencrypt.org/directory
       Haproxy log level:             ERROR
Could not open file or uri for loading certificate from /home/dokku/dmarc/tls/server.crt
4067919F8C7F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file
4067919F8C7F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/home/dokku/dmarc/tls/server.crt)
Unable to load certificate
=====> dmarc letsencrypt information
       Letsencrypt active:            false
       Letsencrypt autorenew:         false
       Letsencrypt computed dns provider:
       Letsencrypt global dns provider:
       Letsencrypt dns provider:
       Letsencrypt computed email:
       Letsencrypt global email:
       Letsencrypt email:
       Letsencrypt expiration:        1710720000
       Letsencrypt computed graceperiod: 2592000
       Letsencrypt global graceperiod:
       Letsencrypt graceperiod:
       Letsencrypt computed lego docker args:
       Letsencrypt global lego docker args:
       Letsencrypt lego docker args:
       Letsencrypt computed server:   https://acme-v02.api.letsencrypt.org/directory
       Letsencrypt global server:
       Letsencrypt server:
=====> dmarc logs information
       Logs computed max size:        10m
       Logs global max size:          10m
       Logs global vector sink:
       Logs max size:
       Logs vector global image:      timberio/vector:0.36.1-debian
       Logs vector sink:
=====> dmarc network information
       Network attach post create:
       Network attach post deploy:
       Network bind all interfaces:          false
       Network computed attach post create:
       Network computed attach post deploy:
       Network computed bind all interfaces: false
       Network computed initial network:
       Network computed tld:
       Network global attach post create:
       Network global attach post deploy:
       Network global bind all interfaces:   false
       Network global initial network:
       Network global tld:
       Network initial network:
       Network static web listener:
       Network tld:
       Network web listeners:
=====> dmarc nginx information
       Nginx access log format:
       Nginx computed access log format:
       Nginx global access log format:
       Nginx access log path:
       Nginx computed access log path: /var/log/nginx/dmarc-access.log
       Nginx global access log path:  /var/log/nginx/dmarc-access.log
       Nginx bind address ipv4:
       Nginx computed bind address ipv4:
       Nginx global bind address ipv4:
       Nginx bind address ipv6:
       Nginx computed bind address ipv6: ::
       Nginx global bind address ipv6: ::
       Nginx client max body size:
       Nginx computed client max body size: 1m
       Nginx global client max body size: 1m
       Nginx disable custom config:
       Nginx computed disable custom config: false
       Nginx global disable custom config: false
       Nginx error log path:
       Nginx computed error log path: /var/log/nginx/dmarc-error.log
       Nginx global error log path:   /var/log/nginx/dmarc-error.log
       Nginx hsts include subdomains:
       Nginx computed hsts include subdomains: true
       Nginx global hsts include subdomains: true
       Nginx hsts max age:
       Nginx computed hsts max age:   15724800
       Nginx global hsts max age:     15724800
       Nginx hsts preload:
       Nginx computed hsts preload:   false
       Nginx global hsts preload:     false
       Nginx hsts:
       Nginx computed hsts:           true
       Nginx global hsts:             true
       Nginx last visited at:
       Nginx nginx conf sigil path:
       Nginx computed nginx conf sigil path: nginx.conf.sigil
       Nginx global nginx conf sigil path: nginx.conf.sigil
       Nginx proxy buffer size:
       Nginx computed proxy buffer size: 4k
       Nginx global proxy buffer size: 4k
       Nginx proxy buffering:
       Nginx computed proxy buffering: on
       Nginx global proxy buffering:  on
       Nginx proxy buffers:
       Nginx computed proxy buffers:  8 4k
       Nginx global proxy buffers:    8 4k
       Nginx proxy busy buffers size:
       Nginx computed proxy busy buffers size: 8k
       Nginx global proxy busy buffers size: 8k
       Nginx proxy read timeout:
       Nginx computed proxy read timeout: 60s
       Nginx global proxy read timeout: 60s
       Nginx underscore in headers:
       Nginx computed underscore in headers: off
       Nginx global underscore in headers: off
       Nginx x forwarded for value:
       Nginx computed x forwarded for value: $remote_addr
       Nginx global x forwarded for value: $remote_addr
       Nginx x forwarded port value:
       Nginx computed x forwarded port value: $server_port
       Nginx global x forwarded port value: $server_port
       Nginx x forwarded proto value:
       Nginx computed x forwarded proto value: $scheme
       Nginx global x forwarded proto value: $scheme
       Nginx x forwarded ssl:
       Nginx computed x forwarded ssl:
       Nginx global x forwarded ssl:
/var/lib/dokku/plugins/available/openresty-vhosts/command-functions: line 64: fn-openresty-allowed-letsencrypt-domains-func-base64: command not found
=====> dmarc openresty information
       Openresty access log format:
       Openresty access log path:     /var/log/nginx/dmarc-access.log
       Openresty allowed letsencrypt domains func base64:
       Openresty bind address ipv4:
       Openresty bind address ipv6:   ::
       Openresty client max body size:
       Openresty error log path:      /var/log/nginx/dmarc-error.log
       Openresty global hsts:         true
       Openresty computed hsts:       true
       Openresty hsts:
       Openresty hsts include subdomains: true
       Openresty hsts max age:        15724800
       Openresty hsts preload:        false
       Openresty image:               dokku/openresty-docker-proxy:0.7.0
       Openresty letsencrypt email:
       Openresty letsencrypt server:  https://acme-v02.api.letsencrypt.org/directory
       Openresty proxy buffer size:   4k
       Openresty proxy buffering:     on
       Openresty proxy buffers:       8 4k
       Openresty proxy busy buffers size: 8k
       Openresty proxy read timeout:  60s
       Openresty underscore in headers: off
       Openresty x forwarded for value: $remote_addr
       Openresty x forwarded port value: $server_port
       Openresty x forwarded proto value: $scheme
       Openresty x forwarded ssl:
=====> dmarc ports information
       Ports map:
       Ports map detected:            http:80:5000
=====> dmarc proxy information
       Proxy computed type:           nginx
       Proxy enabled:                 true
       Proxy global type:             nginx
       Proxy type:
=====> dmarc ps information
       Deployed:                      false
       Processes:                     0
       Ps can scale:                  true
       Ps computed procfile path:     Procfile
       Ps global procfile path:       Procfile
       Ps procfile path:
       Ps restart policy:             on-failure:10
       Restore:                       true
       Running:                       false
=====> dmarc registry information
       Registry computed image repo:        dokku/dmarc
       Registry computed push on release:   false
       Registry computed server:
       Registry global image repo template:
       Registry global push on release:
       Registry global server:
       Registry image repo:
       Registry push extra tags:
       Registry push on release:
       Registry server:
       Registry tag version:
=====> dmarc resource information
=====> dmarc scheduler information
       Scheduler computed selected:   docker-local
       Scheduler global selected:     docker-local
       Scheduler selected:
=====> dmarc scheduler-docker-local information
       Scheduler docker local disable chown:
       Scheduler docker local init process: true
       Scheduler docker local parallel schedule count:
=====> dmarc scheduler-k3s information
       Scheduler k3s computed deploy timeout:       300s
       Scheduler k3s computed image pull secrets:
       Scheduler k3s computed letsencrypt server:   prod
       Scheduler k3s computed namespace:            default
       Scheduler k3s computed rollback on failure:  false
       Scheduler k3s deploy timeout:
       Scheduler k3s global deploy timeout:         300s
       Scheduler k3s global image pull secrets:
       Scheduler k3s global ingress class:          traefik
       Scheduler k3s global kube context:
       Scheduler k3s global kubeconfig path:        /etc/rancher/k3s/k3s.yaml
       Scheduler k3s global letsencrypt email prod:
       Scheduler k3s global letsencrypt email stag:
       Scheduler k3s global letsencrypt server:     prod
       Scheduler k3s global namespace:              default
       Scheduler k3s global network interface:      eth0
       Scheduler k3s global rollback on failure:    false
       Scheduler k3s image pull secrets:
       Scheduler k3s letsencrypt server:
       Scheduler k3s namespace:
       Scheduler k3s rollback on failure:
=====> dmarc storage information
       Storage build mounts:
       Storage deploy mounts:
       Storage run mounts:
=====> dmarc traefik information
       Traefik api enabled:           false
       Traefik api vhost:             traefik.dokku.me
       Traefik basic auth password:
       Traefik basic auth username:
       Traefik dashboard enabled:     false
       Traefik image:                 traefik:2.11.0
       Traefik letsencrypt email:
       Traefik letsencrypt server:    https://acme-v02.api.letsencrypt.org/directory
       Traefik log level:             ERROR
       Traefik priority:
trace off/on

Output of failing commands after running: dokku trace:off

fatal: update_ref failed for ref 'refs/heads/main': cannot update ref 'refs/heads/main': trying to write non-commit object a8747d64ce649ce8e78ecd062e34593c07fcab79 to branch 'refs/heads/main'

Output of failing commands after running: dokku trace:on

+ export DOKKU_HOST_ROOT=/home/dokku
+ DOKKU_HOST_ROOT=/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOCKER_BIN=docker
+ DOCKER_BIN=docker
+ export DOKKU_IMAGE=gliderlabs/herokuish:latest-22
+ DOKKU_IMAGE=gliderlabs/herokuish:latest-22
+ export DOKKU_CNB_BUILDER=heroku/builder:22
+ DOKKU_CNB_BUILDER=heroku/builder:22
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_SYSTEM_GROUP=dokku
+ DOKKU_SYSTEM_GROUP=dokku
+ export DOKKU_SYSTEM_USER=dokku
+ DOKKU_SYSTEM_USER=dokku
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_PID=996289
+ DOKKU_PID=996289
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export 'DOKKU_GLOBAL_BUILD_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_BUILD_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ export 'DOKKU_GLOBAL_RUN_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_RUN_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=('git:sync' 'dmarc' 'https://github.com/AndrewKvalheim/dmarc-report-notifier.git' 'v1.1.5')
+ local args
+ local flags
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ git:sync == \-\-\a\p\p ]]
+ [[ git:sync =~ ^--.* ]]
+ next_index=2
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ dmarc == \-\-\a\p\p ]]
+ [[ dmarc =~ ^--.* ]]
+ next_index=3
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ https://github.com/AndrewKvalheim/dmarc-report-notifier.git == \-\-\a\p\p ]]
+ [[ https://github.com/AndrewKvalheim/dmarc-report-notifier.git =~ ^--.* ]]
+ next_index=4
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ v1.1.5 == \-\-\a\p\p ]]
+ [[ v1.1.5 =~ ^--.* ]]
+ next_index=5
+ [[ -z '' ]]
++ echo -e ''
++ sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
+ export DOKKU_GLOBAL_FLAGS=
+ DOKKU_GLOBAL_FLAGS=
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ git:sync =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
+ [[ '' == \t\r\u\e ]]
+ [[ '' == \t\r\u\e ]]
++ LC_ALL=C
++ /usr/bin/tty
++ true
+ [[ not a tty == \n\o\t\ \a\ \t\t\y ]]
+ return 1
+ DOKKU_QUIET_OUTPUT=1
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ git:sync =~ ^plugin:.* ]]
+ [[ git:sync == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ git:sync == \s\s\h\-\k\e\y\s\:\r\e\m\o\v\e ]]
+ [[ git:sync == \s\c\h\e\d\u\l\e\r\-\k\3\s\:\i\n\i\t\i\a\l\i\z\e ]]
+ [[ git:sync == \s\c\h\e\d\u\l\e\r\-\k\3\s\:\u\n\i\n\s\t\a\l\l ]]
+ [[ -n git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5 ]]
+ export -n SSH_ORIGINAL_COMMAND
+ [[ git:sync =~ config-* ]]
+ [[ git:sync =~ docker-options* ]]
+ set -f
+ /usr/bin/dokku git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ export DOKKU_HOST_ROOT=/home/dokku
+ DOKKU_HOST_ROOT=/home/dokku
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOCKER_BIN=docker
+ DOCKER_BIN=docker
+ export DOKKU_IMAGE=gliderlabs/herokuish:latest-22
+ DOKKU_IMAGE=gliderlabs/herokuish:latest-22
+ export DOKKU_CNB_BUILDER=heroku/builder:22
+ DOKKU_CNB_BUILDER=heroku/builder:22
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
+ PLUGIN_PATH=/var/lib/dokku/plugins
+ export PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ PLUGIN_AVAILABLE_PATH=/var/lib/dokku/plugins/available
+ export PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ PLUGIN_ENABLED_PATH=/var/lib/dokku/plugins/enabled
+ export PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ PLUGIN_CORE_PATH=/var/lib/dokku/core-plugins
+ export PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ PLUGIN_CORE_AVAILABLE_PATH=/var/lib/dokku/core-plugins/available
+ export PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ PLUGIN_CORE_ENABLED_PATH=/var/lib/dokku/core-plugins/enabled
+ export DOKKU_SYSTEM_GROUP=dokku
+ DOKKU_SYSTEM_GROUP=dokku
+ export DOKKU_SYSTEM_USER=dokku
+ DOKKU_SYSTEM_USER=dokku
+ export DOKKU_API_VERSION=1
+ DOKKU_API_VERSION=1
+ export DOKKU_NOT_IMPLEMENTED_EXIT=10
+ DOKKU_NOT_IMPLEMENTED_EXIT=10
+ export DOKKU_VALID_EXIT=0
+ DOKKU_VALID_EXIT=0
+ export DOKKU_PID=996298
+ DOKKU_PID=996298
+ export DOKKU_LOGS_DIR=/var/log/dokku
+ DOKKU_LOGS_DIR=/var/log/dokku
+ export DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ DOKKU_LOGS_HOST_DIR=/var/log/dokku
+ export DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ DOKKU_EVENTS_LOGFILE=/var/log/dokku/events.log
+ export DOKKU_CONTAINER_LABEL=dokku
+ DOKKU_CONTAINER_LABEL=dokku
+ export 'DOKKU_GLOBAL_BUILD_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_BUILD_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ export 'DOKKU_GLOBAL_RUN_ARGS=--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ DOKKU_GLOBAL_RUN_ARGS='--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=dokku'
+ source /var/lib/dokku/core-plugins/available/common/functions
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ parse_args git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ declare 'desc=top-level cli arg parser'
+ local next_index=1
+ local skip=false
+ args=('git:sync' 'dmarc' 'https://github.com/AndrewKvalheim/dmarc-report-notifier.git' 'v1.1.5')
+ local args
+ local flags
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ git:sync == \-\-\a\p\p ]]
+ [[ git:sync =~ ^--.* ]]
+ next_index=2
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ dmarc == \-\-\a\p\p ]]
+ [[ dmarc =~ ^--.* ]]
+ next_index=3
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ https://github.com/AndrewKvalheim/dmarc-report-notifier.git == \-\-\a\p\p ]]
+ [[ https://github.com/AndrewKvalheim/dmarc-report-notifier.git =~ ^--.* ]]
+ next_index=4
+ for arg in "$@"
+ [[ false == \t\r\u\e ]]
+ case "$arg" in
+ [[ false == \t\r\u\e ]]
+ [[ v1.1.5 == \-\-\a\p\p ]]
+ [[ v1.1.5 =~ ^--.* ]]
+ next_index=5
+ [[ -z '' ]]
++ echo -e ''
++ sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
+ export DOKKU_GLOBAL_FLAGS=
+ DOKKU_GLOBAL_FLAGS=
+ return 0
+ args=("$@")
+ skip_arg=false
+ [[ git:sync =~ ^--.* ]]
+ has_tty
+ declare 'desc=return 0 if we have a tty'
+ [[ '' == \t\r\u\e ]]
+ [[ '' == \t\r\u\e ]]
++ LC_ALL=C
++ /usr/bin/tty
++ true
+ [[ not a tty == \n\o\t\ \a\ \t\t\y ]]
+ return 1
+ DOKKU_QUIET_OUTPUT=1
++ id -un
+ [[ dokku != \d\o\k\k\u ]]
+ [[ git:sync =~ ^plugin:.* ]]
+ [[ git:sync == \s\s\h\-\k\e\y\s\:\a\d\d ]]
+ [[ git:sync == \s\s\h\-\k\e\y\s\:\r\e\m\o\v\e ]]
+ [[ git:sync == \s\c\h\e\d\u\l\e\r\-\k\3\s\:\i\n\i\t\i\a\l\i\z\e ]]
+ [[ git:sync == \s\c\h\e\d\u\l\e\r\-\k\3\s\:\u\n\i\n\s\t\a\l\l ]]
+ [[ -n '' ]]
+ dokku_auth git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ declare 'desc=calls user-auth plugin trigger'
+ export SSH_USER=dokku
+ SSH_USER=dokku
+ export SSH_NAME=andrew
+ SSH_NAME=andrew
+ export DOKKU_COMMAND=git:sync
+ DOKKU_COMMAND=git:sync
++ wc -l
++ find /var/lib/dokku/plugins/enabled/20_events/user-auth
+ local user_auth_count=1
+ [[ 1 == 0 ]]
+ [[ 1 == 1 ]]
+ [[ -f /var/lib/dokku/plugins/enabled/20_events/user-auth ]]
+ return 0
+ case "$1" in
+ execute_dokku_cmd git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ declare 'desc=executes dokku sub-commands'
+ local PLUGIN_NAME=git:sync
+ local PLUGIN_CMD=git:sync
+ local implemented=0
+ local script
+ argv=('git:sync' 'dmarc' 'https://github.com/AndrewKvalheim/dmarc-report-notifier.git' 'v1.1.5')
+ local argv
+ case "$PLUGIN_NAME" in
++ readlink -f /var/lib/dokku/plugins/enabled/git
+ [[ /var/lib/dokku/core-plugins/available/git == *core-plugins* ]]
+ [[ git:sync == \g\i\t\:\s\y\n\c ]]
+ shift 1
+ [[ -n '' ]]
+ set -- git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ [[ -x /var/lib/dokku/plugins/enabled/git:sync/subcommands/default ]]
+ [[ -x /var/lib/dokku/plugins/enabled/git:sync/subcommands/git:sync ]]
+ [[ -x /var/lib/dokku/plugins/enabled/git/subcommands/sync ]]
+ [[ -n sync ]]
+ /var/lib/dokku/plugins/enabled/git/subcommands/sync git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
++ source /var/lib/dokku/core-plugins/available/common/property-functions
+++ set -eo pipefail
+++ [[ -n 1 ]]
+++ set -x
++ set -eo pipefail
++ [[ -n 1 ]]
++ set -x
+ set -eo pipefail
+ [[ -n 1 ]]
+ set -x
+ cmd-git-sync git:sync dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ declare 'desc=clone or fetch an app from remote git repo'
+ local cmd=git:sync
+ [[ git:sync == \g\i\t\:\s\y\n\c ]]
+ shift 1
+ declare APP GIT_REMOTE GIT_REF FLAG
+ ARGS=()
+ for arg in "$@"
+ [[ dmarc == \-\-\b\u\i\l\d ]]
+ ARGS+=("$arg")
+ for arg in "$@"
+ [[ https://github.com/AndrewKvalheim/dmarc-report-notifier.git == \-\-\b\u\i\l\d ]]
+ ARGS+=("$arg")
+ for arg in "$@"
+ [[ v1.1.5 == \-\-\b\u\i\l\d ]]
+ ARGS+=("$arg")
+ APP=dmarc
+ GIT_REMOTE=https://github.com/AndrewKvalheim/dmarc-report-notifier.git
+ GIT_REF=v1.1.5
+ verify_app_name dmarc
+ declare 'desc=verify app name format and app existence'
+ declare APP=dmarc
+ /var/lib/dokku/core-plugins/available/common/common --quiet verify-app-name dmarc
+ return 0
+ [[ -d /var/lib/dokku/data/git/dmarc ]]
+ [[ -z https://github.com/AndrewKvalheim/dmarc-report-notifier.git ]]
+ local APP_ROOT=/home/dokku/dmarc
++ fn-git-cmd /home/dokku/dmarc count-objects
++ declare GIT_DIR=/home/dokku/dmarc
++ local exit_code=1
++ shift 1
++ pushd /home/dokku/dmarc
++ git count-objects
++ exit_code=0
++ popd
++ return 0
+ [[ 25 objects, 100 kilobytes == \0\ \o\b\j\e\c\t\s\,\ \0\ \k\i\l\o\b\y\t\e\s ]]
+ fn-git-fetch dmarc https://github.com/AndrewKvalheim/dmarc-report-notifier.git v1.1.5
+ declare APP=dmarc GIT_REMOTE=https://github.com/AndrewKvalheim/dmarc-report-notifier.git GIT_REF=v1.1.5
+ local DOKKU_DEPLOY_BRANCH
+ local APP_ROOT=/home/dokku/dmarc
++ fn-git-cmd /home/dokku/dmarc count-objects
++ declare GIT_DIR=/home/dokku/dmarc
++ local exit_code=1
++ shift 1
++ pushd /home/dokku/dmarc
++ git count-objects
++ exit_code=0
++ popd
++ return 0
+ [[ 25 objects, 100 kilobytes == \0\ \o\b\j\e\c\t\s\,\ \0\ \k\i\l\o\b\y\t\e\s ]]
++ fn-git-deploy-branch dmarc
++ declare 'desc=retrieve the deploy branch for a given application'
++ local APP=dmarc
++ local DEFAULT_BRANCH=master
+++ fn-plugin-property-get git dmarc deploy-branch ''
+++ declare 'desc=returns the value for a given property'
+++ declare PLUGIN=git APP=dmarc KEY=deploy-branch DEFAULT=
+++ fn-plugin-property-get-default git dmarc deploy-branch ''
+++ declare 'desc=returns the value for a given property with a specified default value'
+++ declare PLUGIN=git APP=dmarc KEY=deploy-branch DEFAULT=
+++ /var/lib/dokku/core-plugins/available/common/prop get-with-default git dmarc deploy-branch ''
++ local DOKKU_DEPLOY_BRANCH=
+++ fn-plugin-property-get git --global deploy-branch ''
+++ declare 'desc=returns the value for a given property'
+++ declare PLUGIN=git APP=--global KEY=deploy-branch DEFAULT=
+++ fn-plugin-property-get-default git --global deploy-branch ''
+++ declare 'desc=returns the value for a given property with a specified default value'
+++ declare PLUGIN=git APP=--global KEY=deploy-branch DEFAULT=
+++ /var/lib/dokku/core-plugins/available/common/prop get-with-default git --global deploy-branch ''
++ local DOKKU_GLOBAL_DEPLOY_BRANCH=main
++ [[ -n '' ]]
++ [[ -n main ]]
++ echo main
+ DOKKU_DEPLOY_BRANCH=main
+ fn-git-cmd /home/dokku/dmarc check-ref-format --branch main
+ fn-git-cmd /home/dokku/dmarc remote rm remote
+ fn-git-cmd /home/dokku/dmarc remote add --mirror=fetch --no-tags remote https://github.com/AndrewKvalheim/dmarc-report-notifier.git
+ declare GIT_DIR=/home/dokku/dmarc
+ local exit_code=1
+ shift 1
+ pushd /home/dokku/dmarc
+ git remote add --mirror=fetch --no-tags remote https://github.com/AndrewKvalheim/dmarc-report-notifier.git
+ exit_code=0
+ popd
+ return 0
+ [[ -z v1.1.5 ]]
+ GIT_TERMINAL_PROMPT=0
+ fn-git-cmd /home/dokku/dmarc fetch --update-head-ok remote
+ declare GIT_DIR=/home/dokku/dmarc
+ local exit_code=1
+ shift 1
+ pushd /home/dokku/dmarc
+ git fetch --update-head-ok remote
+ exit_code=0
+ popd
+ return 0
+ fn-git-cmd /home/dokku/dmarc update-ref refs/heads/main v1.1.5
+ declare GIT_DIR=/home/dokku/dmarc
+ local exit_code=1
+ shift 1
+ pushd /home/dokku/dmarc
+ git update-ref refs/heads/main v1.1.5
fatal: update_ref failed for ref 'refs/heads/main': cannot update ref 'refs/heads/main': trying to write non-commit object a8747d64ce649ce8e78ecd062e34593c07fcab79 to branch 'refs/heads/main'

Maybe! Not sure how we should detect a tag, since anything could be a tag (even a 40-character string that looks like a sha). We also can't try hitting a github api because not all repos will be on github.

Thoughts?

I mean maybe Dokku should recursively resolve whatever you give it by appending ^{commit}.

$ git rev-parse 'v1.1.5'
a8747d64ce649ce8e78ecd062e34593c07fcab79
$ git rev-parse 'v1.1.5^{commit}'
8283362e7ff92d85b46eb3e725da99b50184374e
$ git rev-parse 'v1.1.5^{commit}^{commit}'
8283362e7ff92d85b46eb3e725da99b50184374e

Does that work for commit shas and branches as well? If you have a PR with the change and it passes tests, that would be awesome

Yeah any rev:

$ git rev-parse 'a8747d64ce649ce8e78ecd062e34593c07fcab79^{commit}'
8283362e7ff92d85b46eb3e725da99b50184374e
$ git rev-parse '8283362e7ff92d85b46eb3e725da99b50184374e^{commit}'
8283362e7ff92d85b46eb3e725da99b50184374e
$ git rev-parse 'main^{commit}'
8283362e7ff92d85b46eb3e725da99b50184374e

Happy to do a PR but it’s still a half-baked idea for me so I wanted to run it by first.

Seems fine. If tests pass, thats cool!