Skip to content

Commit bca45f7

Browse files
committed
rpc: skip phase updates on checking cache and priming cache step
These steps are mapped to the same phase as pulling, and therefore won't be seen as changed from Quay. Prevent builds to move forward in if error reading/writing from/to log stream, as it doesn't affect the final artifact. Update default Dockerfile to use ubi8.
1 parent 75b61ec commit bca45f7

File tree

3 files changed

+14
-19
lines changed

3 files changed

+14
-19
lines changed

Dockerfile.centos Dockerfile

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
# syntax=docker/dockerfile:1.2
22
# Stream swaps to CentOS Stream once and is reused.
3-
FROM docker.io/library/centos:8 AS stream
3+
# FROM quay.io/centos/centos:stream8 AS stream
4+
FROM registry.access.redhat.com/ubi8/ubi:latest as base
45
RUN set -ex\
5-
; dnf -y -q install centos-release-stream \
6-
; dnf -y -q swap centos-{linux,stream}-repos \
7-
# This "|| true" is needed if building in podman, it seems.
8-
# The filesystem package tries to modify permissions on /proc.
9-
; dnf -y -q distro-sync || true \
10-
; dnf install -y 'dnf-command(config-manager)' && dnf config-manager --set-enabled powertools \
116
; dnf install -y gpgme-devel \
127
; dnf -y -q clean all
138

14-
RUN yum install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False git perl wget make gcc
9+
RUN dnf install -y --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False git perl wget make gcc
1510

1611

17-
FROM stream AS build
18-
LABEL maintainer "Quay devel<[email protected]>"
12+
FROM base AS build
1913

2014
ARG BUILDER_SRC
2115

@@ -34,7 +28,7 @@ COPY . /go/src/${BUILDER_SRC}
3428
RUN cd /go/src/${BUILDER_SRC} && go mod vendor && make build
3529

3630

37-
FROM stream AS final
31+
FROM base AS final
3832
LABEL maintainer "Quay devel<[email protected]>"
3933

4034
ARG BUILDER_SRC

buildctx/context.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ func (bc *Context) Pull() error {
101101
// Cache calls an RPC to the BuildManager to find the best tag to pull for
102102
// caching and then "docker pull"s it.
103103
func (bc *Context) Cache() error {
104-
if err := bc.client.SetPhase(rpc.CheckingCache, nil); err != nil {
105-
log.Errorf("failed to update phase to `checking-cache`")
106-
return err
107-
}
104+
// Attempts to update the phase to checking cache.
105+
// We don't handle the error here, as we currently consider the rpc.CheckingCache phase pulling,
106+
// SetPhase will return an rpc.ErrClientRejectedPhaseTransition, since the phase will not change
107+
// from the previous one (rpc.CheckingCache).
108+
bc.client.SetPhase(rpc.CheckingCache, nil)
108109

109110
// Attempt to calculate the optimal tag. If we cannot find a tag, then caching is simply
110111
// skipped.
@@ -116,10 +117,7 @@ func (bc *Context) Cache() error {
116117

117118
// Conduct a pull of the existing tag (if any). This will prime the cache.
118119
if bc.args.PullToken != "" && cachedTag != "" {
119-
if err := bc.client.SetPhase(rpc.PrimingCache, nil); err != nil {
120-
log.Errorf("failed to update phase to `priming-cache`")
121-
return err
122-
}
120+
bc.client.SetPhase(rpc.PrimingCache, nil)
123121

124122
err = primeCache(bc.writer, bc.containerClient, bc.args, cachedTag)
125123
if err != nil {

rpc/grpcbuild/grpcbuild.go

+3
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ func (c *grpcClient) PublishBuildLogEntry(entry string) error {
170170
LogMessage: entry,
171171
},
172172
)
173+
if err == io.EOF {
174+
return nil
175+
}
173176
if err != nil {
174177
log.Warningf("failed to get log message: %s", err)
175178
c.logSequenceNum -= 1

0 commit comments

Comments
 (0)