Skip to content

Commit 3dd1c3d

Browse files
committed
Gitlab 2021 pipelines
1 parent 4edeea2 commit 3dd1c3d

27 files changed

+282
-220
lines changed

03-cd/02-gitlab-2021/flaskapp/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ COPY ./requirements.txt /app/requirements.txt
44
WORKDIR /app
55
RUN pip install -r requirements.txt
66
COPY bootcamp.py /app/
7-
ENTRYPOINT [ "python" ]
7+
ENTRYPOINT [ "python3" ]
88
CMD [ "bootcamp.py" ]
99
EXPOSE 8080

03-cd/02-gitlab-2021/myimage/gitlab-ci.yml renamed to 03-cd/02-gitlab-2021/myimage/.gitlab-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
PYTHON_VERSION: "3.9"
2+
PYTHON_VERSION: "3.8"
33
BASE_VERSION: "20.04"
44
BASE_IMAGE_NAME: "ubuntu"
55
REGISTRY_PATH: "$CI_REGISTRY/$CI_PROJECT_PATH"
@@ -16,6 +16,6 @@ docker:build:
1616
- docker build --build-arg base_image_name=$BASE_IMAGE_NAME --build-arg python_version=$PYTHON_VERSION --build-arg base_version=$BASE_VERSION -t $REGISTRY_PATH:$CI_COMMIT_TAG .
1717
- docker push $REGISTRY_PATH:$CI_COMMIT_TAG
1818
- echo "Pushed $IREGISTRY_PATH:$CI_COMMIT_TAG"
19-
only:
20-
variables:
21-
- $CI_COMMIT_TAG != null
19+
rules:
20+
- if: $CI_COMMIT_TAG
21+

03-cd/02-gitlab-2021/myimage/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ FROM $base_image_name:$base_version
44
ARG python_version
55
RUN echo $python_version
66
RUN apt-get update
7-
RUN apt-get install -y python$python_version
7+
RUN apt-get install -y python$python_version python3-pip

03-cd/02-gitlab-2021/pipelines-examples/0-hello.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
stages:
2+
- stage1
3+
4+
testjob:
5+
stage: stage1
6+
before_script:
7+
- echo "Hola mundo"
8+
script:
9+
- echo "Adios mundo"

03-cd/02-gitlab-2021/pipelines-examples/1-hello-image.yml renamed to 03-cd/02-gitlab-2021/pipelines-examples/01-hello-image.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ image: python:3.8-slim
44

55
testjob:
66
stage: stage1
7+
before_script:
8+
- echo "Hola mundo"
79
script:
8-
- echo "Hola mundo"
10+
- echo "Adios mundo"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
stages:
2+
- stage1
3+
4+
image: python:3.8-slim
5+
6+
testjob:
7+
stage: stage1
8+
image: python:3.9-slim
9+
before_script:
10+
- echo "Hola mundo"
11+
script:
12+
- echo "Adios mundo"
13+
14+
testjob2:
15+
stage: stage1
16+
before_script:
17+
- echo "Hola mundo"
18+
script:
19+
- echo "Adios mundo"
20+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
variables:
2+
mi_var: "Es variable global"
3+
4+
5+
stages:
6+
- stage1
7+
- stage2
8+
9+
testjob:
10+
variables:
11+
mi_var: "Esto es una variable de job"
12+
stage: stage1
13+
script:
14+
- echo $mi_var
15+
16+
17+
testjob2:
18+
stage: stage2
19+
script:
20+
- echo $mi_var
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
stages:
2+
- stage1
3+
- stage2
4+
5+
testjob:
6+
stage: stage1
7+
script:
8+
- echo stage en develop
9+
only:
10+
- develop
11+
12+
testjob2:
13+
stage: stage2
14+
script:
15+
- echo stage en master
16+
only:
17+
- master

0 commit comments

Comments
 (0)