From 49c45a54157d13f3f488a0176d02b369dc23bc1d Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 13:10:35 +0200 Subject: [PATCH 001/109] add files --- Dockerfile | 9 +++ Jenkinsfile | 13 +++++ init-container/Dockerfile | 9 +++ init-container/Jenkinsfile | 13 +++++ init-container/template.yaml | 103 +++++++++++++++++++++++++++++++++++ template.yaml | 103 +++++++++++++++++++++++++++++++++++ 6 files changed, 250 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 init-container/Dockerfile create mode 100644 init-container/Jenkinsfile create mode 100644 init-container/template.yaml create mode 100644 template.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a9628d1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.6.7-alpine +MAINTAINER Artem Kubrachenko +COPY . /app +WORKDIR /app +RUN apk --no-cache add build-base +RUN apk --no-cache add postgresql-dev +RUN pip install -r requirements.txt +ENTRYPOINT ["python"] +CMD ["dbservice.py"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3e2fbc2 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,13 @@ +node { + def app + + // Checking, that the repository was cloned to workspace + stage('Clone repository') { + + checkout scm + gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) + + } + + //Push to claster +} \ No newline at end of file diff --git a/init-container/Dockerfile b/init-container/Dockerfile new file mode 100644 index 0000000..a9628d1 --- /dev/null +++ b/init-container/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.6.7-alpine +MAINTAINER Artem Kubrachenko +COPY . /app +WORKDIR /app +RUN apk --no-cache add build-base +RUN apk --no-cache add postgresql-dev +RUN pip install -r requirements.txt +ENTRYPOINT ["python"] +CMD ["dbservice.py"] diff --git a/init-container/Jenkinsfile b/init-container/Jenkinsfile new file mode 100644 index 0000000..3e2fbc2 --- /dev/null +++ b/init-container/Jenkinsfile @@ -0,0 +1,13 @@ +node { + def app + + // Checking, that the repository was cloned to workspace + stage('Clone repository') { + + checkout scm + gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) + + } + + //Push to claster +} \ No newline at end of file diff --git a/init-container/template.yaml b/init-container/template.yaml new file mode 100644 index 0000000..b7eb092 --- /dev/null +++ b/init-container/template.yaml @@ -0,0 +1,103 @@ +#Production namespace +apiVersion: v1 +kind: Namespace +metadata: + name: production +--- +#Test secret +apiVersion: v1 +kind: Secret +metadata: + name: db-secret + namespace: production +data: + username: ZGJhZG1pbg== + password: UGFzc3dvcmQ= + dbname: c3Jtc3lzdGVt +type: Opaque + +--- +kind: PersistentVolume +apiVersion: v1 +metadata: + name: postgres-pv + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 2M + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: production + labels: + app: postgres + name: postgres-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2M + +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + namespace: production + name: postgres +spec: + replicas: 1 + template: + metadata: + labels: + app: postgres + spec: + containers: + - image: postgres:9.6.2 + name: postgresql + env: + - name: POSTGRES_DATABASE + valueFrom: + secretKeyRef: + name: db-secret + key: dbname + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: db-secret + key: username + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: db-secret + key: password + ports: + - containerPort: 5432 + volumeMounts: + - name: postgres-pv-claim + mountPath: /var/lib/postgresql/data + volumes: + - name: postgres-pv-claim + persistentVolumeClaim: + claimName: postgres-pv-claim + +--- +kind: Service +apiVersion: v1 +metadata: + namespace: production + name: srmsystemdb +spec: + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 diff --git a/template.yaml b/template.yaml new file mode 100644 index 0000000..b7eb092 --- /dev/null +++ b/template.yaml @@ -0,0 +1,103 @@ +#Production namespace +apiVersion: v1 +kind: Namespace +metadata: + name: production +--- +#Test secret +apiVersion: v1 +kind: Secret +metadata: + name: db-secret + namespace: production +data: + username: ZGJhZG1pbg== + password: UGFzc3dvcmQ= + dbname: c3Jtc3lzdGVt +type: Opaque + +--- +kind: PersistentVolume +apiVersion: v1 +metadata: + name: postgres-pv + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 2M + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: production + labels: + app: postgres + name: postgres-pv-claim +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2M + +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + namespace: production + name: postgres +spec: + replicas: 1 + template: + metadata: + labels: + app: postgres + spec: + containers: + - image: postgres:9.6.2 + name: postgresql + env: + - name: POSTGRES_DATABASE + valueFrom: + secretKeyRef: + name: db-secret + key: dbname + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: db-secret + key: username + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: db-secret + key: password + ports: + - containerPort: 5432 + volumeMounts: + - name: postgres-pv-claim + mountPath: /var/lib/postgresql/data + volumes: + - name: postgres-pv-claim + persistentVolumeClaim: + claimName: postgres-pv-claim + +--- +kind: Service +apiVersion: v1 +metadata: + namespace: production + name: srmsystemdb +spec: + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 From 25ec19fb4ec8429e7fc03d206b6991535a921ee1 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 15:06:27 +0200 Subject: [PATCH 002/109] changes --- Dockerfile | 2 +- Jenkinsfile | 19 +++ app/config.py | 6 - app/dbconnect.py | 13 +- init-container/Dockerfile | 11 +- init-container/Jenkinsfile | 18 ++- init-container/check_dump.sh | 8 ++ init-container/dbdump | 247 +++++++++++++++++++++++++++++++++++ init-container/template.yaml | 103 --------------- requirements.txt | 12 ++ template.yaml | 100 +++++--------- 11 files changed, 347 insertions(+), 192 deletions(-) delete mode 100644 app/config.py create mode 100755 init-container/check_dump.sh create mode 100644 init-container/dbdump delete mode 100644 init-container/template.yaml create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index a9628d1..6de3c80 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.6.7-alpine MAINTAINER Artem Kubrachenko -COPY . /app WORKDIR /app +COPY dbservice.py requirements.txt app/* ./ RUN apk --no-cache add build-base RUN apk --no-cache add postgresql-dev RUN pip install -r requirements.txt diff --git a/Jenkinsfile b/Jenkinsfile index 3e2fbc2..4d161a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,5 +9,24 @@ node { } + // Build docker image + stage('Build image') { + + app = docker.build("akubrachenko/db-service:test") + + } + // Check dump file and script + stage('Test image') { + app.inside { + sh 'dir /tmp' + } + } + // Push image to the docker hub + stage('Push image') { + docker.withRegistry('', 'docker_pass') { + app.push() + } + } + //Push to claster } \ No newline at end of file diff --git a/app/config.py b/app/config.py deleted file mode 100644 index a7107a1..0000000 --- a/app/config.py +++ /dev/null @@ -1,6 +0,0 @@ -DATABASE_CONFIG = { - 'host': '127.0.0.1', - 'dbname': 'srmsystem', - 'user': 'dbadmin', - 'password': 'Password' -} \ No newline at end of file diff --git a/app/dbconnect.py b/app/dbconnect.py index 1d8c362..1b5614e 100644 --- a/app/dbconnect.py +++ b/app/dbconnect.py @@ -1,12 +1,13 @@ import psycopg2 -from app import config +import os def connect_db(dbname): - if dbname != config.DATABASE_CONFIG['dbname']: + if dbname != str(os.getenv("PGDATABASE")): raise ValueError("Couldn't not find DB with given name") - conn = psycopg2.connect(host=config.DATABASE_CONFIG['host'], - user=config.DATABASE_CONFIG['user'], - password=config.DATABASE_CONFIG['password'], - dbname=config.DATABASE_CONFIG['dbname']) + conn = psycopg2.connect(host=str(os.getenv("POSTGRES_HOST")), + port=str(os.getenv("POSTGRES_PORT")), + user=str(os.getenv("PGUSER")), + password=str(os.getenv("PGPASSWORD")), + dbname=str(os.getenv("PGDATABASE"))) return conn \ No newline at end of file diff --git a/init-container/Dockerfile b/init-container/Dockerfile index a9628d1..9d3b320 100644 --- a/init-container/Dockerfile +++ b/init-container/Dockerfile @@ -1,9 +1,4 @@ -FROM python:3.6.7-alpine +FROM postgres:9.6.2 MAINTAINER Artem Kubrachenko -COPY . /app -WORKDIR /app -RUN apk --no-cache add build-base -RUN apk --no-cache add postgresql-dev -RUN pip install -r requirements.txt -ENTRYPOINT ["python"] -CMD ["dbservice.py"] +WORKDIR /tmp +COPY check_dump.sh dbdump ./ \ No newline at end of file diff --git a/init-container/Jenkinsfile b/init-container/Jenkinsfile index 3e2fbc2..0c135e7 100644 --- a/init-container/Jenkinsfile +++ b/init-container/Jenkinsfile @@ -8,6 +8,22 @@ node { gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) } + // Build docker image + stage('Build image') { - //Push to claster + sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' + + } + // Check dump file and script + stage('Test image') { + app.inside { + sh 'dir /tmp' + } + } + // Push image to the docker hub + stage('Push image') { + docker.withRegistry('', 'docker_pass') { + app.push() + } + } } \ No newline at end of file diff --git a/init-container/check_dump.sh b/init-container/check_dump.sh new file mode 100755 index 0000000..5f01703 --- /dev/null +++ b/init-container/check_dump.sh @@ -0,0 +1,8 @@ +export SELECT=$(psql -t -h localhost -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") +if [ $SELECT -eq 1 ] +then + exit 0 +else + psql -h localhost -p 5432 -f ~/tmp/dbdump + exit 0 +fi \ No newline at end of file diff --git a/init-container/dbdump b/init-container/dbdump new file mode 100644 index 0000000..da3794b --- /dev/null +++ b/init-container/dbdump @@ -0,0 +1,247 @@ +-- +-- PostgreSQL database dump +-- + +SET statement_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SET check_function_bodies = false; +SET client_min_messages = warning; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +SET search_path = public, pg_catalog; + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: department; Type: TABLE; Schema: public; Owner: dbadmin; Tablespace: +-- + +CREATE TABLE department ( + id integer NOT NULL, + name character varying(45) NOT NULL +); + + +ALTER TABLE public.department OWNER TO dbadmin; + +-- +-- Name: department_id_seq; Type: SEQUENCE; Schema: public; Owner: dbadmin +-- + +CREATE SEQUENCE department_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.department_id_seq OWNER TO dbadmin; + +-- +-- Name: department_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dbadmin +-- + +ALTER SEQUENCE department_id_seq OWNED BY department.id; + + +-- +-- Name: employee; Type: TABLE; Schema: public; Owner: dbadmin; Tablespace: +-- + +CREATE TABLE employee ( + id integer NOT NULL, + fname character varying(45) NOT NULL, + sname character varying(45) NOT NULL, + exp integer NOT NULL, + "position" character varying(45) NOT NULL, + salary double precision NOT NULL, + coef double precision NOT NULL, + team_id integer NOT NULL +); + + +ALTER TABLE public.employee OWNER TO dbadmin; + +-- +-- Name: employee_id_seq; Type: SEQUENCE; Schema: public; Owner: dbadmin +-- + +CREATE SEQUENCE employee_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.employee_id_seq OWNER TO dbadmin; + +-- +-- Name: employee_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dbadmin +-- + +ALTER SEQUENCE employee_id_seq OWNED BY employee.id; + + +-- +-- Name: team; Type: TABLE; Schema: public; Owner: dbadmin; Tablespace: +-- + +CREATE TABLE team ( + id integer NOT NULL, + name character varying(45) NOT NULL, + id_manager integer, + id_department integer +); + + +ALTER TABLE public.team OWNER TO dbadmin; + +-- +-- Name: team_id_seq; Type: SEQUENCE; Schema: public; Owner: dbadmin +-- + +CREATE SEQUENCE team_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.team_id_seq OWNER TO dbadmin; + +-- +-- Name: team_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: dbadmin +-- + +ALTER SEQUENCE team_id_seq OWNED BY team.id; + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: dbadmin +-- + +ALTER TABLE ONLY department ALTER COLUMN id SET DEFAULT nextval('department_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: dbadmin +-- + +ALTER TABLE ONLY employee ALTER COLUMN id SET DEFAULT nextval('employee_id_seq'::regclass); + + +-- +-- Name: id; Type: DEFAULT; Schema: public; Owner: dbadmin +-- + +ALTER TABLE ONLY team ALTER COLUMN id SET DEFAULT nextval('team_id_seq'::regclass); + + +-- +-- Data for Name: department; Type: TABLE DATA; Schema: public; Owner: dbadmin +-- + +COPY department (id, name) FROM stdin; +9 CE +10 IT +\. + + +-- +-- Name: department_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dbadmin +-- + +SELECT pg_catalog.setval('department_id_seq', 10, true); + + +-- +-- Data for Name: employee; Type: TABLE DATA; Schema: public; Owner: dbadmin +-- + +COPY employee (id, fname, sname, exp, "position", salary, coef, team_id) FROM stdin; +3 Ivan Ivanov 5 Manager 1000 0.100000000000000006 1 +4 Artem Kubrachenko 10 DevOps 2000 0.200000000000000011 2 +\. + + +-- +-- Name: employee_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dbadmin +-- + +SELECT pg_catalog.setval('employee_id_seq', 4, true); + + +-- +-- Data for Name: team; Type: TABLE DATA; Schema: public; Owner: dbadmin +-- + +COPY team (id, name, id_manager, id_department) FROM stdin; +5 HA 1 1 +6 Dev 1 1 +\. + + +-- +-- Name: team_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dbadmin +-- + +SELECT pg_catalog.setval('team_id_seq', 6, true); + + +-- +-- Name: department_pkey; Type: CONSTRAINT; Schema: public; Owner: dbadmin; Tablespace: +-- + +ALTER TABLE ONLY department + ADD CONSTRAINT department_pkey PRIMARY KEY (id); + + +-- +-- Name: employee_pkey; Type: CONSTRAINT; Schema: public; Owner: dbadmin; Tablespace: +-- + +ALTER TABLE ONLY employee + ADD CONSTRAINT employee_pkey PRIMARY KEY (id); + + +-- +-- Name: team_pkey; Type: CONSTRAINT; Schema: public; Owner: dbadmin; Tablespace: +-- + +ALTER TABLE ONLY team + ADD CONSTRAINT team_pkey PRIMARY KEY (id); + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: postgres +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + +-- +-- PostgreSQL database dump complete +-- + diff --git a/init-container/template.yaml b/init-container/template.yaml deleted file mode 100644 index b7eb092..0000000 --- a/init-container/template.yaml +++ /dev/null @@ -1,103 +0,0 @@ -#Production namespace -apiVersion: v1 -kind: Namespace -metadata: - name: production ---- -#Test secret -apiVersion: v1 -kind: Secret -metadata: - name: db-secret - namespace: production -data: - username: ZGJhZG1pbg== - password: UGFzc3dvcmQ= - dbname: c3Jtc3lzdGVt -type: Opaque - ---- -kind: PersistentVolume -apiVersion: v1 -metadata: - name: postgres-pv - labels: - type: local -spec: - storageClassName: manual - capacity: - storage: 2M - accessModes: - - ReadWriteOnce - hostPath: - path: "/mnt/data" - ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - namespace: production - labels: - app: postgres - name: postgres-pv-claim -spec: - storageClassName: manual - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2M - ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - namespace: production - name: postgres -spec: - replicas: 1 - template: - metadata: - labels: - app: postgres - spec: - containers: - - image: postgres:9.6.2 - name: postgresql - env: - - name: POSTGRES_DATABASE - valueFrom: - secretKeyRef: - name: db-secret - key: dbname - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: db-secret - key: username - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: db-secret - key: password - ports: - - containerPort: 5432 - volumeMounts: - - name: postgres-pv-claim - mountPath: /var/lib/postgresql/data - volumes: - - name: postgres-pv-claim - persistentVolumeClaim: - claimName: postgres-pv-claim - ---- -kind: Service -apiVersion: v1 -metadata: - namespace: production - name: srmsystemdb -spec: - ports: - - protocol: TCP - port: 5432 - targetPort: 5432 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6ff17ce --- /dev/null +++ b/requirements.txt @@ -0,0 +1,12 @@ +certifi==2018.10.15 +chardet==3.0.4 +Click==7.0 +Flask==1.0.2 +idna==2.7 +itsdangerous==1.1.0 +Jinja2==2.10 +MarkupSafe==1.1.0 +psycopg2==2.7.6.1 +requests==2.20.1 +urllib3==1.24.1 +Werkzeug==0.14.1 diff --git a/template.yaml b/template.yaml index b7eb092..c2fd383 100644 --- a/template.yaml +++ b/template.yaml @@ -1,53 +1,3 @@ -#Production namespace -apiVersion: v1 -kind: Namespace -metadata: - name: production ---- -#Test secret -apiVersion: v1 -kind: Secret -metadata: - name: db-secret - namespace: production -data: - username: ZGJhZG1pbg== - password: UGFzc3dvcmQ= - dbname: c3Jtc3lzdGVt -type: Opaque - ---- -kind: PersistentVolume -apiVersion: v1 -metadata: - name: postgres-pv - labels: - type: local -spec: - storageClassName: manual - capacity: - storage: 2M - accessModes: - - ReadWriteOnce - hostPath: - path: "/mnt/data" - ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - namespace: production - labels: - app: postgres - name: postgres-pv-claim -spec: - storageClassName: manual - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2M - --- apiVersion: extensions/v1beta1 kind: Deployment @@ -61,43 +11,59 @@ spec: labels: app: postgres spec: - containers: - - image: postgres:9.6.2 + init-container: + - image: akubrachenko/init-container:${gitTag} name: postgresql env: - - name: POSTGRES_DATABASE + - name: PGDATABASE valueFrom: secretKeyRef: name: db-secret key: dbname - - name: POSTGRES_USER + - name: PGUSER valueFrom: secretKeyRef: name: db-secret key: username - - name: POSTGRES_PASSWORD + - name: PGPASSWORD valueFrom: secretKeyRef: name: db-secret key: password + command: ['sh', '-c', 'until pg_isready -h postgres -p 5432; do echo waiting for database; sleep 2; /tmp/check_dump.sh;'] + containers: + - image: akubrachenko/db-service:${gitTag} + name: db-service ports: - - containerPort: 5432 - volumeMounts: - - name: postgres-pv-claim - mountPath: /var/lib/postgresql/data - volumes: - - name: postgres-pv-claim - persistentVolumeClaim: - claimName: postgres-pv-claim - + - containerPort: 5000 + env: + - name: POSTGRES_HOST + value: srmsystemdb + - name: POSTGRES_PORT + value: "5432" + - name: PGDATABASE + valueFrom: + secretKeyRef: + name: db-secret + key: dbname + - name: PGUSER + valueFrom: + secretKeyRef: + name: db-secret + key: username + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: db-secret + key: password --- kind: Service apiVersion: v1 metadata: namespace: production - name: srmsystemdb + name: db-service spec: ports: - protocol: TCP - port: 5432 - targetPort: 5432 + port: 5000 + targetPort: 5000 From 646076a8730b5280cf0b8bc1a217a3d128468e26 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 15:29:18 +0200 Subject: [PATCH 003/109] change jenkins file --- Jenkinsfile | 29 ++++++++++++++++++++--------- init-container/Jenkinsfile | 29 ----------------------------- 2 files changed, 20 insertions(+), 38 deletions(-) delete mode 100644 init-container/Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile index 4d161a2..561d02c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,6 @@ node { - def app + def db-service + def init-container // Checking, that the repository was cloned to workspace stage('Clone repository') { @@ -9,22 +10,32 @@ node { } - // Build docker image + // Build docker image for db-service + stage('Build db-service image') { + + db-service = docker.build("akubrachenko/db-service:test") + + } + + // Build docker image for init container stage('Build image') { - app = docker.build("akubrachenko/db-service:test") + // sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' + init-container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") } - // Check dump file and script - stage('Test image') { - app.inside { - sh 'dir /tmp' + + // Push image db-service to the docker hub + stage('Push image') { + docker.withRegistry('', 'docker_pass') { + db-service.push() } } - // Push image to the docker hub + + // Push image init container to the docker hub stage('Push image') { docker.withRegistry('', 'docker_pass') { - app.push() + init-container.push() } } diff --git a/init-container/Jenkinsfile b/init-container/Jenkinsfile deleted file mode 100644 index 0c135e7..0000000 --- a/init-container/Jenkinsfile +++ /dev/null @@ -1,29 +0,0 @@ -node { - def app - - // Checking, that the repository was cloned to workspace - stage('Clone repository') { - - checkout scm - gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) - - } - // Build docker image - stage('Build image') { - - sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - - } - // Check dump file and script - stage('Test image') { - app.inside { - sh 'dir /tmp' - } - } - // Push image to the docker hub - stage('Push image') { - docker.withRegistry('', 'docker_pass') { - app.push() - } - } -} \ No newline at end of file From 30e0313d375954ca4cc04c9e440645f7bc84ec22 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 15:38:34 +0200 Subject: [PATCH 004/109] change var in jankinsefile --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 561d02c..70450e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ node { - def db-service - def init-container + def db_service + def init_container // Checking, that the repository was cloned to workspace stage('Clone repository') { @@ -13,7 +13,7 @@ node { // Build docker image for db-service stage('Build db-service image') { - db-service = docker.build("akubrachenko/db-service:test") + db_service = docker.build("akubrachenko/db-service:test") } @@ -21,21 +21,21 @@ node { stage('Build image') { // sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init-container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") + init_container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") } // Push image db-service to the docker hub stage('Push image') { docker.withRegistry('', 'docker_pass') { - db-service.push() + db_service.push() } } // Push image init container to the docker hub stage('Push image') { docker.withRegistry('', 'docker_pass') { - init-container.push() + init_container.push() } } From 36e3f4845438f3ced0533a5e266ba38035c432df Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 15:41:03 +0200 Subject: [PATCH 005/109] some changes in jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 70450e4..560f70a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ node { } // Build docker image for init container - stage('Build image') { + stage('Build init-container image') { // sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' init_container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") @@ -26,14 +26,14 @@ node { } // Push image db-service to the docker hub - stage('Push image') { + stage('Push db-service image') { docker.withRegistry('', 'docker_pass') { db_service.push() } } // Push image init container to the docker hub - stage('Push image') { + stage('Push init-conatainer image') { docker.withRegistry('', 'docker_pass') { init_container.push() } From 360ee1dfd3a7b18e92615a9f36d9ba888ab364b5 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 15:47:13 +0200 Subject: [PATCH 006/109] jenkins 1 --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 560f70a..a8b1337 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,8 +20,8 @@ node { // Build docker image for init container stage('Build init-container image') { - // sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init_container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") + init_container = sh (script: 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/', returnStdout: true) + //init_container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") } From b66fb63c49d9a64839c8761e7915d0b1a8254a73 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 15:48:11 +0200 Subject: [PATCH 007/109] v1 --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a8b1337..319357d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,11 +11,11 @@ node { } // Build docker image for db-service - stage('Build db-service image') { + /*stage('Build db-service image') { db_service = docker.build("akubrachenko/db-service:test") - } + }*/ // Build docker image for init container stage('Build init-container image') { @@ -26,11 +26,11 @@ node { } // Push image db-service to the docker hub - stage('Push db-service image') { + /*stage('Push db-service image') { docker.withRegistry('', 'docker_pass') { db_service.push() } - } + }*/ // Push image init container to the docker hub stage('Push init-conatainer image') { From adb390677a8fee504b236befb90bb6c6d602c4ee Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:02:07 +0200 Subject: [PATCH 008/109] v2 --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 319357d..fdd6a77 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,8 +20,8 @@ node { // Build docker image for init container stage('Build init-container image') { - init_container = sh (script: 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/', returnStdout: true) - //init_container = docker.build("init-container/Dockerfile","akubrachenko/init-container:test", "init-container/") + //init_container = sh (script: 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/', returnStdout: true) + init_container = docker.build("akubrachenko/init-container:test","--build-arg akubrachenko/init-container:test init-container/") } From da6054469dfdbe930c899268e4a479e2184e8b26 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:02:55 +0200 Subject: [PATCH 009/109] v2.1 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fdd6a77..d63daf2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { stage('Build init-container image') { //init_container = sh (script: 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/', returnStdout: true) - init_container = docker.build("akubrachenko/init-container:test","--build-arg akubrachenko/init-container:test init-container/") + init_container = docker.build("akubrachenko/init-container:test","--build-arg init-container/Dockerfile init-container/") } From 838e568af1310968aceaba8ec0e59dcc12fb426c Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:06:56 +0200 Subject: [PATCH 010/109] v3 --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d63daf2..ec3629a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,9 +20,9 @@ node { // Build docker image for init container stage('Build init-container image') { - //init_container = sh (script: 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/', returnStdout: true) - init_container = docker.build("akubrachenko/init-container:test","--build-arg init-container/Dockerfile init-container/") - + sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' + //init_container = docker.build("akubrachenko/init-container:test","--build-arg init-container/Dockerfile init-container/") + init_container = 'akubrachenko/init-container:test' } // Push image db-service to the docker hub From d609a43bb9d7ca857176f77c384fc9577aa059b9 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:12:14 +0200 Subject: [PATCH 011/109] v4 --- Jenkinsfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec3629a..9ce3d01 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,9 +20,8 @@ node { // Build docker image for init container stage('Build init-container image') { - sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - //init_container = docker.build("akubrachenko/init-container:test","--build-arg init-container/Dockerfile init-container/") - init_container = 'akubrachenko/init-container:test' + //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' + init_container = docker.build("-f init-container/Dockerfile -t akubrachenko/init-container:test init-container/") } // Push image db-service to the docker hub From 3fc70cb8f2ab50ac1baf8fe5fd5cf162bb2ae91b Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:16:16 +0200 Subject: [PATCH 012/109] v4.1 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ce3d01..8f0e213 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { stage('Build init-container image') { //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init_container = docker.build("-f init-container/Dockerfile -t akubrachenko/init-container:test init-container/") + init_container = docker.build("-f init-container/Dockerfile -t akubrachenko/init-container:test init-container/") } // Push image db-service to the docker hub From 41066e92308829e98b6fe807de08f11a18bf32cf Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:17:25 +0200 Subject: [PATCH 013/109] v4.2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f0e213..11e80b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { stage('Build init-container image') { //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init_container = docker.build("-f init-container/Dockerfile -t akubrachenko/init-container:test init-container/") + init_container = docker.build("akubrachenko/init-container:test -f init-container/Dockerfile init-container/") } // Push image db-service to the docker hub From 04cd092454f8171d94db77e7c9d9ed5372447321 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:19:19 +0200 Subject: [PATCH 014/109] v4.3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 11e80b9..42c8846 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { stage('Build init-container image') { //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init_container = docker.build("akubrachenko/init-container:test -f init-container/Dockerfile init-container/") + init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfilea init-container/") } // Push image db-service to the docker hub From 1f52f02c8864e492769ab90b4167723fbf4fa411 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:20:19 +0200 Subject: [PATCH 015/109] v5 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 42c8846..9ac9f8e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ node { stage('Build init-container image') { //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfilea init-container/") + init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfile init-container/") } // Push image db-service to the docker hub From e942d1306921868c285b09a812ba9fec7437c097 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 16:21:21 +0200 Subject: [PATCH 016/109] beta jenkinsfile --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ac9f8e..bcee3ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,11 +11,11 @@ node { } // Build docker image for db-service - /*stage('Build db-service image') { + stage('Build db-service image') { db_service = docker.build("akubrachenko/db-service:test") - }*/ + } // Build docker image for init container stage('Build init-container image') { @@ -25,11 +25,11 @@ node { } // Push image db-service to the docker hub - /*stage('Push db-service image') { + stage('Push db-service image') { docker.withRegistry('', 'docker_pass') { db_service.push() } - }*/ + } // Push image init container to the docker hub stage('Push init-conatainer image') { From dfe8a5fd5625bff3c42610d2f56b7c6b910e4464 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 17:08:05 +0200 Subject: [PATCH 017/109] change dest --- init-container/check_dump.sh | 4 ++-- template.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init-container/check_dump.sh b/init-container/check_dump.sh index 5f01703..2e12215 100755 --- a/init-container/check_dump.sh +++ b/init-container/check_dump.sh @@ -1,8 +1,8 @@ -export SELECT=$(psql -t -h localhost -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") +export SELECT=$(psql -t -h srmsystemdb -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") if [ $SELECT -eq 1 ] then exit 0 else - psql -h localhost -p 5432 -f ~/tmp/dbdump + psql -h srmsystemdb -p 5432 -f ~/tmp/dbdump exit 0 fi \ No newline at end of file diff --git a/template.yaml b/template.yaml index c2fd383..6c3e0bd 100644 --- a/template.yaml +++ b/template.yaml @@ -30,7 +30,7 @@ spec: secretKeyRef: name: db-secret key: password - command: ['sh', '-c', 'until pg_isready -h postgres -p 5432; do echo waiting for database; sleep 2; /tmp/check_dump.sh;'] + command: ['sh', '-c', 'until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; /tmp/check_dump.sh;'] containers: - image: akubrachenko/db-service:${gitTag} name: db-service From 9a5bcc74879e814aef6fe44e3510ab5b17d6d752 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 17:43:22 +0200 Subject: [PATCH 018/109] change template --- template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template.yaml b/template.yaml index 6c3e0bd..0bb7803 100644 --- a/template.yaml +++ b/template.yaml @@ -11,7 +11,7 @@ spec: labels: app: postgres spec: - init-container: + initContainers: - image: akubrachenko/init-container:${gitTag} name: postgresql env: From 73abe9a3915ea24c2d3471cb361a00f1b4573d81 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 19:34:51 +0200 Subject: [PATCH 019/109] changes --- dbservice.py | 4 +++- template.yaml | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dbservice.py b/dbservice.py index e524e69..90e50ed 100644 --- a/dbservice.py +++ b/dbservice.py @@ -1 +1,3 @@ -from app import app \ No newline at end of file +from app import app +if __name__ == "__main__": + app.run() \ No newline at end of file diff --git a/template.yaml b/template.yaml index 0bb7803..6ce5f32 100644 --- a/template.yaml +++ b/template.yaml @@ -3,17 +3,17 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: namespace: production - name: postgres + name: db-service spec: replicas: 1 template: metadata: labels: - app: postgres + app: db-service spec: initContainers: - - image: akubrachenko/init-container:${gitTag} - name: postgresql + - image: akubrachenko/init-container:test + name: init-container-postgres env: - name: PGDATABASE valueFrom: @@ -30,9 +30,9 @@ spec: secretKeyRef: name: db-secret key: password - command: ['sh', '-c', 'until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; /tmp/check_dump.sh;'] + command: ['sh', '-c', 'until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; done;'] containers: - - image: akubrachenko/db-service:${gitTag} + - image: akubrachenko/db-service:test name: db-service ports: - containerPort: 5000 From bc8b5eaa28793c5068cfe2a627dfbb148324675f Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 20:13:50 +0200 Subject: [PATCH 020/109] change dockerfile --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6de3c80..0c0171b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ FROM python:3.6.7-alpine MAINTAINER Artem Kubrachenko WORKDIR /app -COPY dbservice.py requirements.txt app/* ./ +COPY dbservice.py requirements.txt ./ +RUN mkdir app +COPY app/* ./app/ RUN apk --no-cache add build-base RUN apk --no-cache add postgresql-dev RUN pip install -r requirements.txt From 208af60b34f5c49c7eedb440781f78fe90cfc63e Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 21:11:52 +0200 Subject: [PATCH 021/109] some changes --- init-container/check_dump.sh | 5 +++-- template.yaml | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/init-container/check_dump.sh b/init-container/check_dump.sh index 2e12215..e7593b1 100755 --- a/init-container/check_dump.sh +++ b/init-container/check_dump.sh @@ -1,8 +1,9 @@ +until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; done; export SELECT=$(psql -t -h srmsystemdb -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") -if [ $SELECT -eq 1 ] +if [ $SELECT = 1 ] then exit 0 else - psql -h srmsystemdb -p 5432 -f ~/tmp/dbdump + psql -h srmsystemdb -p 5432 -f dbdump exit 0 fi \ No newline at end of file diff --git a/template.yaml b/template.yaml index 6ce5f32..7932b0d 100644 --- a/template.yaml +++ b/template.yaml @@ -30,7 +30,7 @@ spec: secretKeyRef: name: db-secret key: password - command: ['sh', '-c', 'until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; done;'] + command: ['sh', '-c', '/tmp/check_dump.sh'] containers: - image: akubrachenko/db-service:test name: db-service @@ -63,6 +63,8 @@ metadata: namespace: production name: db-service spec: + selector: + app: db-service ports: - protocol: TCP port: 5000 From 96c399f4214a91e6564cebe8abf9361a29df9937 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 21:19:55 +0200 Subject: [PATCH 022/109] test sh --- init-container/check_dump.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-container/check_dump.sh b/init-container/check_dump.sh index e7593b1..b4e2f18 100755 --- a/init-container/check_dump.sh +++ b/init-container/check_dump.sh @@ -1,4 +1,4 @@ -until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; done; +until pg_isready -h srmsystemd -p 5432; do echo waiting for database; sleep 2; done; export SELECT=$(psql -t -h srmsystemdb -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") if [ $SELECT = 1 ] then From b0ad9298384fdcc320745339c92871e92cc0a595 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 21:31:07 +0200 Subject: [PATCH 023/109] change sh 1 --- init-container/check_dump.sh | 2 +- template.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init-container/check_dump.sh b/init-container/check_dump.sh index b4e2f18..e7593b1 100755 --- a/init-container/check_dump.sh +++ b/init-container/check_dump.sh @@ -1,4 +1,4 @@ -until pg_isready -h srmsystemd -p 5432; do echo waiting for database; sleep 2; done; +until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; done; export SELECT=$(psql -t -h srmsystemdb -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") if [ $SELECT = 1 ] then diff --git a/template.yaml b/template.yaml index 7932b0d..cc0f8b3 100644 --- a/template.yaml +++ b/template.yaml @@ -30,7 +30,7 @@ spec: secretKeyRef: name: db-secret key: password - command: ['sh', '-c', '/tmp/check_dump.sh'] + command: ['sh', '-c', 'until pg_isready -h srmsystemd -p 5432; do echo waiting for database; sleep 2; done;'] containers: - image: akubrachenko/db-service:test name: db-service From b033eaa0d72eedfc3ec795efbfa96f3f0ba2495a Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Wed, 16 Jan 2019 22:39:30 +0200 Subject: [PATCH 024/109] test --- template.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/template.yaml b/template.yaml index cc0f8b3..5e06e28 100644 --- a/template.yaml +++ b/template.yaml @@ -5,7 +5,6 @@ metadata: namespace: production name: db-service spec: - replicas: 1 template: metadata: labels: @@ -30,7 +29,7 @@ spec: secretKeyRef: name: db-secret key: password - command: ['sh', '-c', 'until pg_isready -h srmsystemd -p 5432; do echo waiting for database; sleep 2; done;'] + command: ['sh', '-c', '/bin/sh /tmp/check_dump.sh'] containers: - image: akubrachenko/db-service:test name: db-service From 2e16af8dc9ed92557483c629f9dfe35356bbc040 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Thu, 17 Jan 2019 15:22:25 +0200 Subject: [PATCH 025/109] beta version --- template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template.yaml b/template.yaml index 5e06e28..e2d9a9b 100644 --- a/template.yaml +++ b/template.yaml @@ -29,7 +29,7 @@ spec: secretKeyRef: name: db-secret key: password - command: ['sh', '-c', '/bin/sh /tmp/check_dump.sh'] + command: ['sh', '-c', '/bin/bash /tmp/check_dump.sh'] containers: - image: akubrachenko/db-service:test name: db-service From 69c0a54f91ebe47b5f3158d8a4bc2e5aff379ae7 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Thu, 17 Jan 2019 19:33:05 +0200 Subject: [PATCH 026/109] change port --- template.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/template.yaml b/template.yaml index e2d9a9b..4869b42 100644 --- a/template.yaml +++ b/template.yaml @@ -34,7 +34,7 @@ spec: - image: akubrachenko/db-service:test name: db-service ports: - - containerPort: 5000 + - containerPort: 5002 env: - name: POSTGRES_HOST value: srmsystemdb @@ -66,5 +66,5 @@ spec: app: db-service ports: - protocol: TCP - port: 5000 - targetPort: 5000 + port: 5002 + targetPort: 5002 From 38fc925eb4ef80528457d17dcfb0458c233d8f50 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Thu, 17 Jan 2019 21:43:12 +0200 Subject: [PATCH 027/109] change host --- dbservice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbservice.py b/dbservice.py index 90e50ed..62c7386 100644 --- a/dbservice.py +++ b/dbservice.py @@ -1,3 +1,3 @@ from app import app if __name__ == "__main__": - app.run() \ No newline at end of file + app.run(host="0.0.0.0") \ No newline at end of file From 31c3d40866a51478d5b25fdc139b7eed98f2fe49 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Thu, 17 Jan 2019 21:44:09 +0200 Subject: [PATCH 028/109] change host --- dbservice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbservice.py b/dbservice.py index 62c7386..5885962 100644 --- a/dbservice.py +++ b/dbservice.py @@ -1,3 +1,3 @@ from app import app if __name__ == "__main__": - app.run(host="0.0.0.0") \ No newline at end of file + app.run(host="0.0.0.0", port="5002") \ No newline at end of file From ccac79f881fda4729ae59e5293f69357b41811e8 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Fri, 18 Jan 2019 04:12:00 +0200 Subject: [PATCH 029/109] change image --- template.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template.yaml b/template.yaml index 4869b42..70de851 100644 --- a/template.yaml +++ b/template.yaml @@ -11,7 +11,7 @@ spec: app: db-service spec: initContainers: - - image: akubrachenko/init-container:test + - image: 100.71.71.71:5000/init-container:latest name: init-container-postgres env: - name: PGDATABASE @@ -31,7 +31,7 @@ spec: key: password command: ['sh', '-c', '/bin/bash /tmp/check_dump.sh'] containers: - - image: akubrachenko/db-service:test + - image: 100.71.71.71:5000/db-service:latest name: db-service ports: - containerPort: 5002 From 47ef6c7f33cde3d99fd84e23e99fb1415c6e9ef6 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Fri, 18 Jan 2019 05:14:54 +0200 Subject: [PATCH 030/109] change jenkins --- Jenkinsfile | 140 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 111 insertions(+), 29 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bcee3ae..0cc078e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,42 +1,124 @@ -node { - def db_service - def init_container +// node { +// def db_service +// def init_container - // Checking, that the repository was cloned to workspace - stage('Clone repository') { +// // Checking, that the repository was cloned to workspace +// stage('Clone repository') { - checkout scm - gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) +// checkout scm +// gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) - } +// } - // Build docker image for db-service - stage('Build db-service image') { +// // Build docker image for db-service +// stage('Build db-service image') { - db_service = docker.build("akubrachenko/db-service:test") +// db_service = docker.build("akubrachenko/db-service:test") - } +// } - // Build docker image for init container - stage('Build init-container image') { +// // Build docker image for init container +// stage('Build init-container image') { - //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' - init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfile init-container/") - } +// //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' +// init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfile init-container/") +// } + +// // Push image db-service to the docker hub +// stage('Push db-service image') { +// docker.withRegistry('', 'docker_pass') { +// db_service.push() +// } +// } + +// // Push image init container to the docker hub +// stage('Push init-conatainer image') { +// docker.withRegistry('', 'docker_pass') { +// init_container.push() +// } +// } + +// //Push to claster +// } +def label = "mypod-${UUID.randomUUID().toString()}" + +podTemplate(label: label, containers: [ + containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v1', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.8', command: 'cat', ttyEnabled: true) +], +volumes: [ + hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock') +] +) +{ +def app +def dockerRegistry = "100.71.71.71:5000" +def Creds = "git_cred" +def projName = "db-service" +def imageVersion = "latest" +def imageName = "100.71.71.71:5000/db-service:${imageVersion}" +def imageN = '100.71.71.71:5000/db-service:' - // Push image db-service to the docker hub - stage('Push db-service image') { - docker.withRegistry('', 'docker_pass') { - db_service.push() - } - } - // Push image init container to the docker hub - stage('Push init-conatainer image') { - docker.withRegistry('', 'docker_pass') { - init_container.push() +node(label) +{ + try{ + stage("Git Checkout"){ + git( + branch: "akubrachenko", + url: 'https://github.com/Kv-045DevOps/SRM-DB.git') + credentialsId: "${Creds}") + sh "git rev-parse --short HEAD > .git/commit-id" + imageTag= readFile ".git/commit-id" + } + stage("Info"){ + sh "echo ${imageTag}" + } + stage ("Unit Tests"){ + sh 'echo "Here will be unit tests"' + } + stage("Test code using PyLint and version build"){ + container('python-alpine'){ + pathTocode = pwd() + sh "python3 ${pathTocode}/sed-python.py template.yml ${dockerRegistry}/db-service ${imageTag}" + sh "python3 ${pathTocode}/sed-python.py template.yml ${dockerRegistry}/init-container ${imageTag}" + sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" + } + } + stage("Build docker images"){ + container('docker'){ + pathdocker = pwd() +// app = docker.build("${imageName}:${imageTag}") + sh "docker build ${pathdocker} -t ${imageN}${imageTag}" + sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${imageTag}" + sh "docker images" + //withCredentials([usernamePassword(credentialsId: 'docker_registry_2', passwordVariable: 'dockerPassword', usernameVariable: 'dockerUser')]) { + + sh "docker push ${imageN}${imageTag}" + sh "docker push ${dockerRegistry}/init-container:${imageTag}" + //} + } + } + // stage("Check push image to Docker Registry"){ + // pathTocode = pwd() + // sh "python3 ${pathTocode}/images-registry-test.py ${dockerRegistry} ${projName} ${imageTag}" + // } + stage("Deploy to Kubernetes"){ + container('kubectl'){ + sh "kubectl apply -f template.yaml" + sh "kubectl get pods --namespace=production" + } + } + stage ("Unit Tests"){ + sh 'echo "Here will be e2e tests"' } } + catch(err){ + currentBuild.result = 'Failure' + } +} +} + - //Push to claster -} \ No newline at end of file +sleep 30 \ No newline at end of file From 51fd2f232f443b2b4e107eb889bf373078233812 Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Fri, 18 Jan 2019 13:10:10 +0200 Subject: [PATCH 031/109] edit jenkins --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0cc078e..500ccad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -67,7 +67,7 @@ node(label) stage("Git Checkout"){ git( branch: "akubrachenko", - url: 'https://github.com/Kv-045DevOps/SRM-DB.git') + url: 'https://github.com/Kv-045DevOps/SRM-DB.git', credentialsId: "${Creds}") sh "git rev-parse --short HEAD > .git/commit-id" imageTag= readFile ".git/commit-id" From 6686d6602f10e4ddceb8cbc4874b037598d198a7 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 23 Jan 2019 03:49:36 -0500 Subject: [PATCH 032/109] Change Jenkinsfile --- Jenkinsfile | 10 ++++------ pylint-test.py | 20 ++++++++++++++++++++ sed_python.py | 13 +++++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 pylint-test.py create mode 100644 sed_python.py diff --git a/Jenkinsfile b/Jenkinsfile index 500ccad..4825a4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -49,8 +49,7 @@ podTemplate(label: label, containers: [ ], volumes: [ hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock') -] -) +], serviceAccount: "jenkins") { def app def dockerRegistry = "100.71.71.71:5000" @@ -81,15 +80,14 @@ node(label) stage("Test code using PyLint and version build"){ container('python-alpine'){ pathTocode = pwd() - sh "python3 ${pathTocode}/sed-python.py template.yml ${dockerRegistry}/db-service ${imageTag}" - sh "python3 ${pathTocode}/sed-python.py template.yml ${dockerRegistry}/init-container ${imageTag}" + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTag}" + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTag}" sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" } } stage("Build docker images"){ container('docker'){ pathdocker = pwd() -// app = docker.build("${imageName}:${imageTag}") sh "docker build ${pathdocker} -t ${imageN}${imageTag}" sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${imageTag}" sh "docker images" @@ -121,4 +119,4 @@ node(label) } -sleep 30 \ No newline at end of file +sleep 30 diff --git a/pylint-test.py b/pylint-test.py new file mode 100644 index 0000000..3d1bf44 --- /dev/null +++ b/pylint-test.py @@ -0,0 +1,20 @@ +import os +import sys +from pylint.lint import Run + +def main(): + check_rate_code() + + +def check_rate_code(): + results = Run([sys.argv[1]], do_exit=False) + if (results.linter.stats['global_note'] <= 5): + raise Exception("Code rate smaller than standard") + return 1 + else: + print(results.linter.stats['global_note']) + return 0 + + +if __name__=='__main__': + main() diff --git a/sed_python.py b/sed_python.py new file mode 100644 index 0000000..8936dea --- /dev/null +++ b/sed_python.py @@ -0,0 +1,13 @@ +import os +import sys + +with open(sys.argv[1], 'r') as file: + str_tmp = "ghostgoose" + data = file.read() + tmp = sys.argv[2] + ":" + sys.argv[3] + data = data.replace("100.71.71.71:5000/get-service:v2", tmp) + print(data) + + +with open(sys.argv[1], 'w') as file: + file.write( data ) From e3cf2a85bf69eb5638764ff50bc215981c7e6129 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 23 Jan 2019 04:26:35 -0500 Subject: [PATCH 033/109] Change Jenkinsfile --- sed_python.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sed_python.py b/sed_python.py index 8936dea..fdb2d32 100644 --- a/sed_python.py +++ b/sed_python.py @@ -5,9 +5,10 @@ str_tmp = "ghostgoose" data = file.read() tmp = sys.argv[2] + ":" + sys.argv[3] - data = data.replace("100.71.71.71:5000/get-service:v2", tmp) - print(data) + data = data.replace("100.71.71.71:5000/db-service:latest", tmp) + data_init = data.replace("100.71.71.71:5000/init-container:latest", tmp) + print(data_init) with open(sys.argv[1], 'w') as file: - file.write( data ) + file.write( data_init ) From 61ac3e35055a6737727c30208e2b34103e3a1d26 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 23 Jan 2019 04:38:53 -0500 Subject: [PATCH 034/109] Change SED replace script --- sed_python.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sed_python.py b/sed_python.py index fdb2d32..d832a67 100644 --- a/sed_python.py +++ b/sed_python.py @@ -5,10 +5,12 @@ str_tmp = "ghostgoose" data = file.read() tmp = sys.argv[2] + ":" + sys.argv[3] - data = data.replace("100.71.71.71:5000/db-service:latest", tmp) - data_init = data.replace("100.71.71.71:5000/init-container:latest", tmp) - print(data_init) + if sys.argv[2] == "100.71.71.71:5000/db-service": + data = data.replace("100.71.71.71:5000/db-service:latest", tmp) + elif sys.argv[2] == "100.71.71.71:5000/init-container": + data = data.replace("100.71.71.71:5000/init-container:latest", tmp) + print(data) with open(sys.argv[1], 'w') as file: - file.write( data_init ) + file.write( data ) From b25c477d30adfac53b0f5568e89c6b536e4d059b Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 23 Jan 2019 14:47:36 -0500 Subject: [PATCH 035/109] Restore --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4825a4d..72fc466 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -65,7 +65,7 @@ node(label) try{ stage("Git Checkout"){ git( - branch: "akubrachenko", + branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', credentialsId: "${Creds}") sh "git rev-parse --short HEAD > .git/commit-id" From 8c45e49ff9ef67dc23dcbda780090016b2aadba5 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 24 Jan 2019 04:35:30 -0500 Subject: [PATCH 036/109] Add new e2e test --- template-test.yaml | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 template-test.yaml diff --git a/template-test.yaml b/template-test.yaml new file mode 100644 index 0000000..70de851 --- /dev/null +++ b/template-test.yaml @@ -0,0 +1,70 @@ +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + namespace: production + name: db-service +spec: + template: + metadata: + labels: + app: db-service + spec: + initContainers: + - image: 100.71.71.71:5000/init-container:latest + name: init-container-postgres + env: + - name: PGDATABASE + valueFrom: + secretKeyRef: + name: db-secret + key: dbname + - name: PGUSER + valueFrom: + secretKeyRef: + name: db-secret + key: username + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: db-secret + key: password + command: ['sh', '-c', '/bin/bash /tmp/check_dump.sh'] + containers: + - image: 100.71.71.71:5000/db-service:latest + name: db-service + ports: + - containerPort: 5002 + env: + - name: POSTGRES_HOST + value: srmsystemdb + - name: POSTGRES_PORT + value: "5432" + - name: PGDATABASE + valueFrom: + secretKeyRef: + name: db-secret + key: dbname + - name: PGUSER + valueFrom: + secretKeyRef: + name: db-secret + key: username + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: db-secret + key: password +--- +kind: Service +apiVersion: v1 +metadata: + namespace: production + name: db-service +spec: + selector: + app: db-service + ports: + - protocol: TCP + port: 5002 + targetPort: 5002 From af55b47873d1a2edcac3ce93799a8e35478e227e Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 24 Jan 2019 04:43:21 -0500 Subject: [PATCH 037/109] Add new e2e test --- E2E-Test.yaml | 95 ++++++++++++++++++++++++++++++++++++++++++++++ sed_python_test.py | 19 ++++++++++ 2 files changed, 114 insertions(+) create mode 100644 E2E-Test.yaml create mode 100644 sed_python_test.py diff --git a/E2E-Test.yaml b/E2E-Test.yaml new file mode 100644 index 0000000..bb28282 --- /dev/null +++ b/E2E-Test.yaml @@ -0,0 +1,95 @@ +--- + +apiVersion: v1 +kind: Secret +metadata: + name: db-secret + namespace: testing +data: + username: ZGJhZG1pbg== + password: UGFzc3dvcmQ= + dbname: c3Jtc3lzdGVt +type: Opaque + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: testing + labels: + app: pvc-postgres + name: postgres-pvc +spec: + #storageClassName: slow + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi + +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + namespace: testing + name: postgres + labels: + service: postgresdb +spec: + template: + metadata: + labels: + app: postgres + spec: + initContainers: + - name: volume-mount-hack + image: busybox + command: ["sh", "-c", "chown -R 999:999 /var/lib/postgresql/"] + volumeMounts: + - name: postgres-pv-claim + mountPath: /var/lib/postgresql/data + subPath: postgres + containers: + - image: postgres:9.6.2 + name: postgresql + env: + - name: POSTGRES_DB + valueFrom: + secretKeyRef: + name: db-secret + key: dbname + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: db-secret + key: username + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: db-secret + key: password + ports: + - containerPort: 5432 + volumeMounts: + - name: postgres-pv-claim + mountPath: /var/lib/postgresql/data + subPath: postgres + volumes: + - name: postgres-pv-claim + persistentVolumeClaim: + claimName: postgres-pvc + +--- +kind: Service +apiVersion: v1 +metadata: + namespace: testing + name: srmsystemdb +spec: + selector: + app: postgres + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 +--- diff --git a/sed_python_test.py b/sed_python_test.py new file mode 100644 index 0000000..33bb332 --- /dev/null +++ b/sed_python_test.py @@ -0,0 +1,19 @@ +import os +import sys + +with open(sys.argv[1], 'r') as file: + str_tmp = "ghostgoose" + arr_f = ["100.71.71.71:5000/get-service", "100.71.71.71:5000/post-service", "100.71.71.71:5000/ui-service", "100.71.71.71:5000/db-service", "100.71.71.71:5000/init-container"] + arr = ["100.71.71.71:5000/get-service:v2", "100.71.71.71:5000/post-service:2.1", "100.71.71.71:5000/ui-service:latest", "100.71.71.71:5000/db-service:latest", "100.71.71.71:5000/init-container:latest"] + data = file.read() + print(len(arr_f)) + for i in range(len(arr_f)): + tmp = arr_f[i] + ":" + sys.argv[2] + data = data.replace(arr[i], tmp) + + + + +with open(sys.argv[1], 'w') as file: + file.write( data ) + print(data) From 1905fc08a00a8d13d900edd98c6304f71463dc9f Mon Sep 17 00:00:00 2001 From: admgolovin Date: Thu, 24 Jan 2019 14:10:29 -0500 Subject: [PATCH 038/109] Update Jenkinsfile --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 72fc466..3016905 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,8 +102,13 @@ node(label) // pathTocode = pwd() // sh "python3 ${pathTocode}/images-registry-test.py ${dockerRegistry} ${projName} ${imageTag}" // } + stage("Deploy to Kubernetes"){ + withcredentials( + [DatabaseUsername(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME' passwordVariable: 'DB_PASSWORD')] + [stringCredentials(credentialsId: credsId2, secretVariable: 'DB_NAME',)]) container('kubectl'){ + sh "kubectl create secret generic db-secret --from-literal=username=$DB_USERNAME --from-literal=password=$DB_PASSWORD --from-literal=dbname=$DB_NAME -n production" sh "kubectl apply -f template.yaml" sh "kubectl get pods --namespace=production" } From b1ed8e6c09bd43ff0e0b1f592d830c659f9537ff Mon Sep 17 00:00:00 2001 From: admgolovin Date: Thu, 24 Jan 2019 14:17:46 -0500 Subject: [PATCH 039/109] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3016905..34af365 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -105,8 +105,8 @@ node(label) stage("Deploy to Kubernetes"){ withcredentials( - [DatabaseUsername(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME' passwordVariable: 'DB_PASSWORD')] - [stringCredentials(credentialsId: credsId2, secretVariable: 'DB_NAME',)]) + [usernamePassword(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME' passwordVariable: 'DB_PASSWORD')] + [stringCredentials(credentialsId: 'DbName', secretVariable: 'DB_NAME',)]) container('kubectl'){ sh "kubectl create secret generic db-secret --from-literal=username=$DB_USERNAME --from-literal=password=$DB_PASSWORD --from-literal=dbname=$DB_NAME -n production" sh "kubectl apply -f template.yaml" From 550ad619e58fa3b27c1cad48eb344ef0ba3db01a Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 24 Jan 2019 17:15:03 -0500 Subject: [PATCH 040/109] Jenkins works --- Jenkinsfile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 72fc466..942418c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,6 +52,7 @@ volumes: [ ], serviceAccount: "jenkins") { def app +def imageTag def dockerRegistry = "100.71.71.71:5000" def Creds = "git_cred" def projName = "db-service" @@ -68,11 +69,11 @@ node(label) branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', credentialsId: "${Creds}") - sh "git rev-parse --short HEAD > .git/commit-id" - imageTag= readFile ".git/commit-id" + //sh "git rev-parse --short HEAD > .git/commit-id" + imageTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) } stage("Info"){ - sh "echo ${imageTag}" + sh "echo $imageTag" } stage ("Unit Tests"){ sh 'echo "Here will be unit tests"' @@ -83,6 +84,7 @@ node(label) sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTag}" sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTag}" sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" + sh 'cat template.yaml' } } stage("Build docker images"){ @@ -107,6 +109,19 @@ node(label) sh "kubectl apply -f template.yaml" sh "kubectl get pods --namespace=production" } + } + stage ("E2E Tests - Stage 1"){ + container('python-alpine'){ + sh 'echo "Here are e2e tests"' + sh "python3 sed_python_test.py template-test.yaml ${imageTag}" + sh 'cat template-test.yaml' + } + } + stage ("E2E Tests - Stage 2"){ + container('kubectl'){ + sh 'kubectl apply -f template-test.yaml' + sh 'kubectl get pods -n testing' + } } stage ("Unit Tests"){ sh 'echo "Here will be e2e tests"' From d741784bcb4f0f750be1214cc6da475523ddaa3f Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sat, 26 Jan 2019 15:03:42 -0500 Subject: [PATCH 041/109] Jenkinsfile --- Jenkinsfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 25b253b..54fe284 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -100,14 +100,10 @@ node(label) //} } } - // stage("Check push image to Docker Registry"){ - // pathTocode = pwd() - // sh "python3 ${pathTocode}/images-registry-test.py ${dockerRegistry} ${projName} ${imageTag}" - // } stage("Deploy to Kubernetes"){ withcredentials( - [usernamePassword(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME' passwordVariable: 'DB_PASSWORD')] + [usernamePassword(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME', passwordVariable: 'DB_PASSWORD')] [stringCredentials(credentialsId: 'DbName', secretVariable: 'DB_NAME',)]) container('kubectl'){ sh "kubectl create secret generic db-secret --from-literal=username=$DB_USERNAME --from-literal=password=$DB_PASSWORD --from-literal=dbname=$DB_NAME -n production" From 29dacb89e2811e7b937a6b59c5aa848734866937 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 27 Jan 2019 02:48:53 -0500 Subject: [PATCH 042/109] Jenkinefile --- Jenkinsfile | 71 ------------------------- Jenkinsfile_v1 | 138 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 71 deletions(-) create mode 100644 Jenkinsfile_v1 diff --git a/Jenkinsfile b/Jenkinsfile index 54fe284..287ec9a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,45 +1,3 @@ -// node { -// def db_service -// def init_container - -// // Checking, that the repository was cloned to workspace -// stage('Clone repository') { - -// checkout scm -// gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) - -// } - -// // Build docker image for db-service -// stage('Build db-service image') { - -// db_service = docker.build("akubrachenko/db-service:test") - -// } - -// // Build docker image for init container -// stage('Build init-container image') { - -// //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' -// init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfile init-container/") -// } - -// // Push image db-service to the docker hub -// stage('Push db-service image') { -// docker.withRegistry('', 'docker_pass') { -// db_service.push() -// } -// } - -// // Push image init container to the docker hub -// stage('Push init-conatainer image') { -// docker.withRegistry('', 'docker_pass') { -// init_container.push() -// } -// } - -// //Push to claster -// } def label = "mypod-${UUID.randomUUID().toString()}" podTemplate(label: label, containers: [ @@ -93,40 +51,11 @@ node(label) sh "docker build ${pathdocker} -t ${imageN}${imageTag}" sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${imageTag}" sh "docker images" - //withCredentials([usernamePassword(credentialsId: 'docker_registry_2', passwordVariable: 'dockerPassword', usernameVariable: 'dockerUser')]) { sh "docker push ${imageN}${imageTag}" sh "docker push ${dockerRegistry}/init-container:${imageTag}" - //} - } - } - - stage("Deploy to Kubernetes"){ - withcredentials( - [usernamePassword(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME', passwordVariable: 'DB_PASSWORD')] - [stringCredentials(credentialsId: 'DbName', secretVariable: 'DB_NAME',)]) - container('kubectl'){ - sh "kubectl create secret generic db-secret --from-literal=username=$DB_USERNAME --from-literal=password=$DB_PASSWORD --from-literal=dbname=$DB_NAME -n production" - sh "kubectl apply -f template.yaml" - sh "kubectl get pods --namespace=production" } } - stage ("E2E Tests - Stage 1"){ - container('python-alpine'){ - sh 'echo "Here are e2e tests"' - sh "python3 sed_python_test.py template-test.yaml ${imageTag}" - sh 'cat template-test.yaml' - } - } - stage ("E2E Tests - Stage 2"){ - container('kubectl'){ - sh 'kubectl apply -f template-test.yaml' - sh 'kubectl get pods -n testing' - } - } - stage ("Unit Tests"){ - sh 'echo "Here will be e2e tests"' - } } catch(err){ currentBuild.result = 'Failure' diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 new file mode 100644 index 0000000..54fe284 --- /dev/null +++ b/Jenkinsfile_v1 @@ -0,0 +1,138 @@ +// node { +// def db_service +// def init_container + +// // Checking, that the repository was cloned to workspace +// stage('Clone repository') { + +// checkout scm +// gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) + +// } + +// // Build docker image for db-service +// stage('Build db-service image') { + +// db_service = docker.build("akubrachenko/db-service:test") + +// } + +// // Build docker image for init container +// stage('Build init-container image') { + +// //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' +// init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfile init-container/") +// } + +// // Push image db-service to the docker hub +// stage('Push db-service image') { +// docker.withRegistry('', 'docker_pass') { +// db_service.push() +// } +// } + +// // Push image init container to the docker hub +// stage('Push init-conatainer image') { +// docker.withRegistry('', 'docker_pass') { +// init_container.push() +// } +// } + +// //Push to claster +// } +def label = "mypod-${UUID.randomUUID().toString()}" + +podTemplate(label: label, containers: [ + containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v1', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.8', command: 'cat', ttyEnabled: true) +], +volumes: [ + hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock') +], serviceAccount: "jenkins") +{ +def app +def imageTag +def dockerRegistry = "100.71.71.71:5000" +def Creds = "git_cred" +def projName = "db-service" +def imageVersion = "latest" +def imageName = "100.71.71.71:5000/db-service:${imageVersion}" +def imageN = '100.71.71.71:5000/db-service:' + + +node(label) +{ + try{ + stage("Git Checkout"){ + git( + branch: "test", + url: 'https://github.com/Kv-045DevOps/SRM-DB.git', + credentialsId: "${Creds}") + //sh "git rev-parse --short HEAD > .git/commit-id" + imageTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) + } + stage("Info"){ + sh "echo $imageTag" + } + stage ("Unit Tests"){ + sh 'echo "Here will be unit tests"' + } + stage("Test code using PyLint and version build"){ + container('python-alpine'){ + pathTocode = pwd() + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTag}" + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTag}" + sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" + sh 'cat template.yaml' + } + } + stage("Build docker images"){ + container('docker'){ + pathdocker = pwd() + sh "docker build ${pathdocker} -t ${imageN}${imageTag}" + sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${imageTag}" + sh "docker images" + //withCredentials([usernamePassword(credentialsId: 'docker_registry_2', passwordVariable: 'dockerPassword', usernameVariable: 'dockerUser')]) { + + sh "docker push ${imageN}${imageTag}" + sh "docker push ${dockerRegistry}/init-container:${imageTag}" + //} + } + } + + stage("Deploy to Kubernetes"){ + withcredentials( + [usernamePassword(credentialsId: 'DbCred', usernameVariable: 'DB_USERNAME', passwordVariable: 'DB_PASSWORD')] + [stringCredentials(credentialsId: 'DbName', secretVariable: 'DB_NAME',)]) + container('kubectl'){ + sh "kubectl create secret generic db-secret --from-literal=username=$DB_USERNAME --from-literal=password=$DB_PASSWORD --from-literal=dbname=$DB_NAME -n production" + sh "kubectl apply -f template.yaml" + sh "kubectl get pods --namespace=production" + } + } + stage ("E2E Tests - Stage 1"){ + container('python-alpine'){ + sh 'echo "Here are e2e tests"' + sh "python3 sed_python_test.py template-test.yaml ${imageTag}" + sh 'cat template-test.yaml' + } + } + stage ("E2E Tests - Stage 2"){ + container('kubectl'){ + sh 'kubectl apply -f template-test.yaml' + sh 'kubectl get pods -n testing' + } + } + stage ("Unit Tests"){ + sh 'echo "Here will be e2e tests"' + } + } + catch(err){ + currentBuild.result = 'Failure' + } +} +} + + +sleep 30 From 1b8ef773bbc20c94673a9b6da1626d2b9f2b088b Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 31 Jan 2019 06:23:13 -0500 Subject: [PATCH 043/109] Test --- Jenkinsfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 287ec9a..429869d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ node(label) imageTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) } stage("Info"){ - sh "echo $imageTag" + sh "echo ${params.imageTag}" } stage ("Unit Tests"){ sh 'echo "Here will be unit tests"' @@ -39,8 +39,8 @@ node(label) stage("Test code using PyLint and version build"){ container('python-alpine'){ pathTocode = pwd() - sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTag}" - sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTag}" + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${params.imageTag}" + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${params.imageTag}" sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" sh 'cat template.yaml' } @@ -48,12 +48,12 @@ node(label) stage("Build docker images"){ container('docker'){ pathdocker = pwd() - sh "docker build ${pathdocker} -t ${imageN}${imageTag}" - sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${imageTag}" + sh "docker build ${pathdocker} -t ${imageN}${params.imageTag}" + sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${params.imageTag}" sh "docker images" sh "docker push ${imageN}${imageTag}" - sh "docker push ${dockerRegistry}/init-container:${imageTag}" + sh "docker push ${dockerRegistry}/init-container:${params.imageTag}" } } } From 4c67ca0326b157c358faa6790d0146776475dd46 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 31 Jan 2019 06:30:42 -0500 Subject: [PATCH 044/109] Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 429869d..1d136a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,7 +52,7 @@ node(label) sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${params.imageTag}" sh "docker images" - sh "docker push ${imageN}${imageTag}" + sh "docker push ${imageN}${params.imageTag}" sh "docker push ${dockerRegistry}/init-container:${params.imageTag}" } } From da15f32af1edcd40a4709575c1e07696b5b15ca2 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 08:06:57 -0500 Subject: [PATCH 045/109] Test Pipeline --- Jenkinsfile | 116 ++++++++++++++++++++++++++++++++++++++-- images-registry-test.py | 28 ++++++++++ 2 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 images-registry-test.py diff --git a/Jenkinsfile b/Jenkinsfile index 1d136a9..112261a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,7 +40,7 @@ node(label) container('python-alpine'){ pathTocode = pwd() sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${params.imageTag}" - sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${params.imageTag}" + sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${params.imageTag}" sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" sh 'cat template.yaml' } @@ -49,11 +49,11 @@ node(label) container('docker'){ pathdocker = pwd() sh "docker build ${pathdocker} -t ${imageN}${params.imageTag}" - sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${params.imageTag}" + sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${params.imageTag}" sh "docker images" sh "docker push ${imageN}${params.imageTag}" - sh "docker push ${dockerRegistry}/init-container:${params.imageTag}" + sh "docker push ${dockerRegistry}/init-container:${params.imageTag}" } } } @@ -64,4 +64,112 @@ node(label) } -sleep 30 + + + + + +def label = "mypod-${UUID.randomUUID().toString()}" + + +podTemplate(label: label, containers: [ + containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v1', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'docker', image: 'ghostgoose33/docker-in:v1', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.8', command: 'cat', ttyEnabled: true) +], +volumes: [ + hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock') +], serviceAccount: "jenkins") +{ + +def dockerRegistry = "100.71.71.71:5000" +def Creds = "git_cred" +def projName = "get-service" +def imageVersion = "v2" +def imageName = "100.71.71.71:5000/get-service:${imageVersion}" +def imageN = '100.71.71.71:5000/get-service:' + +properties([ + parameters([ + stringParam( + defaultValue: "***", + description: '', + name: 'imageTagGET'), + stringParam( + defaultValue: "***", + description: '', + name: 'imageTagUI'), + stringParam( + defaultValue: "***", + description: '', + name: 'imageTagDB'), + stringParam( + defaultValue: '***', + description: '', + name: 'namespace') + ]) +]) + + +node(label) +{ + try{ + stage("Pre-Test"){ + dir('db'){ + git(branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', credentialsId: "${Creds}") + imageTagDB = (sh (script: "git rev-parse --short HEAD", returnStdout: true)) + tmp = "1" + //imageTagGET = sh(returnStdout: true, script: "git tag -l --points-at HEAD").trim() + pathTocodedb = pwd() + } + } + stage("Test image_regisrty_check"){ + container("python-alpine"){ + check_new = (sh (script: "python3 ${pathTocodeget}/images-registry-test.py db-service ${imageTagDB}", returnStdout:true).trim()) + echo "${check_new}" + } + } + + stage ("Unit Tests"){ + sh 'echo "Here will be unit tests"' + } + stage("Test code using PyLint and version build"){ + container('python-alpine'){ + pathTocode = pwd() + sh "python3 ${pathTocodedb}/pylint-test.py ${pathTocodedb}/app/routes.py" + } + } + stage("Build docker image"){ + container('docker'){ + pathdocker = pwd() + if ("${tmp}" == "${check_new}"){ + sh "python3 ${pathTocodedb}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTagDB}" + sh "python3 ${pathTocodedb}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTagDB}" + sh 'cat template.yaml' + sh "docker images" + sh "cat /etc/docker/daemon.json" + + sh "docker build ${pathTocodedb} -t ${imageN}${imageTagDB}" + sh "docker build ${pathTocodedb}/init-container/ -t ${dockerRegistry}/init-container:${imageTagDB}" + sh "docker images" + + sh "docker push ${imageN}${imageTagDB}" + sh "docker push ${dockerRegistry}/init-container:${imageTagDB}" + build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB", value: "${imageTagDB}"]], wait: true) + } else { + echo "NO" + } + + } + } + } + catch(err){ + currentBuild.result = 'Failure' + } +} +} + + + + + diff --git a/images-registry-test.py b/images-registry-test.py new file mode 100644 index 0000000..ec3737e --- /dev/null +++ b/images-registry-test.py @@ -0,0 +1,28 @@ +import sys +import os +import requests +import json + +def main(): + check_image() + + +def check_image(): + tmp = requests.get("http://100.71.71.71:5000/v2/" + sys.argv[1] + "/tags/list") + req = tmp.json() + #print(req) + if (tmp.status_code == 404): + print("1") + return 1 + else: + if req["name"] == sys.argv[1] and sys.argv[2] in req["tags"]: + print("0") + return 0 + else: + #raise Exception("Image with tag " + sys.argv[1] + " does not exist in Docker Registry with IP: " + sys.argv[1]) + print("1") + return 1 + + +if __name__=='__main__': + main() From 5586e6dd3a1c0ef8e32bdc7040102d96cf507f01 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 08:08:21 -0500 Subject: [PATCH 046/109] Test Pipeline --- Jenkinsfile | 78 +++-------------------------------------------------- 1 file changed, 3 insertions(+), 75 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 112261a..48f54fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,15 @@ def label = "mypod-${UUID.randomUUID().toString()}" + podTemplate(label: label, containers: [ containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v1', command: 'cat', ttyEnabled: true), - containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true), - containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.8', command: 'cat', ttyEnabled: true) + containerTemplate(name: 'docker', image: 'ghostgoose33/docker-in:v1', command: 'cat', ttyEnabled: true) ], volumes: [ hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock') ], serviceAccount: "jenkins") { -def app -def imageTag + def dockerRegistry = "100.71.71.71:5000" def Creds = "git_cred" def projName = "db-service" @@ -18,77 +17,6 @@ def imageVersion = "latest" def imageName = "100.71.71.71:5000/db-service:${imageVersion}" def imageN = '100.71.71.71:5000/db-service:' - -node(label) -{ - try{ - stage("Git Checkout"){ - git( - branch: "test", - url: 'https://github.com/Kv-045DevOps/SRM-DB.git', - credentialsId: "${Creds}") - //sh "git rev-parse --short HEAD > .git/commit-id" - imageTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) - } - stage("Info"){ - sh "echo ${params.imageTag}" - } - stage ("Unit Tests"){ - sh 'echo "Here will be unit tests"' - } - stage("Test code using PyLint and version build"){ - container('python-alpine'){ - pathTocode = pwd() - sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/db-service ${params.imageTag}" - sh "python3 ${pathTocode}/sed_python.py template.yaml ${dockerRegistry}/init-container ${params.imageTag}" - sh "python3 ${pathTocode}/pylint-test.py ${pathTocode}/app/routes.py" - sh 'cat template.yaml' - } - } - stage("Build docker images"){ - container('docker'){ - pathdocker = pwd() - sh "docker build ${pathdocker} -t ${imageN}${params.imageTag}" - sh "docker build ${pathdocker}/init-container/ -t ${dockerRegistry}/init-container:${params.imageTag}" - sh "docker images" - - sh "docker push ${imageN}${params.imageTag}" - sh "docker push ${dockerRegistry}/init-container:${params.imageTag}" - } - } - } - catch(err){ - currentBuild.result = 'Failure' - } -} -} - - - - - - - -def label = "mypod-${UUID.randomUUID().toString()}" - - -podTemplate(label: label, containers: [ - containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v1', command: 'cat', ttyEnabled: true), - containerTemplate(name: 'docker', image: 'ghostgoose33/docker-in:v1', command: 'cat', ttyEnabled: true), - containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.8', command: 'cat', ttyEnabled: true) -], -volumes: [ - hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock') -], serviceAccount: "jenkins") -{ - -def dockerRegistry = "100.71.71.71:5000" -def Creds = "git_cred" -def projName = "get-service" -def imageVersion = "v2" -def imageName = "100.71.71.71:5000/get-service:${imageVersion}" -def imageN = '100.71.71.71:5000/get-service:' - properties([ parameters([ stringParam( From b9f8b0ec7821b9eb39fe7e7860f125b2e4bb860a Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 08:16:08 -0500 Subject: [PATCH 047/109] Test Pipeline --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 48f54fd..d358fdd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,7 +53,7 @@ node(label) } stage("Test image_regisrty_check"){ container("python-alpine"){ - check_new = (sh (script: "python3 ${pathTocodeget}/images-registry-test.py db-service ${imageTagDB}", returnStdout:true).trim()) + check_new = (sh (script: "python3 ${pathTocodedb}/images-registry-test.py db-service ${imageTagDB}", returnStdout:true).trim()) echo "${check_new}" } } From 1736ea1cb49ba614b5f9776372e3bc67831589de Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 08:21:52 -0500 Subject: [PATCH 048/109] Test Pipeline --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d358fdd..6426d2b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,8 +71,11 @@ node(label) container('docker'){ pathdocker = pwd() if ("${tmp}" == "${check_new}"){ + container("python-alpine"){ sh "python3 ${pathTocodedb}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTagDB}" sh "python3 ${pathTocodedb}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTagDB}" + } + container("docker"){ sh 'cat template.yaml' sh "docker images" sh "cat /etc/docker/daemon.json" @@ -83,6 +86,7 @@ node(label) sh "docker push ${imageN}${imageTagDB}" sh "docker push ${dockerRegistry}/init-container:${imageTagDB}" + } build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB", value: "${imageTagDB}"]], wait: true) } else { echo "NO" From 0e1f7971f104288f24a23f888a01956396bd2f60 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 08:26:17 -0500 Subject: [PATCH 049/109] Test Pipeline --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6426d2b..030b2bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,11 +72,11 @@ node(label) pathdocker = pwd() if ("${tmp}" == "${check_new}"){ container("python-alpine"){ - sh "python3 ${pathTocodedb}/sed_python.py template.yaml ${dockerRegistry}/db-service ${imageTagDB}" - sh "python3 ${pathTocodedb}/sed_python.py template.yaml ${dockerRegistry}/init-container ${imageTagDB}" + sh "python3 ${pathTocodedb}/sed_python.py ${pathTocodedb}/template.yaml ${dockerRegistry}/db-service ${imageTagDB}" + sh "python3 ${pathTocodedb}/sed_python.py ${pathTocodedb}/template.yaml ${dockerRegistry}/init-container ${imageTagDB}" } container("docker"){ - sh 'cat template.yaml' + sh 'cat ${pathTocodedb}/template.yaml' sh "docker images" sh "cat /etc/docker/daemon.json" From d5575ecf4a5b67b2535effa6e480f45893a16238 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 08:29:15 -0500 Subject: [PATCH 050/109] Test Pipeline --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 030b2bc..8b62094 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -76,7 +76,7 @@ node(label) sh "python3 ${pathTocodedb}/sed_python.py ${pathTocodedb}/template.yaml ${dockerRegistry}/init-container ${imageTagDB}" } container("docker"){ - sh 'cat ${pathTocodedb}/template.yaml' + sh "cat ${pathTocodedb}/template.yaml" sh "docker images" sh "cat /etc/docker/daemon.json" From 196cb7a61470b0b2c9c4da4f0b6f15dd00329364 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 09:46:51 -0500 Subject: [PATCH 051/109] Testing E2E --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b62094..51d3663 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: "***", - description: '', + description: 'Current', name: 'imageTagGET'), stringParam( defaultValue: "***", From 5476fe36b61ede83248a1ddb812da64baa435816 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 11:04:57 -0500 Subject: [PATCH 052/109] Stage 3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 51d3663..fb60187 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ properties([ name: 'imageTagGET'), stringParam( defaultValue: "***", - description: '', + description: 'Current', name: 'imageTagUI'), stringParam( defaultValue: "***", From 446b2dea2924ef825916bbe4942b078d967bcdf7 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 11:35:23 -0500 Subject: [PATCH 053/109] Stage 3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fb60187..a90a822 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ properties([ name: 'imageTagUI'), stringParam( defaultValue: "***", - description: '', + description: 'Current', name: 'imageTagDB'), stringParam( defaultValue: '***', From 9951fa1ee80470cb037ed80c15501be68ccaaea8 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 12:06:00 -0500 Subject: [PATCH 054/109] Test after deploy --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a90a822..fb60187 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,7 @@ properties([ name: 'imageTagUI'), stringParam( defaultValue: "***", - description: 'Current', + description: '', name: 'imageTagDB'), stringParam( defaultValue: '***', From ede04d5b126c112fabfd4f28f144867828bd0097 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 12:21:03 -0500 Subject: [PATCH 055/109] First failed test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fb60187..51d3663 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ properties([ name: 'imageTagGET'), stringParam( defaultValue: "***", - description: 'Current', + description: '', name: 'imageTagUI'), stringParam( defaultValue: "***", From d0ffcd8877ac6aec88af5e57b29f35247b745d25 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 12:39:28 -0500 Subject: [PATCH 056/109] Stage 3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 51d3663..8b62094 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: "***", - description: 'Current', + description: '', name: 'imageTagGET'), stringParam( defaultValue: "***", From e908868c343009185fb86ac429294243ce1940af Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 13:05:48 -0500 Subject: [PATCH 057/109] Sleep test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b62094..904b38d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: "***", - description: '', + description: 'C', name: 'imageTagGET'), stringParam( defaultValue: "***", From 99e4556dd04e9efc957e3b9034591f324dcfbf3e Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 13:22:13 -0500 Subject: [PATCH 058/109] Last Test --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 904b38d..8b62094 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: "***", - description: 'C', + description: '', name: 'imageTagGET'), stringParam( defaultValue: "***", From 7288d0b96047d262a626a1e96ee2d4c44aaa5746 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 3 Feb 2019 13:38:49 -0500 Subject: [PATCH 059/109] Test#4 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b62094..39645ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ properties([ name: 'imageTagDB'), stringParam( defaultValue: '***', - description: '', + description: 'Name', name: 'namespace') ]) ]) From 32ca4d47aad80bcd0e9c060799fc9659af55f399 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 6 Feb 2019 15:37:14 -0500 Subject: [PATCH 060/109] Without pull --- Jenkinsfile | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 39645ed..2c562aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ def label = "mypod-${UUID.randomUUID().toString()}" podTemplate(label: label, containers: [ - containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v1', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v2', command: 'cat', ttyEnabled: true), containerTemplate(name: 'docker', image: 'ghostgoose33/docker-in:v1', command: 'cat', ttyEnabled: true) ], volumes: [ @@ -22,19 +22,23 @@ properties([ stringParam( defaultValue: "***", description: '', - name: 'imageTagGET'), + name: 'imageTagGET_'), stringParam( defaultValue: "***", description: '', - name: 'imageTagUI'), + name: 'imageTagUI_'), stringParam( defaultValue: "***", description: '', - name: 'imageTagDB'), + name: 'imageTagDB_'), stringParam( defaultValue: '***', description: 'Name', - name: 'namespace') + name: 'namespace'), + stringParam( + defaultValue: '', + description: 'TAG', + name: 'service') ]) ]) @@ -47,13 +51,12 @@ node(label) git(branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', credentialsId: "${Creds}") imageTagDB = (sh (script: "git rev-parse --short HEAD", returnStdout: true)) tmp = "1" - //imageTagGET = sh(returnStdout: true, script: "git tag -l --points-at HEAD").trim() - pathTocodedb = pwd() + pathoTocodedb = pwd() } } stage("Test image_regisrty_check"){ container("python-alpine"){ - check_new = (sh (script: "python3 ${pathTocodedb}/images-registry-test.py db-service ${imageTagDB}", returnStdout:true).trim()) + check_new = (sh (script: "python3 /images-registry-test.py db-service ${imageTagDB}", returnStdout:true).trim()) echo "${check_new}" } } @@ -64,19 +67,14 @@ node(label) stage("Test code using PyLint and version build"){ container('python-alpine'){ pathTocode = pwd() - sh "python3 ${pathTocodedb}/pylint-test.py ${pathTocodedb}/app/routes.py" + sh "python3 /pylint-test.py ${pathTocodedb}/app/routes.py" } } stage("Build docker image"){ container('docker'){ pathdocker = pwd() if ("${tmp}" == "${check_new}"){ - container("python-alpine"){ - sh "python3 ${pathTocodedb}/sed_python.py ${pathTocodedb}/template.yaml ${dockerRegistry}/db-service ${imageTagDB}" - sh "python3 ${pathTocodedb}/sed_python.py ${pathTocodedb}/template.yaml ${dockerRegistry}/init-container ${imageTagDB}" - } container("docker"){ - sh "cat ${pathTocodedb}/template.yaml" sh "docker images" sh "cat /etc/docker/daemon.json" @@ -87,7 +85,10 @@ node(label) sh "docker push ${imageN}${imageTagDB}" sh "docker push ${dockerRegistry}/init-container:${imageTagDB}" } - build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB", value: "${imageTagDB}"]], wait: true) + build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB_", value: "${imageTagDB}"], + [$class: 'StringParameterValue', name:"imageTagUI_", value: "${params.imageTagUI_}"], + [$class: 'StringParameterValue', name:"imageTagGET_", value: "${params.imageTagGET_}"], + [$class: 'StringParameterValue', name:"service", value: "db"]]], wait: true) } else { echo "NO" } From 2d17aaece9058986caad358b413c7ddc550ed011 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 6 Feb 2019 15:46:23 -0500 Subject: [PATCH 061/109] Without pull --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c562aa..5ec1ef7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -88,7 +88,7 @@ node(label) build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB_", value: "${imageTagDB}"], [$class: 'StringParameterValue', name:"imageTagUI_", value: "${params.imageTagUI_}"], [$class: 'StringParameterValue', name:"imageTagGET_", value: "${params.imageTagGET_}"], - [$class: 'StringParameterValue', name:"service", value: "db"]]], wait: true) + [$class: 'StringParameterValue', name:"service", value: "db"]], wait: true) } else { echo "NO" } From 2be528190ba78f441186292dc59074017d515b28 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 6 Feb 2019 16:01:03 -0500 Subject: [PATCH 062/109] Without pull --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5ec1ef7..dc4b96b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,7 +51,7 @@ node(label) git(branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', credentialsId: "${Creds}") imageTagDB = (sh (script: "git rev-parse --short HEAD", returnStdout: true)) tmp = "1" - pathoTocodedb = pwd() + pathTocodedb = pwd() } } stage("Test image_regisrty_check"){ From 478ef47bdbc6f2ce8769d8c20aa07abba9dc68d2 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 7 Feb 2019 04:21:22 -0500 Subject: [PATCH 063/109] Without pull#3 --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index dc4b96b..a03f73b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -84,6 +84,7 @@ node(label) sh "docker push ${imageN}${imageTagDB}" sh "docker push ${dockerRegistry}/init-container:${imageTagDB}" + sleep 20 } build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB_", value: "${imageTagDB}"], [$class: 'StringParameterValue', name:"imageTagUI_", value: "${params.imageTagUI_}"], From 9f270664c6cf9adabd3e28d620b945785d42ff7e Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Fri, 8 Feb 2019 05:12:22 -0500 Subject: [PATCH 064/109] Without pull --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a03f73b..5e2a953 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: "***", - description: '', + description: 'C', name: 'imageTagGET_'), stringParam( defaultValue: "***", From 6ddc66f71a0a3e9d09cbbf4b2ab085eb05ef7f24 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Fri, 8 Feb 2019 05:41:45 -0500 Subject: [PATCH 065/109] Without pull 08.02.2019 --- template.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/template.yaml b/template.yaml index 70de851..b96bb13 100644 --- a/template.yaml +++ b/template.yaml @@ -1,17 +1,20 @@ --- -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: namespace: production name: db-service spec: + selector: + matchLabels: + app: db-service template: metadata: labels: app: db-service spec: initContainers: - - image: 100.71.71.71:5000/init-container:latest + - image: 100.71.71.71:5000/init-container:${params.imageTagDB_} name: init-container-postgres env: - name: PGDATABASE @@ -31,7 +34,7 @@ spec: key: password command: ['sh', '-c', '/bin/bash /tmp/check_dump.sh'] containers: - - image: 100.71.71.71:5000/db-service:latest + - image: 100.71.71.71:5000/db-service:${params.imageTagDB_} name: db-service ports: - containerPort: 5002 @@ -39,7 +42,7 @@ spec: - name: POSTGRES_HOST value: srmsystemdb - name: POSTGRES_PORT - value: "5432" + value: '5432' - name: PGDATABASE valueFrom: secretKeyRef: @@ -68,3 +71,4 @@ spec: - protocol: TCP port: 5002 targetPort: 5002 +--- From 1d0db92cb04245c3f6d48a949bca0190b01591c1 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Fri, 8 Feb 2019 06:06:47 -0500 Subject: [PATCH 066/109] Without pull 08.02.2018#1 --- Jenkinsfile | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e2a953..4fae7d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ def label = "mypod-${UUID.randomUUID().toString()}" podTemplate(label: label, containers: [ - containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v2', command: 'cat', ttyEnabled: true), + containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v3', command: 'cat', ttyEnabled: true), containerTemplate(name: 'docker', image: 'ghostgoose33/docker-in:v1', command: 'cat', ttyEnabled: true) ], volumes: [ @@ -19,22 +19,6 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ - stringParam( - defaultValue: "***", - description: 'C', - name: 'imageTagGET_'), - stringParam( - defaultValue: "***", - description: '', - name: 'imageTagUI_'), - stringParam( - defaultValue: "***", - description: '', - name: 'imageTagDB_'), - stringParam( - defaultValue: '***', - description: 'Name', - name: 'namespace'), stringParam( defaultValue: '', description: 'TAG', From bfc4a8f45b49ef7e7be99ec243c9ad065685c5fd Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Fri, 8 Feb 2019 06:18:30 -0500 Subject: [PATCH 067/109] Without pull 08.02.2018#1 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4fae7d4..a341044 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: '', - description: 'TAG', + description: 'TAG_Change', name: 'service') ]) ]) From 5d813fdb3fbba789aca8b42be3742ceb48fc5f88 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Fri, 8 Feb 2019 07:23:36 -0500 Subject: [PATCH 068/109] Without pull 08.02.2019#3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a341044..4fae7d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ properties([ parameters([ stringParam( defaultValue: '', - description: 'TAG_Change', + description: 'TAG', name: 'service') ]) ]) From 1c9316f0fa6bbc1fbdb04df14803b53cdc4d34b2 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 11:48:10 -0500 Subject: [PATCH 069/109] Testing Jenkinfiles HELM E2E --- Jenkinsfile_v1 | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 54fe284..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -1,45 +1,3 @@ -// node { -// def db_service -// def init_container - -// // Checking, that the repository was cloned to workspace -// stage('Clone repository') { - -// checkout scm -// gitTag = sh (script: "git rev-parse --short HEAD", returnStdout: true) - -// } - -// // Build docker image for db-service -// stage('Build db-service image') { - -// db_service = docker.build("akubrachenko/db-service:test") - -// } - -// // Build docker image for init container -// stage('Build init-container image') { - -// //sh 'docker build -f init-container/Dockerfile -t akubrachenko/init-container:test init-container/' -// init_container = docker.build("akubrachenko/init-container:test", "-f init-container/Dockerfile init-container/") -// } - -// // Push image db-service to the docker hub -// stage('Push db-service image') { -// docker.withRegistry('', 'docker_pass') { -// db_service.push() -// } -// } - -// // Push image init container to the docker hub -// stage('Push init-conatainer image') { -// docker.withRegistry('', 'docker_pass') { -// init_container.push() -// } -// } - -// //Push to claster -// } def label = "mypod-${UUID.randomUUID().toString()}" podTemplate(label: label, containers: [ From 8e6aa447baf82499fb65d6dba23f3246a4b0da8d Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 11:56:39 -0500 Subject: [PATCH 070/109] Testing Jenkinfiles HELM E2E --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..6fc2f96 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Check"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 18b5888177b25754fd2479085faee5f02b665801 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:04:00 -0500 Subject: [PATCH 071/109] Testing Jenkinfiles HELM E2E - init commit --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 6fc2f96..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Check"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 19d125315e761884c61dded34e37683832187db3 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:09:48 -0500 Subject: [PATCH 072/109] Testing Jenkinfiles HELM E2E - init commit --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..6fc2f96 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Check"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From c24ee9de4b782097533d03e16cc01bbda6579b0d Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:15:59 -0500 Subject: [PATCH 073/109] Testing Jenkinfiles HELM E2E - init commit --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 6fc2f96..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Check"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From b48b7a69b81efc4afdaa72f55ab289d172c5280b Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:28:44 -0500 Subject: [PATCH 074/109] Testing Jenkinfiles HELM E2E - init commit --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..6fc2f96 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Check"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From e0df4c813c4b506c3a46a7479614b3498a548015 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:41:35 -0500 Subject: [PATCH 075/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 6fc2f96..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Check"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 045b9cb5fe725a9601c048bff5f320716031f8e9 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:50:10 -0500 Subject: [PATCH 076/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..c303ec4 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Checkou"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 942600a4f53e049374ce9a151eb2ee189870b3c9 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 12:56:50 -0500 Subject: [PATCH 077/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index c303ec4..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkou"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 0b474d29a0f237039645620b7e0b06161ee61ace Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 13:09:25 -0500 Subject: [PATCH 078/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..6fc2f96 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Check"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 8a23a6fca0dee01936e02180b1315c0271e5f4f6 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 13:25:00 -0500 Subject: [PATCH 079/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 6fc2f96..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Check"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 540650d0a41149253993eafe52d152231d178efa Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 16:58:16 -0500 Subject: [PATCH 080/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..6fc2f96 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Check"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 8185fe054fde511d59e2c2f16d6c4908b2e6a733 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 17:11:27 -0500 Subject: [PATCH 081/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 6fc2f96..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Check"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 042e5fa4d5f4153eb95cf7b6122a998936dec318 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 17:27:15 -0500 Subject: [PATCH 082/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 7cb74d6..6fc2f96 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Checkout"){ + stage("Git Check"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From f1522f0221a4d02d2e76c3a42a1e5a144e8c220f Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Sun, 10 Feb 2019 17:56:02 -0500 Subject: [PATCH 083/109] Testing Jenkinfiles HELM E2E - init commit#2 --- Jenkinsfile_v1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_v1 b/Jenkinsfile_v1 index 6fc2f96..7cb74d6 100644 --- a/Jenkinsfile_v1 +++ b/Jenkinsfile_v1 @@ -22,7 +22,7 @@ def imageN = '100.71.71.71:5000/db-service:' node(label) { try{ - stage("Git Check"){ + stage("Git Checkout"){ git( branch: "test", url: 'https://github.com/Kv-045DevOps/SRM-DB.git', From 455f0fd445e783a169b499484dfb4b4d8832901e Mon Sep 17 00:00:00 2001 From: "a.kubrachenko" Date: Mon, 11 Feb 2019 20:08:25 +0200 Subject: [PATCH 084/109] for demo 4 --- init-container/check_dump.sh | 6 +++--- template.yaml | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/init-container/check_dump.sh b/init-container/check_dump.sh index e7593b1..2a7c223 100755 --- a/init-container/check_dump.sh +++ b/init-container/check_dump.sh @@ -1,9 +1,9 @@ -until pg_isready -h srmsystemdb -p 5432; do echo waiting for database; sleep 2; done; -export SELECT=$(psql -t -h srmsystemdb -p 5432 -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") +until pg_isready; do echo waiting for database; sleep 2; done; +export SELECT=$(psql -t -c "select 1 from information_schema.tables where table_schema='public' and table_name='department'") if [ $SELECT = 1 ] then exit 0 else - psql -h srmsystemdb -p 5432 -f dbdump + psql -f dbdump exit 0 fi \ No newline at end of file diff --git a/template.yaml b/template.yaml index b96bb13..5a15442 100644 --- a/template.yaml +++ b/template.yaml @@ -17,6 +17,11 @@ spec: - image: 100.71.71.71:5000/init-container:${params.imageTagDB_} name: init-container-postgres env: + - name: PGHOST + valueFrom: + secretKeyRef: + name: db-secret + key: dbhost - name: PGDATABASE valueFrom: secretKeyRef: @@ -32,6 +37,8 @@ spec: secretKeyRef: name: db-secret key: password + - name: PGPORT + value: "5432" command: ['sh', '-c', '/bin/bash /tmp/check_dump.sh'] containers: - image: 100.71.71.71:5000/db-service:${params.imageTagDB_} @@ -40,9 +47,12 @@ spec: - containerPort: 5002 env: - name: POSTGRES_HOST - value: srmsystemdb + valueFrom: + secretKeyRef: + name: db-secret + key: dbhost - name: POSTGRES_PORT - value: '5432' + value: "5432" - name: PGDATABASE valueFrom: secretKeyRef: @@ -57,7 +67,7 @@ spec: valueFrom: secretKeyRef: name: db-secret - key: password + key: password --- kind: Service apiVersion: v1 From 5619927ecadabf937d9d76b3a0aa576e0a8b40c0 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Mon, 11 Feb 2019 14:29:10 -0500 Subject: [PATCH 085/109] Test ISTIO - add annotations --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4fae7d4..9d90f44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ def label = "mypod-${UUID.randomUUID().toString()}" -podTemplate(label: label, containers: [ +podTemplate(label: label, annotations: [podAnnotation(key: "sidecar.istio.io/inject", value: "false")], containers: [ containerTemplate(name: 'python-alpine', image: 'ghostgoose33/python-alp:v3', command: 'cat', ttyEnabled: true), containerTemplate(name: 'docker', image: 'ghostgoose33/docker-in:v1', command: 'cat', ttyEnabled: true) ], From eeceb73f0b4a38ad4c40b3a7cc57b80df3149e6f Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Mon, 11 Feb 2019 14:48:56 -0500 Subject: [PATCH 086/109] TEST ISTIO --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9d90f44..18ca94a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From 84c9b3e1ea32b696bca6ccd72c5edaa9558c42e5 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Mon, 11 Feb 2019 15:04:53 -0500 Subject: [PATCH 087/109] Troubleshooting DB --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 18ca94a..9d90f44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From c834fbf34198c94b4491e33584843e500dcd2f6c Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Mon, 11 Feb 2019 15:17:14 -0500 Subject: [PATCH 088/109] Test Deploy --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9d90f44..18ca94a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From 63a0d1b5e05c3650884c4219b569b76cc31eceea Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Mon, 11 Feb 2019 15:25:27 -0500 Subject: [PATCH 089/109] Test Deploy --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 18ca94a..9d90f44 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From 1ddcfef6547aa2460f9eb0cde48415ad91b8c8d3 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Mon, 11 Feb 2019 15:31:28 -0500 Subject: [PATCH 090/109] Test Deploy --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9d90f44..18ca94a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From ff500844364c3524a76ab6d833686b4181005087 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 13:37:06 -0500 Subject: [PATCH 091/109] Result not local --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 18ca94a..a42734d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -70,7 +70,7 @@ node(label) sh "docker push ${dockerRegistry}/init-container:${imageTagDB}" sleep 20 } - build(job: 'test_e2e', parameters: [[$class: 'StringParameterValue', name:"imageTagDB_", value: "${imageTagDB}"], + build(job: 'GitHub/GET-SERVICES/test1', parameters: [[$class: 'StringParameterValue', name:"imageTagDB_", value: "${imageTagDB}"], [$class: 'StringParameterValue', name:"imageTagUI_", value: "${params.imageTagUI_}"], [$class: 'StringParameterValue', name:"imageTagGET_", value: "${params.imageTagGET_}"], [$class: 'StringParameterValue', name:"service", value: "db"]], wait: true) From 20cb80d25ebde35e98ea966c900d681fca045638 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 13:53:33 -0500 Subject: [PATCH 092/109] Test Helm charts --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a42734d..b80f359 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From c73dccf9932afab86e5ab75acfe8528912dce315 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 14:10:10 -0500 Subject: [PATCH 093/109] Test Git Jenkinsfile Istio --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b80f359..a42734d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From 690a60b22f7b2f95175f943eb1ac6a5079399137 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 14:29:21 -0500 Subject: [PATCH 094/109] Bug resolve --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a42734d..b80f359 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From f592fe4185c377669563db50ab544f7c8b2a03a9 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 15:04:17 -0500 Subject: [PATCH 095/109] TEST DB --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b80f359..a42734d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From 74b47b5ff17a3976c41dc1859c1c4d0d8c06808e Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 15:48:06 -0500 Subject: [PATCH 096/109] Versions --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a42734d..b80f359 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From f714e7e27b3830e2fc6542e5b19f82e3fa6d99d1 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Tue, 12 Feb 2019 15:56:56 -0500 Subject: [PATCH 097/109] Bug resolve --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b80f359..a42734d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From f8ed2cf58a2939eb1bfbc5fea93db59c92e86a48 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 13 Feb 2019 13:34:44 -0500 Subject: [PATCH 098/109] TEST --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a42734d..b80f359 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From 7097dfab3bd6d9820940eff7b088ebfad726987b Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 13 Feb 2019 13:47:45 -0500 Subject: [PATCH 099/109] TEST DEPLOY POST --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b80f359..a42734d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From 0d78460074d5cec05f502a1621268be8403b47eb Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 13 Feb 2019 13:58:51 -0500 Subject: [PATCH 100/109] TEST DEPLOY POST --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index a42734d..19fbec4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -73,6 +73,7 @@ node(label) build(job: 'GitHub/GET-SERVICES/test1', parameters: [[$class: 'StringParameterValue', name:"imageTagDB_", value: "${imageTagDB}"], [$class: 'StringParameterValue', name:"imageTagUI_", value: "${params.imageTagUI_}"], [$class: 'StringParameterValue', name:"imageTagGET_", value: "${params.imageTagGET_}"], + [$class: 'StringParameterValue', name:"imageTagPOST_", value: "${params.imageTagPOST_}"], [$class: 'StringParameterValue', name:"service", value: "db"]], wait: true) } else { echo "NO" From 13f18aa253d72f824c5ebe884bed589e085e2f53 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Wed, 13 Feb 2019 16:25:47 -0500 Subject: [PATCH 101/109] 23 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19fbec4..5c27bd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From e602d5aede538c68091a4273fbe6c89df43ac0d7 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 06:17:29 -0500 Subject: [PATCH 102/109] B/G Ver 2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5c27bd1..19fbec4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From b855463bef8ec499e3ead195e57d8450c5b07b42 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 06:29:11 -0500 Subject: [PATCH 103/109] B/G v3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19fbec4..5c27bd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From b032e1391ab26013b6989f0b1af13e382bc7cbf8 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 07:31:25 -0500 Subject: [PATCH 104/109] TEST B/G v6 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5c27bd1..19fbec4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '*', description: 'TAG', name: 'service') ]) From e6eff998658ab6397ba933cfa2b8d3533c42f0a6 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 15:03:41 -0500 Subject: [PATCH 105/109] ISTIO FUCKING RELEASE --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19fbec4..5c27bd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '', description: 'TAG', name: 'service') ]) From 3915351dc1351eb17437f2bcdbcc2a18fc692e2b Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 15:27:04 -0500 Subject: [PATCH 106/109] TEST DEPLOY --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5c27bd1..5350209 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '', + defaultValue: '***', description: 'TAG', name: 'service') ]) From 56c4e6e0e5096b0d9244dfb22a9d11b7c47d2c0e Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 15:38:19 -0500 Subject: [PATCH 107/109] TEST DEPLOY#2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5350209..19fbec4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '***', + defaultValue: '*', description: 'TAG', name: 'service') ]) From 1529a06bf7a9ca3ffe228bb62246b845e3f5805e Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 15:47:58 -0500 Subject: [PATCH 108/109] TEST DEPLOY#2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19fbec4..5350209 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '*', + defaultValue: '***', description: 'TAG', name: 'service') ]) From 689ba6bdadc2c60e5c7f92e2a760221750124799 Mon Sep 17 00:00:00 2001 From: Maxghost33 Date: Thu, 14 Feb 2019 16:54:38 -0500 Subject: [PATCH 109/109] TEST B/G v45 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5350209..5c27bd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ def imageN = '100.71.71.71:5000/db-service:' properties([ parameters([ stringParam( - defaultValue: '***', + defaultValue: '', description: 'TAG', name: 'service') ])