Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Rid of being a fork? #1

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_ENDPOINT=http://127.0.0.1:8082
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_ENDPOINT=http://127.0.0.1:8082
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_ENDPOINT=
1 change: 1 addition & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_ENDPOINT=
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx AS release

COPY dist /usr/share/nginx/html
70 changes: 70 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@Library("sharedLibraries")

def parent = "red"
def project = "swerve-ui"

podTemplate(name: 'jenkins-agent-swerve-ui',
podRetention: never(),
yamlMergeStrategy: merge(),
inheritFrom: 'jenkins-agent-nodejs-10 jenkins-agent-docker jenkins-agent-kubetools') {

node(POD_LABEL) {

stage("clone repository") {
deleteDir()
checkout(scm)
}

def BRANCH_NAME = getBranchName()

parent = "${parent}${BRANCH_NAME != "master" ? '-branches' : ''}"

def dockerBuildOnly = BRANCH_NAME == "" ? true : false

container("nodejs") {
stage("build") {

initNodeJS()

sh """
yarn global add @vue/cli
yarn install
"""

if (BRANCH_NAME == "master") {
sh "yarn build --mode production"
} else {
sh "yarn build --mode staging"
}
}
}

// build docker image
def imageTag = buildDockerContainer2(
parent: "${parent}",
project: "${project}",
branch: "${BRANCH_NAME}",
dockerBuildOnly: dockerBuildOnly
)

if (!dockerBuildOnly) {
deployKubernetes(
parent: "${parent}",
project: "${project}",
imageTag: "${imageTag}",
namespace: "red-stg",
env: "stg"
)

if (BRANCH_NAME == "master") {
deployKubernetes(
parent: "${parent}",
project: "${project}",
imageTag: "${imageTag}",
namespace: "red-prd",
env: "prd"
)
}
}
}
}
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
PROJECT=swerve-ui
PARENT=red

REGISTRY=spring-docker.jfrog.io
IMAGE_NAME=$(REGISTRY)/$(PARENT)/$(PROJECT)
IMAGE_LATEST=$(IMAGE_NAME):latest
GIT_HASH=$(shell git rev-parse --short HEAD)
FULL_NAME=$(IMAGE_NAME):$(GIT_HASH)

# test if the make is running inside a Jenkins, then set different network options than on Docker for Mac
ifdef BUILD_NUMBER
HOSTNAME=$(shell hostname)
NETWORK=$(shell docker ps -q --filter 'label=io.kubernetes.pod.name=$(HOSTNAME)' -n1)
DOCKER_OPT_ARGS=--pull --network=container:$(NETWORK)
else
DOCKER_OPT_ARGS=--pull
endif

.DEFAULT_GOAL: build

.PHONY: build
build:
docker build $(DOCKER_OPT_ARGS) -t $(FULL_NAME) --build-arg NODE_ENV=$(NODE_ENV) .
docker tag $(FULL_NAME) $(IMAGE_LATEST)

.PHONY: release
release: build
docker push $(IMAGE_LATEST)
docker push $(FULL_NAME)

.PHONY: gettag
gettag:
@echo $(GIT_HASH)

.PHONY: run
run: build
docker run $(IMAGE_LATEST)
9 changes: 9 additions & 0 deletions helm/values-prd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
url:
- "swerve-ui.prd.red.springtools.de"
resources:
requests:
memory: "256Mi"
cpu: "200m"
limits:
memory: "512Mi"
cpu: "1"
9 changes: 9 additions & 0 deletions helm/values-stg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
url:
- "swerve-ui.stg.red.springtools.de"
resources:
requests:
memory: "256Mi"
cpu: "200m"
limits:
memory: "512Mi"
cpu: "1"
Loading