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

Print variant from builder #248

Merged
merged 1 commit into from
Nov 20, 2020
Merged

Conversation

jonjohnsonjr
Copy link
Collaborator

@jonjohnsonjr jonjohnsonjr commented Nov 17, 2020

$ crane manifest alpine | jq .
{
  "manifests": [
    {
      "digest": "sha256:d7342993700f8cd7aba8496c2d0e57be0666e80b4c441925fc6f9361fa81d10e",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      },
      "size": 528
    },
    {
      "digest": "sha256:c4f0f03cda416f3e4cfebcfea9910463121651b019c6677053ece71084699f47",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "arm",
        "os": "linux",
        "variant": "v6"
      },
      "size": 528
    },
    {
      "digest": "sha256:d0f78a6ddf7a457dc72dbd44eab67209454ddb1e6d2323fa8e27275bc13dc320",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "arm",
        "os": "linux",
        "variant": "v7"
      },
      "size": 528
    },
    {
      "digest": "sha256:fbb820c07896f5c2516167e7146d9938fc82d4b6b1db167defa5b0a7162e4480",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "arm64",
        "os": "linux",
        "variant": "v8"
      },
      "size": 528
    },
    {
      "digest": "sha256:4e01ddea8def856ba9fee17668fa0b2e45a8bc78127b7ab6cf921f6d6fd86ac9",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "386",
        "os": "linux"
      },
      "size": 528
    },
    {
      "digest": "sha256:e565d01665c4596b34d7836fc370342331b836b5e5623eb1c8dfaf72ef4f30cb",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "ppc64le",
        "os": "linux"
      },
      "size": 528
    },
    {
      "digest": "sha256:eb005f6396161741e490161756dac662e946206c9d2e7ff2528be60e905be9f6",
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "platform": {
        "architecture": "s390x",
        "os": "linux"
      },
      "size": 528
    }
  ],
  "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
  "schemaVersion": 2
}
$ KO_DEFAULTBASEIMAGE=alpine ko publish --platform=all ./cmd/ko
2020/11/17 14:42:24 Using base alpine for github.com/google/ko/cmd/ko
2020/11/17 14:42:24 No matching credentials were found, falling back on anonymous
2020/11/17 14:42:25 Building github.com/google/ko/cmd/ko for linux/amd64
2020/11/17 14:42:33 Building github.com/google/ko/cmd/ko for linux/arm/v6
2020/11/17 14:42:40 Building github.com/google/ko/cmd/ko for linux/arm/v7
2020/11/17 14:43:19 Building github.com/google/ko/cmd/ko for linux/arm64/v8
2020/11/17 14:44:26 Building github.com/google/ko/cmd/ko for linux/386
2020/11/17 14:45:35 Building github.com/google/ko/cmd/ko for linux/ppc64le
2020/11/17 14:46:43 Building github.com/google/ko/cmd/ko for linux/s390x
...

@@ -272,7 +272,11 @@ func build(ctx context.Context, ip string, platform v1.Platform, disableOptimiza
cmd.Stderr = &output
cmd.Stdout = &output

log.Printf("Building %s for %s/%s", ip, platform.OS, platform.Architecture)
plat := path.Join(platform.OS, platform.Architecture)
Copy link

@rhuss rhuss Nov 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want to couple the separator in the label between OS and Architecture based on the path separator ? What happens if you run this on Windows ? And if you have tooling that relies on that log output to be stable (yes, such things happen). Also, it is really not related to a file path.

So I highly recommend using printf with a fixed "/" separator.

Or even just +

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path is fixed as "/", filepath is based on your current platform.

Copy link

@rhuss rhuss Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for the heads up (didn't know that). Fine with me if you consider the architecture label to be an URL like 'path' (still like the more explicit form better)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done.

@codecov-io
Copy link

Codecov Report

Merging #248 (fee8639) into master (bd1ec54) will decrease coverage by 0.07%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #248      +/-   ##
==========================================
- Coverage   37.19%   37.11%   -0.08%     
==========================================
  Files          33       33              
  Lines        1460     1463       +3     
==========================================
  Hits          543      543              
- Misses        828      831       +3     
  Partials       89       89              
Impacted Files Coverage Δ
pkg/build/gobuild.go 58.22% <0.00%> (-0.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd1ec54...fee8639. Read the comment docs.

@jonjohnsonjr jonjohnsonjr merged commit 1c70438 into ko-build:master Nov 20, 2020
@jonjohnsonjr jonjohnsonjr deleted the print-variant branch November 20, 2020 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants