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

Add microservice to sync individual repos #106

Merged
merged 1 commit into from
May 21, 2020
Merged
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
49 changes: 49 additions & 0 deletions Dockerfile.sync-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM fedora:latest
LABEL \
name="sync2jira" \
description="sync2jira application" \
vendor="sync2jira developers" \
license="GPLv2+" \
build-date=""

# Installing sync2jira dependencies
RUN dnf -y install \
git \
python3-pip \
python3-requests \
python3-jira \
python3-fedmsg-core \
python3-pygithub \
python3-jinja2 \
python3-pypandoc \
python3-requests-kerberos \
python3-flask \
&& dnf -y clean all

ARG SYNC2JIRA_GIT_REPO=https://github.com/release-engineering/Sync2Jira.git
ARG SYNC2JIRA_GIT_REF=master
ARG SYNC2JIRA_CACERT_URL=
ARG SYNC2JIRA_VERSION=
ENV SYNC2JIRA_VERSION=$SYNC2JIRA_VERSION
ENV SYNC2JIRA_CACERT_URL=$SYNC2JIRA_CACERT_URL

USER root

# Create Sync2Jira folder
RUN mkdir -p /usr/local/src/sync2jira

# Copy over our repo
COPY . /usr/local/src/sync2jira

# Install Sync2Jira
RUN pip3 install --no-deps -v /usr/local/src/sync2jira

# To deal with JIRA issues (i.e. SSL errors)
RUN chmod g+w /etc/pki/tls/certs/ca-bundle.crt
RUN chmod 777 /usr/local/src/sync2jira/openshift/docker-entrypoint.sh

USER 1001

ENTRYPOINT ["/usr/local/src/sync2jira/openshift/docker-entrypoint.sh"]

CMD ["python3", "/usr/local/src/sync2jira/sync-page/event-handler.py"]
176 changes: 176 additions & 0 deletions openshift/sync2jira-sync-page-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
apiVersion: v1
kind: Template
metadata:
name: sync2jira-sync-page-template
app: sync2jira-sync-page
labels:
app: sync2jira-sync-page
parameters:
- name: CA_URL
displayName: CA URL used for sync2jira
required: true
- name: DEFAULT_SERVER
displayName: Default server to use for mailing
required: true
- name: DEFAULT_FROM
displayName: Default from to use for mailing
required: true
- name: USER
displayName: JIRA username
required: true
- name: CONFLUENCE_SPACE
displayName: Confluence space
required: true
value: "mock_confluence_space"
- name: INITILIZE
displayName: True/False Initilize our repos on startup
value: "0"
- name: IMAGE_URL
displayName: Image URL:TAG to pull from
value: "quay.io/redhat-aqe/sync2jira:sync-page"
- name: JIRA_PNT_PASS
displayName: PNT password in base64
required: true
- name: JIRA_OMEGAPRIME_PASS
displayName: Omegaprime password in base64
required: true
- name: GITHUB_TOKEN
displayName: GitHub token in base64
required: true
- name: PAAS_DOMAIN
displayName: Domain to use for the service
required: true
objects:
- apiVersion: v1
kind: ImageStream
metadata:
labels:
app: sync2jira-sync-page
annotations:
openshift.io/display-name: sync2jira-sync-page
name: sync2jira-sync-page
spec:
lookupPolicy:
local: false
tags:
- from:
kind: DockerImage
name: ${IMAGE_URL}
name: latest
referencePolicy:
type: Source
- apiVersion: v1
kind: Secret
metadata:
name: sync2jira-secret
labels:
app: sync2jira-stage
data:
jira_pnt_pass: |-
${JIRA_PNT_PASS}
jira_omegaprime_pass: |-
${JIRA_OMEGAPRIME_PASS}
sync2jira-confluence: |-
${SYNC2JIRA_CONFLUENCE_PASS}
github_token: |-
${GITHUB_TOKEN}
- apiVersion: v1
kind: Route
metadata:
name: sync2jira-sync-page
labels:
app: sync2jira-sync-page
spec:
host: sync2jira-page-sync.${PAAS_DOMAIN}
to:
kind: Service
name: sync2jira-sync-page
port:
targetPort: http
- apiVersion: v1
kind: Service
metadata:
name: sync2jira-sync-page
labels:
app: sync2jira-sync-page
spec:
selector:
service: sync2jira-sync-page
ports:
- name: http
port: 80
targetPort: http
- apiVersion: v1
kind: DeploymentConfig
metadata:
name: sync2jira-sync-page
labels:
app: sync2jira-sync-page
spec:
selector:
service: sync2jira-sync-page
template:
metadata:
labels:
app: sync2jira-sync-page
service: sync2jira-sync-page
spec:
containers:
- name: sync2jira-sync-page-container
image: sync2jira-sync-page:latest
imagePullPolicy: Always
ports:
- name: http
containerPort: 5000
volumeMounts:
- name: fedmsgd-volume
mountPath: /etc/fedmsg.d
readOnly: true
env:
- name: BASE_URL
value: 0.0.0.0
- name: REDIRECT_URL
value: sync2jira-page-sync.${PAAS_DOMAIN}
- name: INITIALIZE
value: ${INITILIZE}
- name: CA_URL
value: ${CA_URL}
- name: DEFAULT_SERVER
value: ${DEFAULT_SERVER}
- name: DEFAULT_FROM
value: ${DEFAULT_FROM}
- name: USER
value: ${USER}
- name: SYNC2JIRA_PNTJIRA_PASS
valueFrom:
secretKeyRef:
key: jira_pnt_pass
name: sync2jira-secret
- name: SYNC2JIRA_OMEGAPRIME_PASS
valueFrom:
secretKeyRef:
key: jira_omegaprime_pass
name: sync2jira-secret
- name: SYNC2JIRA_GITHUB_TOKEN
valueFrom:
secretKeyRef:
key: github_token
name: sync2jira-secret
- name: CONFLUENCE_SPACE
value: ${CONFLUENCE_SPACE}
- name: INITILIZE
value: ${INITILIZE}
volumes:
- name: fedmsgd-volume
configMap:
name: fedmsgd
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- sync2jira-sync-page-container
from:
kind: ImageStreamTag
name: sync2jira-sync-page:latest
- type: ConfigChange
Empty file added sync-page/__init__.py
Empty file.
Loading