Skip to content

Commit 1db138b

Browse files
baghbidibaghbidi
authored andcommitted
Merge branch 'develop' of github.com:eclipse-iofog/iofog-operator
2 parents 8468744 + 072e7ce commit 1db138b

19 files changed

+209
-64
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ tags
7878

7979
/vendor/
8080
/.idea/*
81-
81+
/bin/

.travis.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM golang:1.12-alpine as backend
2+
3+
COPY . /go/src/github.com/eclipse-iofog/iofog-operator
4+
WORKDIR /go/src/github.com/eclipse-iofog/iofog-operator
5+
RUN apk add --update --no-cache bash curl git make && \
6+
make vendor && \
7+
make build
8+
9+
FROM alpine:3.7
10+
COPY --from=backend /go/src/github.com/eclipse-iofog/iofog-operator/bin /bin
11+
12+
ENTRYPOINT ["/bin/iofog-operator"]

Gopkg.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ required = [
4646
[[constraint]]
4747
name = "github.com/operator-framework/operator-sdk"
4848
# The version rule is used for a specific release and the master branch for in between releases.
49-
branch = "master" #osdk_branch_annotation
50-
# version = "=v0.3.0" #osdk_version_annotation
49+
# branch = "master" #osdk_branch_annotation
50+
version = "=v0.8.0" #osdk_version_annotation
5151

5252
[prune]
5353
go-tests = true

Makefile

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ SHELL = /bin/bash
22
OS = $(shell uname -s)
33

44
# Project variables
5-
PACKAGE = github.com/iofog/iofog-operator
5+
PACKAGE = github.com/eclipse-iofog/iofog-operator
66
BINARY_NAME = iofog-operator
77
IMAGE = iofog/iofog-operator
8-
TAG ?= dev
98

109
# Build variables
1110
BUILD_DIR ?= bin
@@ -24,7 +23,10 @@ DEP_VERSION = 0.5.0
2423
GOLANG_VERSION = 1.11
2524
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./client/*")
2625

27-
# Golang build targets
26+
BRANCH ?= $(TRAVIS_BRANCH)
27+
RELEASE_TAG ?= 0.0.0
28+
29+
2830
.PHONY: clean
2931
clean: ## Clean the working area and the project
3032
rm -rf $(BUILD_DIR)/ vendor/
@@ -42,12 +44,37 @@ vendor: bin/dep ## Install dependencies
4244

4345
.PHONY: build
4446
build: GOARGS += -tags "$(GOTAGS)" -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)
45-
build: ## Build a binary
47+
build:
4648
ifneq ($(IGNORE_GOLANG_VERSION_REQ), 1)
4749
@printf "$(GOLANG_VERSION)\n$$(go version | awk '{sub(/^go/, "", $$3);print $$3}')" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -g | head -1 | grep -q -E "^$(GOLANG_VERSION)$$" || (printf "Required Go version is $(GOLANG_VERSION)\nInstalled: `go version`" && exit 1)
4850
endif
4951
go build $(GOARGS) $(BUILD_PACKAGE)
5052

53+
.PHONY: build-img
54+
build-img:
55+
docker build --rm -t $(IMAGE):latest -f Dockerfile .
56+
57+
.PHONY: push-img
58+
push-img:
59+
@echo $(DOCKER_PASS) | docker login -u $(DOCKER_USER) --password-stdin
60+
ifeq ($(BRANCH), master)
61+
# Master branch
62+
docker push $(IMAGE):latest
63+
docker tag $(IMAGE):latest $(IMAGE):$(RELEASE_TAG)
64+
docker push $(IMAGE):$(RELEASE_TAG)
65+
endif
66+
ifneq (,$(findstring release,$(BRANCH)))
67+
# Release branch
68+
docker tag $(IMAGE):latest $(IMAGE):rc-$(RELEASE_TAG)
69+
docker push $(IMAGE):rc-$(RELEASE_TAG)
70+
else
71+
# Develop and feature branches
72+
docker tag $(IMAGE):latest $(IMAGE)-$(BRANCH):latest
73+
docker push $(IMAGE)-$(BRANCH):latest
74+
docker tag $(IMAGE):latest $(IMAGE)-$(BRANCH):$(COMMIT_HASH)
75+
docker push $(IMAGE)-$(BRANCH):$(COMMIT_HASH)
76+
endif
77+
5178
.PHONY: fmt
5279
fmt:
5380
@gofmt -s -w $(GOFILES_NOVENDOR)

azure-pipelines.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
trigger:
2+
tags:
3+
include:
4+
- v.*
5+
branches:
6+
include:
7+
- develop
8+
- release*
9+
paths:
10+
exclude:
11+
- README.md
12+
13+
variables:
14+
repository: 'focal-freedom-236620/operator'
15+
primaryTag: $(Build.SourceBranchName)
16+
17+
jobs:
18+
- job: Operator
19+
pool:
20+
vmImage: 'Ubuntu-16.04'
21+
22+
steps:
23+
- script: |
24+
echo 'setting secondary tag'
25+
echo "##vso[task.setvariable variable=secondaryTag]b-$(Build.BuildId)"
26+
27+
if [[ $(Build.SourceBranch) == refs/heads/release* ]]; then
28+
echo "##vso[task.setvariable variable=primaryTag]rc-$(Build.SourceBranchName)"
29+
#If branch starts with ref/tags, apply latest and version tag
30+
elif [[ $(Build.SourceBranch) == refs/tags* ]]; then
31+
primaryTag= echo $(primaryTag) | awk '{print substr($1,2);}'
32+
echo $primaryTag
33+
echo "##vso[task.setvariable variable=primaryTag]$primaryTag"
34+
echo "##vso[task.setvariable variable=secondaryTag]latest"
35+
fi
36+
displayName: 'Set Tag variable'
37+
name: setvarStep
38+
39+
- task: Docker@2
40+
displayName: 'build docker'
41+
inputs:
42+
containerRegistry: 'Edgeworx GCP'
43+
repository: $(repository)
44+
command: 'buildAndPush'
45+
Dockerfile: 'Dockerfile'
46+
tags: |
47+
$(primaryTag)
48+
$(secondaryTag)

build/Dockerfile

Lines changed: 0 additions & 15 deletions
This file was deleted.

cmd/manager/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"os"
88
"runtime"
99

10-
"github.com/iofog/iofog-operator/pkg/apis"
11-
"github.com/iofog/iofog-operator/pkg/controller"
10+
"github.com/eclipse-iofog/iofog-operator/pkg/apis"
11+
"github.com/eclipse-iofog/iofog-operator/pkg/controller"
1212
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
1313
"github.com/operator-framework/operator-sdk/pkg/leader"
1414
"github.com/operator-framework/operator-sdk/pkg/ready"

create.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kubectl create -f deploy/service_account.yaml
2+
kubectl create -f deploy/role.yaml
3+
kubectl create -f deploy/role_binding.yaml
4+
kubectl create -f deploy/namespace.yaml
5+
kubectl create -f deploy/crds/k8s_v1alpha1_iofog_crd.yaml
6+

0 commit comments

Comments
 (0)