Skip to content

Commit

Permalink
github: Build all required images
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdrichard committed Oct 11, 2023
1 parent 8189f1f commit b1201ba
Show file tree
Hide file tree
Showing 8 changed files with 96 additions and 18 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-bundle-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy Bundle Images to GHCR
env:
DOTNET_VERSION: '6.0.x'
on:
push:
branches:
- master
workflow_dispatch:
jobs:
push-bundle-image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: '.'
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Build Bundle Image'
run: |
make bundle
make bundle-build
make bundle-push
2 changes: 1 addition & 1 deletion .github/workflows/build-daemon-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- master
workflow_dispatch:
jobs:
push-store-image:
push-daemon-image:
runs-on: ubuntu-latest
defaults:
run:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/build-operator-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy Operator Images to GHCR
env:
DOTNET_VERSION: '6.0.x'
on:
push:
branches:
- master
workflow_dispatch:
jobs:
push-operator-image:
runs-on: ubuntu-latest
defaults:
run:
working-directory: '.'
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: 'Build Operator Image'
run: |
make docker-build
make docker-push
15 changes: 6 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 4.13
VERSION ?= 0.1

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
Expand All @@ -29,14 +29,14 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# openshift.io/ptp-operator-bundle:$VERSION and openshift.io/ptp-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= openshift.io/ptp-operator
IMAGE_TAG_BASE ?= ghcr.io/k8snetworkplumbingwg/ptp-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)

# Image URL to use all building/pushing image targets
IMG ?= quay.io/openshift/origin-ptp-operator:$(VERSION)
IMG ?= ghcr.io/k8snetworkplumbingwg/ptp-operator:latest

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -101,7 +101,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

docker-build: #test ## Build docker image with the manager.
docker build -t ${IMG} .
docker build -t ${IMG} -f Dockerfile.operator .

docker-push: ## Push docker image with the manager.
docker push ${IMG}
Expand Down Expand Up @@ -170,7 +170,7 @@ bundle: operator-sdk manifests kustomize

.PHONY: bundle-build ## Build the bundle image.
bundle-build:
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
docker build -f Dockerfile.bundle -t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
Expand Down Expand Up @@ -226,9 +226,6 @@ deps-update:
bin:
hack/build.sh

image:
docker build -t openshift.io/ptp-operator -f Dockerfile.rhel7 .

clean:
rm -rf build/_output/bin/ptp-operator

Expand All @@ -254,7 +251,7 @@ daemon-image:
./hack/build-daemon-image.sh

daemon-push:
docker push ghcr.io/josephdrichard/linuxptp-daemon:latest
docker push ghcr.io/k8snetworkplumbingwg/linuxptp-daemon:latest

leapfile:
wget https://www.ietf.org/timezones/data/leap-seconds.list -O ./extra/leap-seconds.list
20 changes: 20 additions & 0 deletions bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM scratch

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=ptp-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.22.0-ocp
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
6 changes: 3 additions & 3 deletions bundle/manifests/ptp-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ metadata:
provider: Red Hat
repository: https://github.com/k8snetworkplumbingwg/ptp-operator
support: Red Hat
name: ptp-operator.v4.13.0
name: ptp-operator.v0.1.0
namespace: openshift-ptp
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -383,7 +383,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.name
image: quay.io/openshift/origin-ptp-operator:4.13
image: ghcr.io/k8snetworkplumbingwg/ptp-operator:latest
imagePullPolicy: IfNotPresent
name: ptp-operator
ports:
Expand Down Expand Up @@ -478,7 +478,7 @@ spec:
maturity: alpha
provider:
name: Red Hat
version: 4.13.0
version: 0.1.0
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/openshift/origin-ptp-operator
newTag: "4.13"
newName: ghcr.io/k8snetworkplumbingwg/ptp-operator
newTag: latest
patchesStrategicMerge:
- env.yaml
6 changes: 3 additions & 3 deletions manifests/stable/ptp-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ metadata:
provider: Red Hat
repository: https://github.com/k8snetworkplumbingwg/ptp-operator
support: Red Hat
name: ptp-operator.v4.13.0
name: ptp-operator.v0.1.0
namespace: openshift-ptp
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -383,7 +383,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.name
image: quay.io/openshift/origin-ptp-operator:4.13
image: ghcr.io/k8snetworkplumbingwg/ptp-operator:latest
imagePullPolicy: IfNotPresent
name: ptp-operator
ports:
Expand Down Expand Up @@ -478,7 +478,7 @@ spec:
maturity: alpha
provider:
name: Red Hat
version: 4.13.0
version: 0.1.0
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down

0 comments on commit b1201ba

Please sign in to comment.