Skip to content
This repository was archived by the owner on Mar 14, 2022. It is now read-only.

Commit 69dd6b1

Browse files
committed
initial commit
Signed-off-by: Christopher Guindon <[email protected]>
0 parents  commit 69dd6b1

26 files changed

+10706
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
5+
---
6+
7+
**Describe the bug**
8+
A clear and concise description of what the bug is.
9+
10+
**To Reproduce**
11+
Steps to reproduce the behavior:
12+
1. Go to '...'
13+
2. Click on '....'
14+
3. Scroll down to '....'
15+
4. See error
16+
17+
**Expected behavior**
18+
A clear and concise description of what you expected to happen.
19+
20+
**Screenshots**
21+
If applicable, add screenshots to help explain your problem.
22+
23+
**Desktop (please complete the following information):**
24+
- OS: [e.g. iOS]
25+
- Browser [e.g. chrome, safari]
26+
- Version [e.g. 22]
27+
28+
**Smartphone (please complete the following information):**
29+
- Device: [e.g. iPhone6]
30+
- OS: [e.g. iOS8.1]
31+
- Browser [e.g. stock browser, safari]
32+
- Version [e.g. 22]
33+
34+
**Additional context**
35+
Add any other context about the problem here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
5+
---
6+
7+
**Is your feature request related to a problem? Please describe.**
8+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9+
10+
**Describe the solution you'd like**
11+
A clear and concise description of what you want to happen.
12+
13+
**Describe alternatives you've considered**
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/node_modules/
2+
/static/images/vendor/
3+
/static/fonts/vendor/
4+
/static/js/
5+
/static/css/
6+
/public/
7+
/layouts/robots.txt
8+
.idea/**
9+
**/.DS_Store
10+
/.project

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: node_js
2+
matrix:
3+
include:
4+
- node_js: 10
5+
env: HUGO_ENV=dev
6+
- node_js: 12
7+
env: HUGO_ENV=production
8+
install:
9+
- npm install
10+
- wget https://github.com/gohugoio/hugo/releases/download/v0.62.2/hugo_0.62.2_Linux-64bit.deb
11+
- sudo dpkg -i hugo*.deb
12+
script:
13+
- if [ "$HUGO_ENV" = "dev" ]; then hugo --gc --minify --buildFuture; fi;
14+
- if [ "$HUGO_ENV" = "production" ]; then hugo --gc --minify ; fi;

CODE_OF_CONDUCT.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Community Code of Conduct
2+
3+
**Version 1.1
4+
October 21, 2019**
5+
6+
## Our Pledge
7+
8+
In the interest of fostering an open and welcoming environment, we as
9+
contributors and maintainers pledge to make participation in our project and
10+
our community a harassment-free experience for everyone, regardless of age, body
11+
size, disability, ethnicity, sex characteristics, gender identity and expression,
12+
level of experience, education, socio-economic status, nationality, personal
13+
appearance, race, religion, or sexual identity and orientation.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to creating a positive environment
18+
include:
19+
20+
* Using welcoming and inclusive language
21+
* Being respectful of differing viewpoints and experiences
22+
* Gracefully accepting constructive criticism
23+
* Focusing on what is best for the community
24+
* Showing empathy towards other community members
25+
26+
Examples of unacceptable behavior by participants include:
27+
28+
* The use of sexualized language or imagery and unwelcome sexual attention or
29+
advances
30+
* Trolling, insulting/derogatory comments, and personal or political attacks
31+
* Public or private harassment
32+
* Publishing others' private information, such as a physical or electronic
33+
address, without explicit permission
34+
* Other conduct which could reasonably be considered inappropriate in a
35+
professional setting
36+
37+
## Our Responsibilities
38+
39+
Project maintainers are responsible for clarifying the standards of acceptable
40+
behavior and are expected to take appropriate and fair corrective action in
41+
response to any instances of unacceptable behavior.
42+
43+
Project maintainers have the right and responsibility to remove, edit, or
44+
reject comments, commits, code, wiki edits, issues, and other contributions
45+
that are not aligned to this Code of Conduct, or to ban temporarily or
46+
permanently any contributor for other behaviors that they deem inappropriate,
47+
threatening, offensive, or harmful.
48+
49+
## Scope
50+
51+
This Code of Conduct applies within all project spaces, and it also applies when
52+
an individual is representing the project or its community in public spaces.
53+
Examples of representing a project or community include using an official
54+
project e-mail address, posting via an official social media account, or acting
55+
as an appointed representative at an online or offline event. Representation of
56+
a project may be further defined and clarified by project maintainers.
57+
58+
## Enforcement
59+
60+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
61+
reported by contacting the project team at [email protected]. All
62+
complaints will be reviewed and investigated and will result in a response that
63+
is deemed necessary and appropriate to the circumstances. The project team is
64+
obligated to maintain confidentiality with regard to the reporter of an incident.
65+
Further details of specific enforcement policies may be posted separately.
66+
67+
Project maintainers who do not follow or enforce the Code of Conduct in good
68+
faith may face temporary or permanent repercussions as determined by other
69+
members of the project's leadership.
70+
71+
## Attribution
72+
73+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
74+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
75+
76+
[homepage]: https://www.contributor-covenant.org
77+
78+
For answers to common questions about this code of conduct, see
79+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributing to openmdm.org
2+
3+
Thanks for your interest in this project.
4+
5+
## Project description
6+
7+
* https://github.com/EclipseFdn/openmdm.org
8+
9+
## Developer resources
10+
11+
The project maintains the following source code repositories
12+
13+
* https://github.com/EclipseFdn/openmdm.org
14+
15+
## Eclipse Contributor Agreement
16+
17+
Before your contribution can be accepted by the project team contributors must
18+
electronically sign the Eclipse Contributor Agreement (ECA).
19+
20+
* http://www.eclipse.org/legal/ECA.php
21+
22+
Commits that are provided by non-committers must have a Signed-off-by field in
23+
the footer indicating that the author is aware of the terms by which the
24+
contribution has been provided to the project. The non-committer must
25+
additionally have an Eclipse Foundation account and must have a signed Eclipse
26+
Contributor Agreement (ECA) on file.
27+
28+
For more information, please see the Eclipse Committer Handbook:
29+
https://www.eclipse.org/projects/handbook/#resources-commit
30+
31+
## Contact
32+
33+
Contact the Eclipse Foundation Webdev team via [email protected].

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ARG NGINX_IMAGE_TAG=stable-alpine-for-hugo
2+
3+
FROM debian:10-slim AS builder
4+
5+
ARG HUGO_VERSION=0.62.2
6+
ARG NODE_VERSION=10.15.0
7+
8+
RUN apt-get update && apt-get install -y \
9+
build-essential \
10+
ca-certificates \
11+
curl \
12+
git \
13+
--no-install-recommends
14+
15+
RUN curl -L -o /tmp/node.tar.xz "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
16+
&& mkdir -p /usr/local/lib/nodejs \
17+
&& tar -xJf /tmp/node.tar.xz -C /usr/local/lib/nodejs \
18+
&& ln -s /usr/local/lib/nodejs/node-v${NODE_VERSION}-linux-x64/bin/node /usr/bin/node \
19+
&& ln -s /usr/local/lib/nodejs/node-v${NODE_VERSION}-linux-x64/bin/npm /usr/bin/npm \
20+
&& ln -s /usr/local/lib/nodejs/node-v${NODE_VERSION}-linux-x64/bin/npx /usr/bin/npx
21+
22+
RUN curl -L -o /tmp/hugo.deb "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.deb" \
23+
&& dpkg -i /tmp/hugo.deb
24+
25+
WORKDIR /workdir
26+
COPY . /workdir/
27+
28+
RUN echo -n "Node.js version " && node --version \
29+
&& echo -n "npm version " && npm --version \
30+
&& hugo version
31+
32+
RUN npm --unsafe-perm ci \
33+
&& hugo
34+
35+
FROM eclipsefdn/nginx:${NGINX_IMAGE_TAG}
36+
37+
COPY --from=builder /workdir/public/ /usr/share/nginx/html/

Jenkinsfile

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
@Library('common-shared') _
2+
3+
pipeline {
4+
agent {
5+
kubernetes {
6+
label 'kubedeploy-agent'
7+
yaml '''
8+
apiVersion: v1
9+
kind: Pod
10+
spec:
11+
containers:
12+
- name: kubectl
13+
image: eclipsefdn/kubectl:1.9-alpine
14+
command:
15+
- cat
16+
tty: true
17+
resources:
18+
limits:
19+
cpu: 1
20+
memory: 1Gi
21+
- name: jnlp
22+
resources:
23+
limits:
24+
cpu: 1
25+
memory: 1Gi
26+
'''
27+
}
28+
}
29+
30+
parameters {
31+
string(name: 'hugo_version', defaultValue: '0.62.2', description: 'The Hugo version that will be used to build the website. Must match versions speficied on https://github.com/gohugoio/hugo/releases.')
32+
string(name: 'node_version', defaultValue: '10.15.3', description: 'The Node.js version that will be used to build the website. Must match versions specified on https://nodejs.org/en/download/releases/. It is adivsed to stick to LTS versions.')
33+
}
34+
35+
environment {
36+
APP_NAME = 'openmdm.org'
37+
NAMESPACE = 'foundation-internal-webdev-apps'
38+
IMAGE_NAME = 'eclipsefdn/openmdm.org'
39+
CONTAINER_NAME = 'nginx'
40+
ENVIRONMENT = sh(
41+
script: """
42+
if [ "${env.BRANCH_NAME}" = "master" ]; then
43+
printf "production"
44+
else
45+
printf "${env.BRANCH_NAME}"
46+
fi
47+
""",
48+
returnStdout: true
49+
)
50+
TAG_NAME = sh(
51+
script: """
52+
GIT_COMMIT_SHORT=\$(git rev-parse --short ${env.GIT_COMMIT})
53+
if [ "${env.ENVIRONMENT}" = "" ]; then
54+
printf \${GIT_COMMIT_SHORT}-${env.BUILD_NUMBER}
55+
else
56+
printf ${env.ENVIRONMENT}-\${GIT_COMMIT_SHORT}-${env.BUILD_NUMBER}
57+
fi
58+
""",
59+
returnStdout: true
60+
)
61+
BASE_NGINX_IMAGE_TAG = sh(
62+
script: """
63+
if [ "${env.ENVIRONMENT}" = "production" ]; then
64+
printf "stable-alpine-for-hugo"
65+
else
66+
printf "stable-alpine-for-staging"
67+
fi
68+
""",
69+
returnStdout: true
70+
)
71+
}
72+
73+
options {
74+
buildDiscarder(logRotator(numToKeepStr: '10'))
75+
}
76+
77+
triggers {
78+
// build once a week to keep up with parents images updates
79+
cron('H H * * H')
80+
}
81+
82+
stages {
83+
stage('Build docker image') {
84+
agent {
85+
label 'docker-build'
86+
}
87+
steps {
88+
sh '''
89+
docker build --pull --build-arg NGINX_IMAGE_TAG="${BASE_NGINX_IMAGE_TAG}" --build-arg HUGO_VERSION="${hugo_version}" --build-arg NODE_VERSION="${node_version}" -t ${IMAGE_NAME}:${TAG_NAME} -t ${IMAGE_NAME}:latest .
90+
'''
91+
}
92+
}
93+
94+
stage('Push docker image') {
95+
agent {
96+
label 'docker-build'
97+
}
98+
when {
99+
anyOf {
100+
environment name: 'ENVIRONMENT', value: 'production'
101+
environment name: 'ENVIRONMENT', value: 'staging'
102+
}
103+
}
104+
steps {
105+
withDockerRegistry([credentialsId: '04264967-fea0-40c2-bf60-09af5aeba60f', url: 'https://index.docker.io/v1/']) {
106+
sh '''
107+
docker push ${IMAGE_NAME}:${TAG_NAME}
108+
docker push ${IMAGE_NAME}:latest
109+
'''
110+
}
111+
}
112+
}
113+
114+
stage('Deploy to cluster') {
115+
when {
116+
anyOf {
117+
environment name: 'ENVIRONMENT', value: 'production'
118+
environment name: 'ENVIRONMENT', value: 'staging'
119+
}
120+
}
121+
steps {
122+
container('kubectl') {
123+
withKubeConfig([credentialsId: '1d8095ea-7e9d-4e94-b799-6dadddfdd18a', serverUrl: 'https://console-int.c1-ci.eclipse.org']) {
124+
sh '''
125+
DEPLOYMENT="$(k8s getFirst deployment "${NAMESPACE}" "app=${APP_NAME},environment=${ENVIRONMENT}")"
126+
if [[ $(echo "${resource}" | jq -r 'length') -eq 0 ]]; then
127+
echo "ERROR: Unable to find a deployment to patch matching '${selector}' in namespace ${namespace}"
128+
exit 1
129+
else
130+
DEPLOYMENT_NAME="$(echo "${DEPLOYMENT}" | jq -r '.metadata.name')"
131+
kubectl set image "deployment.v1.apps/${DEPLOYMENT_NAME}" -n "${NAMESPACE}" "${CONTAINER_NAME}=${IMAGE_NAME}:${TAG_NAME}" --record=true
132+
if ! kubectl rollout status "deployment.v1.apps/${DEPLOYMENT_NAME}" -n "${NAMESPACE}"; then
133+
# will fail if rollout does not succeed in less than .spec.progressDeadlineSeconds
134+
kubectl rollout undo "deployment.v1.apps/${DEPLOYMENT_NAME}" -n "${NAMESPACE}"
135+
exit 1
136+
fi
137+
fi
138+
'''
139+
}
140+
}
141+
}
142+
}
143+
}
144+
145+
post {
146+
always {
147+
deleteDir() /* clean up workspace */
148+
sendNotifications currentBuild
149+
}
150+
}
151+
}

0 commit comments

Comments
 (0)