GoogleContainerTools / GoogleContainerTools/skaffold

Skaffold should check if push permissions exist before building an image pushed to remote.

Open
#5,717 0 comments 0 reactions 0 assignees View on GitHub
area/performance kind/friction kind/todo priority/p2
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

I am working on https://github.com/google/triage-party
@tstromberg has his private GCR repo hard-coded in the skaffold.yaml. I was hoping skaffold would error out since i dont have permission to push.

Note: I am doing remote development against my GKE cluster.

Two issues here
1) skaffold build the image and failed at last step to pushing.
After fixing the image repo in skaffold.yaml, it performed the build again. Skaffold could have cached the image and re-used. This is not a huge issue since `docker build` rebuilt from its internal cache.
However, we could definitely cache image.
2) The push stage kept retrying for an awful long time, until I forced quit.

```
➜ triage-party git:(add_planning_board) ✗ skaffold build
Generating tags...
- gcr.io/tstromberg-test/tparty -> gcr.io/tstromberg-test/tparty:latest
Checking cache...
- gcr.io/tstromberg-test/tparty: Not found. Building
Building [gcr.io/tstromberg-test/tparty]...
Sending build context to Docker daemon 4.064MB
Step 1/18 : FROM golang:latest AS builder
latest: Pulling from library/golang
bd8f6a7501cc: Already exists
44718e6d535d: Already exists
efe9738af0cb: Already exists
f37aabde37b8: Already exists
c4c446e03742: Already exists
77ce91079a9a: Pulling fs layer
62b51a704e67: Pulling fs layer
62b51a704e67: Verifying Checksum
62b51a704e67: Download complete
77ce91079a9a: Verifying Checksum
77ce91079a9a: Download complete
77ce91079a9a: Pull complete
62b51a704e67: Pull complete
Digest: sha256:039302756fd4a741b66b3d92f6e9d6197cc3bf9af26755f7b57304292261909f
Status: Downloaded newer image for golang:latest
---> d5dc529b0ee7
Step 2/18 : WORKDIR /app
---> Running in 0328aac29f40
---> c911bfdd039e
Step 3/18 : ENV SRC_DIR=/src/tparty
---> Running in cd5ab1d5fe53
---> 8f158f894415
Step 4/18 : ENV GO111MODULE=on
---> Running in b9d84792d701
---> ae191ab84fdc
Step 5/18 : RUN mkdir -p ${SRC_DIR}/cmd ${SRC_DIR}/third_party ${SRC_DIR}/pkg ${SRC_DIR}/site /app/third_party /app/site
---> Running in e4dd7a508415
---> 476473d87a35
Step 6/18 : COPY go.* $SRC_DIR/
---> 2d89ca74901b
Step 7/18 : COPY cmd ${SRC_DIR}/cmd/
---> 0941a8c1561e
Step 8/18 : COPY pkg ${SRC_DIR}/pkg/
---> abede8fc7339
Step 9/18 : WORKDIR $SRC_DIR
---> Running in f2630d8b8b79
---> 61e3b2e9a02a
Step 10/18 : RUN go mod download
---> Running in 2f0eaf01df89
---> 4f782f02abf4
Step 11/18 : RUN go build cmd/server/main.go
---> Running in 6254ac7656c4
---> 490cb4b2b343
Step 12/18 : FROM gcr.io/distroless/base:latest AS triage-party
latest: Pulling from distroless/base
5dea5ec2316d: Already exists
bb771d6dc9a1: Already exists
Digest: sha256:6ec6da1888b18dd971802c2a58a76a7702902b4c9c1be28f38e75e871cedc2df
Status: Downloaded newer image for gcr.io/distroless/base:latest
---> a4cf6da932ac
Step 13/18 : ARG CFG=config/config.yaml
---> Running in 52fd27674c9b
---> 1f2ca5a3119a
Step 14/18 : COPY --from=builder /src/tparty/main /app/
---> 70d23031bd4b
Step 15/18 : COPY site /app/site/
---> 19a1094f730e
Step 16/18 : COPY third_party /app/third_party/
---> a40fcdd59328
Step 17/18 : COPY $CFG /app/config/config.yaml
---> 738d7d0bb8e4
Step 18/18 : CMD ["/app/main", "--min-refresh=30s", "--max-refresh=8m", "--site=/app/site", "--3p=/app/third_party"]
---> Running in 767e9b69f522
---> 6eab86b2bf9c
Successfully built 6eab86b2bf9c
Successfully tagged gcr.io/tstromberg-test/tparty:latest
The push refers to repository [gcr.io/tstromberg-test/tparty]
e69bd1480424: Preparing
091df7cf449a: Preparing
5331770f35ca: Preparing
b3c155ee136d: Preparing
5d09c2db1d76: Preparing
417cb9b79ade: Preparing
417cb9b79ade: Waiting
091df7cf449a: Retrying in 5 seconds
e69bd1480424: Retrying in 5 seconds
5331770f35ca: Retrying in 5 seconds
b3c155ee136d: Retrying in 5 seconds
091df7cf449a: Retrying in 4 seconds
5d09c2db1d76: Retrying in 5 seconds
e69bd1480424: Retrying in 4 seconds
5331770f35ca: Retrying in 4 seconds
b3c155ee136d: Retrying in 4 seconds
091df7cf449a: Retrying in 3 seconds
5d09c2db1d76: Retrying in 4 seconds
e69bd1480424: Retrying in 3 seconds
5331770f35ca: Retrying in 3 seconds
b3c155ee136d: Retrying in 3 seconds
091df7cf449a: Retrying in 2 seconds
5d09c2db1d76: Retrying in 3 seconds
e69bd1480424: Retrying in 2 seconds
5331770f35ca: Retrying in 2 seconds
b3c155ee136d: Retrying in 2 seconds
091df7cf449a: Retrying in 1 second
5d09c2db1d76: Retrying in 2 seconds
e69bd1480424: Retrying in 1 second
5331770f35ca: Retrying in 1 second
b3c155ee136d: Retrying in 1 second
5d09c2db1d76: Retrying in 1 second
091df7cf449a: Retrying in 10 seconds
e69bd1480424: Retrying in 10 seconds
5331770f35ca: Retrying in 10 seconds
b3c155ee136d: Retrying in 10 seconds
091df7cf449a: Retrying in 9 seconds
5d09c2db1d76: Retrying in 10 seconds
e69bd1480424: Retrying in 9 seconds
5331770f35ca: Retrying in 9 seconds
b3c155ee136d: Retrying in 9 seconds
091df7cf449a: Retrying in 8 seconds
5d09c2db1d76: Retrying in 9 seconds
e69bd1480424: Retrying in 8 seconds
5331770f35ca: Retrying in 8 seconds
b3c155ee136d: Retrying in 8 seconds
091df7cf449a: Retrying in 7 seconds
5d09c2db1d76: Retrying in 8 seconds
e69bd1480424: Retrying in 7 seconds
5331770f35ca: Retrying in 7 seconds
b3c155ee136d: Retrying in 7 seconds
091df7cf449a: Retrying in 6 seconds
5d09c2db1d76: Retrying in 7 seconds
e69bd1480424: Retrying in 6 seconds
5331770f35ca: Retrying in 6 seconds
b3c155ee136d: Retrying in 6 seconds
091df7cf449a: Retrying in 5 seconds
5d09c2db1d76: Retrying in 6 seconds
e69bd1480424: Retrying in 5 seconds
5331770f35ca: Retrying in 5 seconds
b3c155ee136d: Retrying in 5 seconds
091df7cf449a: Retrying in 4 seconds
5d09c2db1d76: Retrying in 5 seconds
e69bd1480424: Retrying in 4 seconds
5331770f35ca: Retrying in 4 seconds
b3c155ee136d: Retrying in 4 seconds
091df7cf449a: Retrying in 3 seconds
5d09c2db1d76: Retrying in 4 seconds
e69bd1480424: Retrying in 3 seconds
5331770f35ca: Retrying in 3 seconds
b3c155ee136d: Retrying in 3 seconds
091df7cf449a: Retrying in 2 seconds
5d09c2db1d76: Retrying in 3 seconds
e69bd1480424: Retrying in 2 seconds
5331770f35ca: Retrying in 2 seconds
b3c155ee136d: Retrying in 2 seconds
091df7cf449a: Retrying in 1 second
5d09c2db1d76: Retrying in 2 seconds
e69bd1480424: Retrying in 1 second
5331770f35ca: Retrying in 1 second
b3c155ee136d: Retrying in 1 second
5d09c2db1d76: Retrying in 1 second
091df7cf449a: Retrying in 15 seconds
e69bd1480424: Retrying in 15 seconds
5331770f35ca: Retrying in 15 seconds
b3c155ee136d: Retrying in 15 seconds
091df7cf449a: Retrying in 14 seconds
5d09c2db1d76: Retrying in 15 seconds
e69bd1480424: Retrying in 14 seconds
5331770f35ca: Retrying in 14 seconds
b3c155ee136d: Retrying in 14 seconds
091df7cf449a: Retrying in 13 seconds
5d09c2db1d76: Retrying in 14 seconds
e69bd1480424: Retrying in 13 seconds
5331770f35ca: Retrying in 13 seconds
b3c155ee136d: Retrying in 13 seconds
091df7cf449a: Retrying in 12 seconds
5d09c2db1d76: Retrying in 13 seconds
e69bd1480424: Retrying in 12 seconds
5331770f35ca: Retrying in 12 seconds
b3c155ee136d: Retrying in 12 seconds
091df7cf449a: Retrying in 11 seconds
5d09c2db1d76: Retrying in 12 seconds
e69bd1480424: Retrying in 11 seconds
5331770f35ca: Retrying in 11 seconds
b3c155ee136d: Retrying in 11 seconds
091df7cf449a: Retrying in 10 seconds
5d09c2db1d76: Retrying in 11 seconds
e69bd1480424: Retrying in 10 seconds
5331770f35ca: Retrying in 10 seconds
b3c155ee136d: Retrying in 10 seconds
091df7cf449a: Retrying in 9 seconds
5d09c2db1d76: Retrying in 10 seconds
e69bd1480424: Retrying in 9 seconds
5331770f35ca: Retrying in 9 seconds
b3c155ee136d: Retrying in 9 seconds
091df7cf449a: Retrying in 8 seconds
5d09c2db1d76: Retrying in 9 seconds
e69bd1480424: Retrying in 8 seconds
5331770f35ca: Retrying in 8 seconds
b3c155ee136d: Retrying in 8 seconds
091df7cf449a: Retrying in 7 seconds
5d09c2db1d76: Retrying in 8 seconds
e69bd1480424: Retrying in 7 seconds
5331770f35ca: Retrying in 7 seconds
b3c155ee136d: Retrying in 7 seconds
091df7cf449a: Retrying in 6 seconds
5d09c2db1d76: Retrying in 7 seconds
e69bd1480424: Retrying in 6 seconds
5331770f35ca: Retrying in 6 seconds
b3c155ee136d: Retrying in 6 seconds
091df7cf449a: Retrying in 5 seconds
5d09c2db1d76: Retrying in 6 seconds
e69bd1480424: Retrying in 5 seconds
5331770f35ca: Retrying in 5 seconds
b3c155ee136d: Retrying in 5 seconds
091df7cf449a: Retrying in 4 seconds
5d09c2db1d76: Retrying in 5 seconds
e69bd1480424: Retrying in 4 seconds
5331770f35ca: Retrying in 4 seconds
b3c155ee136d: Retrying in 4 seconds
091df7cf449a: Retrying in 3 seconds
5d09c2db1d76: Retrying in 4 seconds
e69bd1480424: Retrying in 3 seconds
5331770f35ca: Retrying in 3 seconds
b3c155ee136d: Retrying in 3 seconds
091df7cf449a: Retrying in 2 seconds
5d09c2db1d76: Retrying in 3 seconds
e69bd1480424: Retrying in 2 seconds
5331770f35ca: Retrying in 2 seconds
b3c155ee136d: Retrying in 2 seconds
091df7cf449a: Retrying in 1 second
5d09c2db1d76: Retrying in 2 seconds
e69bd1480424: Retrying in 1 second
5331770f35ca: Retrying in 1 second
b3c155ee136d: Retrying in 1 second
5d09c2db1d76: Retrying in 1 second
091df7cf449a: Retrying in 20 seconds
e69bd1480424: Retrying in 20 seconds
5331770f35ca: Retrying in 20 seconds
b3c155ee136d: Retrying in 20 seconds
091df7cf449a: Retrying in 19 seconds
5d09c2db1d76: Retrying in 20 seconds
e69bd1480424: Retrying in 19 seconds
5331770f35ca: Retrying in 19 seconds
b3c155ee136d: Retrying in 19 seconds
091df7cf449a: Retrying in 18 seconds
5d09c2db1d76: Retrying in 19 seconds
e69bd1480424: Retrying in 18 seconds
5331770f35ca: Retrying in 18 seconds
b3c155ee136d: Retrying in 18 seconds
091df7cf449a: Retrying in 17 seconds
5d09c2db1d76: Retrying in 18 seconds
e69bd1480424: Retrying in 17 seconds
5331770f35ca: Retrying in 17 seconds
b3c155ee136d: Retrying in 17 seconds
091df7cf449a: Retrying in 16 seconds
5d09c2db1d76: Retrying in 17 seconds
e69bd1480424: Retrying in 16 seconds
5331770f35ca: Retrying in 16 seconds
b3c155ee136d: Retrying in 16 seconds
^C^C
````

Second build
```
skaffold build
Generating tags...
- gcr.io/tejal-gke1/tparty -> gcr.io/tejal-gke1/tparty:latest
Checking cache...
- gcr.io/tejal-gke1/tparty: Not found. Building
Building [gcr.io/tejal-gke1/tparty]...
Sending build context to Docker daemon 4.064MB
Step 1/18 : FROM golang:latest AS builder
---> d5dc529b0ee7
Step 2/18 : WORKDIR /app
---> Using cache
---> c911bfdd039e
Step 3/18 : ENV SRC_DIR=/src/tparty
---> Using cache
---> 8f158f894415
Step 4/18 : ENV GO111MODULE=on
---> Using cache
---> ae191ab84fdc
Step 5/18 : RUN mkdir -p ${SRC_DIR}/cmd ${SRC_DIR}/third_party ${SRC_DIR}/pkg ${SRC_DIR}/site /app/third_party /app/site
---> Using cache
---> 476473d87a35
Step 6/18 : COPY go.* $SRC_DIR/
---> Using cache
---> 2d89ca74901b
Step 7/18 : COPY cmd ${SRC_DIR}/cmd/
---> Using cache
---> 0941a8c1561e
Step 8/18 : COPY pkg ${SRC_DIR}/pkg/
---> Using cache
---> abede8fc7339
Step 9/18 : WORKDIR $SRC_DIR
---> Using cache
---> 61e3b2e9a02a
Step 10/18 : RUN go mod download
---> Using cache
---> 4f782f02abf4
Step 11/18 : RUN go build cmd/server/main.go
---> Using cache
---> 490cb4b2b343
Step 12/18 : FROM gcr.io/distroless/base:latest AS triage-party
---> a4cf6da932ac
Step 13/18 : ARG CFG=config/config.yaml
---> Using cache
---> 1f2ca5a3119a
Step 14/18 : COPY --from=builder /src/tparty/main /app/
---> Using cache
---> 70d23031bd4b
Step 15/18 : COPY site /app/site/
---> Using cache
---> 19a1094f730e
Step 16/18 : COPY third_party /app/third_party/
---> Using cache
---> a40fcdd59328
Step 17/18 : COPY $CFG /app/config/config.yaml
---> Using cache
---> 738d7d0bb8e4
Step 18/18 : CMD ["/app/main", "--min-refresh=30s", "--max-refresh=8m", "--site=/app/site", "--3p=/app/third_party"]
---> Using cache
---> 6eab86b2bf9c
Successfully built 6eab86b2bf9c
Successfully tagged gcr.io/tejal-gke1/tparty:latest
The push refers to repository [gcr.io/tejal-gke1/tparty]
e69bd1480424: Preparing
091df7cf449a: Preparing
5331770f35ca: Preparing
b3c155ee136d: Preparing
5d09c2db1d76: Preparing
417cb9b79ade: Preparing
417cb9b79ade: Waiting
e69bd1480424: Pushed
5331770f35ca: Pushed
091df7cf449a: Pushed
417cb9b79ade: Pushed
5d09c2db1d76: Pushed
b3c155ee136d: Pushed
latest: digest: sha256:1c30c54ddc02d4210d9bd6150217d29d3056b64bf496c649192b556aeb17dc8e size: 1579
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.