Skip to content

Commit 71b587d

Browse files
authored
Publish image workflow (#8)
Signed-off-by: Andy Bavier <andybavier@gmail.com>
1 parent dc6f73a commit 71b587d

File tree

5 files changed

+64
-6
lines changed

5 files changed

+64
-6
lines changed

.github/workflows/master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
go-version-file: 'go.mod'
3333
- uses: golangci/golangci-lint-action@v4.0.0
3434
with:
35-
version: latest
35+
version: v1.52.2
3636
args: -v --config ./.golangci.yml --timeout=15m
3737

3838
unit-tests:

.github/workflows/push.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright 2024 Intel Corporation
3+
# Copyright 2025 Canonical Ltd.
4+
name: Release Pipeline
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
paths:
11+
- "VERSION"
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
# Tag GitHub Release
18+
# The convention is to prefix the version with a 'v', e.g., v1.2.3
19+
tag-github:
20+
uses: onosproject/.github/.github/workflows/tag-github.yml@main
21+
with:
22+
add_v: true
23+
secrets: inherit
24+
25+
# Build and Release Docker Image
26+
# The convention is to use the same tag for the Docker image as the GitHub Release
27+
release-image:
28+
needs: tag-github
29+
if: needs.tag-github.outputs.changed == 'true'
30+
permissions:
31+
contents: read
32+
packages: write
33+
actions: read
34+
id-token: write
35+
attestations: write
36+
uses: onosproject/.github/.github/workflows/release-image.yml@main
37+
with:
38+
docker_tag: ${{ needs.tag-github.outputs.version }}
39+
secrets: inherit
40+
41+
# Bump Version
42+
update-version:
43+
needs: tag-github
44+
if: needs.tag-github.outputs.changed == 'true'
45+
uses: onosproject/.github/.github/workflows/bump-version.yml@main
46+
secrets: inherit

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,27 @@ export GO111MODULE=on
1313

1414
KIND_CLUSTER_NAME ?= kind
1515
DOCKER_REPOSITORY ?= onosproject/
16+
DOCKER_REGISTRY ?= ""
1617
ONOS_SDCORE_ADAPTER_VERSION ?= latest
18+
DOCKER_TAG ?= ${ONOS_SDCORE_ADAPTER_VERSION}
19+
DOCKER_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}aether-mock-exporter:${DOCKER_TAG}
1720

1821
build-tools:=$(shell if [ ! -d "./build/build-tools" ]; then cd build && git clone https://github.com/onosproject/build-tools.git; fi)
1922
include ./build/build-tools/make/onf-common.mk
2023

2124
all: build images
2225

23-
images: # @HELP build simulators image
26+
images: # @HELP build all Docker images
2427
images: aether-mock-exporter-docker
2528

29+
# Docker targets for compatibility with GitHub workflow
30+
docker-build: # @HELP build Docker image
31+
docker-build: images
32+
33+
docker-push: # @HELP push Docker image
34+
docker-push:
35+
docker push ${DOCKER_IMAGENAME}
36+
2637
# @HELP build the go binary in the cmd/aether-mock-exporter package
2738
build:
2839
go build -o build/_output/aether-mock-exporter ./cmd/aether-mock-exporter
@@ -37,15 +48,15 @@ jenkins-test: build deps license linters
3748

3849
aether-mock-exporter-docker:
3950
docker build . -f Dockerfile \
40-
-t ${DOCKER_REPOSITORY}aether-mock-exporter:${ONOS_SDCORE_ADAPTER_VERSION}
51+
-t ${DOCKER_IMAGENAME}
4152

4253
kind: # @HELP build Docker images and add them to the currently configured kind cluster
4354
kind: images kind-only
4455

4556
kind-only: # @HELP deploy the image without rebuilding first
4657
kind-only:
4758
@if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi
48-
kind load docker-image --name ${KIND_CLUSTER_NAME} ${DOCKER_REPOSITORY}aether-mock-exporter:${ONOS_SDCORE_ADAPTER_VERSION}
59+
kind load docker-image --name ${KIND_CLUSTER_NAME} ${DOCKER_IMAGENAME}
4960

5061
publish: # @HELP publish version on github and dockerhub
5162
./build/build-tools/publish-version ${VERSION} onosproject/aether-mock-exporter

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.2-dev
1+
0.4.2

pkg/collector/api.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ package collector
77

88
import (
99
"fmt"
10-
"github.com/gorilla/mux"
1110
"net/http"
1211
"strconv"
12+
13+
"github.com/gorilla/mux"
1314
)
1415

1516
// Give mock-sdcore-exporter some knobs that can be manually turned.

0 commit comments

Comments
 (0)