Skip to content

Commit c1dadef

Browse files
authored
.travis.yml,Makefile: add automatic scorecard image deployment (#952)
**Description of the change:** Build and push scorecard proxy images in travis **Motivation for the change:** Closes #940
1 parent 44c755b commit c1dadef

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,10 @@ jobs:
9090
script:
9191
- make image/build/helm
9292
- make image/push/helm
93+
94+
# Build and deploy scorecard-proxy docker image
95+
- <<: *deploy
96+
name: Docker image for scorecard-proxy
97+
script:
98+
- make image/build/scorecard-proxy
99+
- make image/push/scorecard-proxy

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ PKGS = $(shell go list ./... | grep -v /vendor/)
1616

1717
ANSIBLE_BASE_IMAGE = quay.io/operator-framework/ansible-operator
1818
HELM_BASE_IMAGE = quay.io/operator-framework/helm-operator
19+
SCORECARD_PROXY_BASE_IMAGE = quay.io/operator-framework/scorecard-proxy
1920

2021
ANSIBLE_IMAGE ?= $(ANSIBLE_BASE_IMAGE)
2122
HELM_IMAGE ?= $(HELM_BASE_IMAGE)
23+
SCORECARD_PROXY_IMAGE ?= $(SCORECARD_PROXY_BASE_IMAGE)
2224

2325
export CGO_ENABLED:=0
2426

@@ -111,20 +113,26 @@ test/markdown:
111113

112114
image: image/build image/push
113115

114-
image/build: image/build/ansible image/build/helm
116+
image/build: image/build/ansible image/build/helm image/build/scorecard-proxy
115117

116118
image/build/ansible: build/operator-sdk-dev-x86_64-linux-gnu
117119
./hack/image/build-ansible-image.sh $(ANSIBLE_BASE_IMAGE):dev
118120

119121
image/build/helm: build/operator-sdk-dev-x86_64-linux-gnu
120122
./hack/image/build-helm-image.sh $(HELM_BASE_IMAGE):dev
121123

122-
image/push: image/push/ansible image/push/helm
124+
image/build/scorecard-proxy:
125+
./hack/image/build-scorecard-proxy-image.sh $(SCORECARD_PROXY_BASE_IMAGE):dev
126+
127+
image/push: image/push/ansible image/push/helm image/push/scorecard-proxy
123128

124129
image/push/ansible:
125130
./hack/image/push-image-tags.sh $(ANSIBLE_BASE_IMAGE):dev $(ANSIBLE_IMAGE)
126131

127132
image/push/helm:
128133
./hack/image/push-image-tags.sh $(HELM_BASE_IMAGE):dev $(HELM_IMAGE)
129134

135+
image/push/scorecard-proxy:
136+
./hack/image/push-image-tags.sh $(SCORECARD_PROXY_BASE_IMAGE):dev $(SCORECARD_PROXY_IMAGE)
137+
130138
.PHONY: image image/build image/build/ansible image/build/helm image/push image/push/ansible image/push/helm

commands/operator-sdk/cmd/scorecard.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
package cmd
1616

1717
import (
18+
"fmt"
19+
"strings"
20+
1821
log "github.com/sirupsen/logrus"
1922
"github.com/spf13/cobra"
2023

2124
"github.com/operator-framework/operator-sdk/commands/operator-sdk/cmd/scorecard"
25+
"github.com/operator-framework/operator-sdk/version"
2226
)
2327

2428
func NewScorecardCmd() *cobra.Command {
@@ -39,7 +43,7 @@ func NewScorecardCmd() *cobra.Command {
3943
scorecardCmd.Flags().StringVar(&scorecard.SCConf.NamespacedManifest, "namespaced-manifest", "", "Path to manifest for namespaced resources (e.g. RBAC and Operator manifest)")
4044
scorecardCmd.Flags().StringVar(&scorecard.SCConf.GlobalManifest, "global-manifest", "", "Path to manifest for Global resources (e.g. CRD manifests)")
4145
scorecardCmd.Flags().StringVar(&scorecard.SCConf.CRManifest, "cr-manifest", "", "Path to manifest for Custom Resource")
42-
scorecardCmd.Flags().StringVar(&scorecard.SCConf.ProxyImage, "proxy-image", "quay.io/operator-framework/scorecard-proxy", "Image name for scorecard proxy")
46+
scorecardCmd.Flags().StringVar(&scorecard.SCConf.ProxyImage, "proxy-image", fmt.Sprintf("quay.io/operator-framework/scorecard-proxy:%s", strings.TrimSuffix(version.Version, "+git")), "Image name for scorecard proxy")
4347
scorecardCmd.Flags().StringVar(&scorecard.SCConf.ProxyPullPolicy, "proxy-pull-policy", "Always", "Pull policy for scorecard proxy image")
4448
scorecardCmd.Flags().BoolVar(&scorecard.SCConf.Verbose, "verbose", false, "Enable verbose logging")
4549
// Since it's difficult to handle multiple CRs, we will require users to specify what CR they want to test; we can handle this better in the future

0 commit comments

Comments
 (0)