Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
liranbg committed Jul 18, 2024
1 parent 42d38d4 commit eeefd7b
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 5 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: CI

on:
pull_request:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: make build
39 changes: 39 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Release

on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Login to GCR
uses: docker/login-action@v3
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_IGUAZIO_JSON_KEY }}

- name: Build and push
run: make release
env:
GRAFANA_VERSION: ${{ github.event.release.tag_name }}
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Iguazio
# Copyright 2024 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

ARG GRAFANA_VERSION
FROM grafana/grafana:$GRAFANA_VERSION as plugins_fetcher

Expand All @@ -38,4 +39,10 @@ RUN grafana-cli plugins install agenty-flowcharting-panel \
&& grafana-cli plugins install tdengine-datasource

FROM grafana/grafana:$GRAFANA_VERSION

# update OS packages
USER root
RUN apk upgrade --no-cache

USER grafana
COPY --from=plugins_fetcher /var/lib/grafana/plugins /opt/plugins
21 changes: 17 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 Iguazio
# Copyright 2024 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,9 +13,13 @@
# limitations under the License.
#

GRAFANA_VERSION ?= 9.2.2
GRAFANA_VERSION ?= 9.2.20
IGUAZIO_REPOSITORY ?= gcr.io/iguazio/

# if GRAFANA_VERSION has "-" then take the first part
# we use the `-` for github releases to add the build number
GRAFANA_VERSION := $(firstword $(subst -, ,$(GRAFANA_VERSION)))


.PHONY: all
all: build
Expand All @@ -25,11 +29,20 @@ all: build
build: grafana-wplugins
@echo Done.

.PHONY: push
push:
docker push $(IGUAZIO_REPOSITORY)grafana-wplugins:$(GRAFANA_VERSION)

.PHONY: release
release: build push
@echo Done.

.PHONY: grafana-wplugins
grafana-wplugins:
docker build \
docker \
build \
--platform linux/amd64 \
--file ./Dockerfile \
--tag $(IGUAZIO_REPOSITORY)grafana-wplugins:$(GRAFANA_VERSION) \
--build-arg GRAFANA_VERSION=$(GRAFANA_VERSION) \
.

0 comments on commit eeefd7b

Please sign in to comment.