Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindl verify passes verification despite binary in bin/ is not linked to its bin/.bindl counterpart #71

Open
chrisyxlee opened this issue Apr 20, 2022 · 4 comments
Labels
bug Something isn't working ux Ensures a good time when using the product workflow/verification Binary / archive verification workflow

Comments

@chrisyxlee
Copy link
Member

chrisyxlee commented Apr 20, 2022

Specifically, bindl sync && bindl get ko. I also tried bindl purge && bindl sync && bindl get ko, which errored out similarly.

Error Output with --debug

❯ bindl get ko --debug
4:07PM DBG  lvl=debug
4:07PM DBG parsing lockfile programs=2
4:07PM DBG validated program=ko
4:07PM DBG found valid existing, re-linking program=ko
ERROR - chtimes bin/.bindl/programs/d459221a402aa3047e5ed27db76bb669ae958588e6fde0ed7fcf2d84ff19a9fd-ko/ko: no such file or directory
Error: failed to execute command, please troubleshoot logs
Error Output

❯ bindl purge

❯ bindl sync
3:53PM INF building program spec program=ko
3:53PM INF building program spec program=golangci-lint
3:53PM INF downloading archive platform=linux/arm64 program=ko
3:53PM INF downloading archive platform=darwin/amd64 program=golangci-lint
3:53PM INF downloading archive platform=darwin/arm64 program=golangci-lint
3:53PM INF downloading archive platform=linux/amd64 program=golangci-lint
3:53PM INF downloading archive platform=darwin/amd64 program=ko
3:53PM INF downloading archive platform=linux/arm64 program=golangci-lint
3:53PM INF downloading archive platform=linux/amd64 program=ko
3:53PM INF downloading archive platform=darwin/arm64 program=ko
3:53PM INF built program spec program=ko
3:53PM INF built program spec program=golangci-lint

❯ bindl get ko
ERROR - chtimes bin/.bindl/programs/d459221a402aa3047e5ed27db76bb669ae958588e6fde0ed7fcf2d84ff19a9fd-ko/ko: no such file or directory
Error: failed to execute command, please troubleshoot logs
bindl.yaml

platforms:
  linux:
    - amd64
    - arm64
  darwin:
    - amd64
    - arm64

_uname: &uname
  OS: &uname_OS
    linux: Linux
    darwin: Darwin
  Arch: &uname_Arch
    amd64: x86_64

programs:

  - name: golangci-lint
    version: 1.45.2
    provider: github
    paths:
      base: golangci/golangci-lint
      target: "{{ .Name }}-{{ .Version }}-{{ .OS }}-{{ .Arch }}.tar.gz"
      checksums:
        artifact: "{{ .Name }}-{{ .Version }}-checksums.txt"

  - name: ko
    provider: github
    version: 0.11.2
    overlay:
      OS:
        linux: Linux
        darwin: Darwin
      Arch:
        amd64: x86_64
    paths:
      base: google/ko
      target: '{{ .Name }}_{{ .Version }}_{{ .OS }}_{{ .Arch }}.tar.gz'
      checksums:
        artifact: checksums.txt
.bindl-lock.yaml

programs:
- checksums:
    golangci-lint-1.45.2-darwin-amd64.tar.gz:
      archive: 995e509e895ca6a64ffc7395ac884d5961bdec98423cb896b17f345a9b4a19cf
      binary: 32f233a3213bf48025bae4af1a41482535454dc9a906daf6df66d4c3c366ca19
    golangci-lint-1.45.2-darwin-arm64.tar.gz:
      archive: c2b9669decc1b638cf2ee9060571af4e255f6dfcbb225c293e3a7ee4bb2c7217
      binary: 24f76cfcd464793e5d5fc930924586baff52232206ae2a9040467f802a95d1fc
    golangci-lint-1.45.2-linux-amd64.tar.gz:
      archive: 595ad6c6dade4c064351bc309f411703e457f8ffbb7a1806b3d8ee713333427f
      binary: 700869bf9234e808ddecf7666cf362747cd94f7679f4d2a125bbff54f2daeb22
    golangci-lint-1.45.2-linux-arm64.tar.gz:
      archive: 1463049b744871168095e3e8f687247d6040eeb895955b869889ea151e0603ab
      binary: f6ea84deab5752583497b77e22e7e0a93c674edf043b341228ba6c030c17585d
  name: golangci-lint
  paths:
    base: https://github.com/golangci/golangci-lint/releases/download/v{{ .Version }}/
    checksums:
      artifact: https://github.com/golangci/golangci-lint/releases/download/v{{ .Version }}/{{ .Name }}-{{ .Version }}-checksums.txt
    target: '{{ .Name }}-{{ .Version }}-{{ .OS }}-{{ .Arch }}.tar.gz'
  version: 1.45.2
- checksums:
    ko_0.11.2_Darwin_arm64.tar.gz:
      archive: 02acfe3bc856805c25d65bb620e414b98aa504c6194ff8e953ce169edfcc03c6
      binary: d459221a402aa3047e5ed27db76bb669ae958588e6fde0ed7fcf2d84ff19a9fd
    ko_0.11.2_Darwin_x86_64.tar.gz:
      archive: 5e95f6be71bd47b5cc3517de83af254209cb914e4f854c9391e8f993f4003f90
      binary: 0345be9e8b85192cd548ef61df92b8acfa666d4a173081b5c27fa91f1c770cad
    ko_0.11.2_Linux_arm64.tar.gz:
      archive: 48c1d4a7eabdf583dfc1640ca5087f00a6b5bfdd1ac9400c14e7affb2c2d3fbb
      binary: 6b5e376b5d2ff5fe09d5b3fe93375aafefdb53f36453986a2a3a398c90c382bd
    ko_0.11.2_Linux_x86_64.tar.gz:
      archive: afb5dacb44bfeafdc53c6de03d9ff74f4a6003c5617381d3139038aa25f3fb66
      binary: 7f85590cf718c18b41263ecae611f32f01891c7e786389f441672ec9da788f27
  name: ko
  overlay:
    Arch:
      amd64: x86_64
    OS:
      darwin: Darwin
      linux: Linux
  paths:
    base: https://github.com/google/ko/releases/download/v{{ .Version }}/
    checksums:
      artifact: https://github.com/google/ko/releases/download/v{{ .Version }}/checksums.txt
    target: '{{ .Name }}_{{ .Version }}_{{ .OS }}_{{ .Arch }}.tar.gz'
  version: 0.11.2
@chrisyxlee
Copy link
Member Author

chrisyxlee commented Apr 20, 2022

Of note, the folder bin/.bindl does not exist.

❯ bindl version
version: 0.0.5 (go1.18)
commit: 4b5fba05cd01309ca791844d65e97a3309b7ec0d
date: 2022-04-12T20:40:55Z
❯ bindl verify ko --debug
4:14PM DBG  lvl=debug
4:14PM DBG parsing lockfile programs=2
4:14PM DBG validated program=ko

@chrisyxlee
Copy link
Member Author

Lol, I was onboarding an existing project onto Bindl, and I had a Makefile to grab everything for me, so all the binaries were already in bin/.

Turns out I was supposed to nuke my bin folder before proceeding :') bin/ko already existed, so Bindl didn't do anything.

Caveats to be noted for #13

@chrisyxlee chrisyxlee changed the title bindl get errors after bindl sync bindl verify should check for existence of bin/.bindl state Apr 20, 2022
@wilsonehusin wilsonehusin added ux Ensures a good time when using the product workflow/verification Binary / archive verification workflow labels Apr 20, 2022
@wilsonehusin
Copy link
Member

I'm inclined to say that "verify without looking at .bindl" is working as intended, because a the end of the day, the binary that exists in bin/ is in sync with .bindl-lock.yaml and users can run the binary.

Instead of doing check over existence of bin/.bindl, maybe we should silence the error on Chtimes? The reason it's there is... fixing a small non-error annoyance, which sounds better than having the program crash.

bindl/command/get.go

Lines 34 to 39 in c718d35

// Update program atime and mtime to prevent Makefile from rebuilding
// ref: https://stackoverflow.com/a/35276091
now := time.Now().Local()
if err := os.Chtimes(filepath.Join(binDir, relProgDir), now, now); err != nil {
return err
}

@wilsonehusin wilsonehusin changed the title bindl verify should check for existence of bin/.bindl state bindl verify passes verification despite binary in bin/ is not linked to its bin/.bindl counterpart Apr 24, 2022
@wilsonehusin wilsonehusin added the bug Something isn't working label Apr 24, 2022
@chrisyxlee
Copy link
Member Author

I'm inclined to say that "verify without looking at .bindl" is working as intended, because a the end of the day, the binary that exists in bin/ is in sync with .bindl-lock.yaml and users can run the binary.

Instead of doing check over existence of bin/.bindl, maybe we should silence the error on Chtimes? The reason it's there is... fixing a small non-error annoyance, which sounds better than having the program crash.

bindl/command/get.go

Lines 34 to 39 in c718d35

// Update program atime and mtime to prevent Makefile from rebuilding
// ref: https://stackoverflow.com/a/35276091
now := time.Now().Local()
if err := os.Chtimes(filepath.Join(binDir, relProgDir), now, now); err != nil {
return err
}

yeah that sounds good! The crux of the issue is definitely just that bindl sync errors out when there's a working binary already, so your suggestion would fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ux Ensures a good time when using the product workflow/verification Binary / archive verification workflow
Projects
None yet
Development

No branches or pull requests

2 participants