Skip to content

Instantly share code, notes, and snippets.

@aviadlevy
aviadlevy / .gitlab-ci-output-template-example.yaml
Last active July 17, 2023 17:10
Example for output from template of gitlab-ci
image: gitlab.***.net:4567/group/project/ci-image:latest
# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- when: always
variables:
PY_COLORS: '1'
GIT_SUBMODULE_STRATEGY: recursive
@aviadlevy
aviadlevy / .gitlab-ci-dynamin-per-project.yaml
Last active July 17, 2023 17:11
GitLab CI per project dynamic deploy
create deploy to dedicated prod:
stage: pre-prod-deploy
image: gitlab.***.net:4567/group/app-infra/ci-image:latest
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.***.net/group/app-infra.git
- cd app-infra
- python3 scripts/generate_ci.py
- cp -r ci-out ..
artifacts:
paths:
@aviadlevy
aviadlevy / jinja.template
Last active July 17, 2023 17:12
Jinja template of gitlab-ci k8s deploy
image: gitlab.****.net:4567/group/project/ci-image:latest
# https://docs.gitlab.com/ee/ci/yaml/index.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- when: always
variables:
PY_COLORS: '1'
@aviadlevy
aviadlevy / .gitlab-ci-dynamic.yaml
Created December 19, 2021 08:16
.gitlab-ci with dynamic pipelines
image: $CI_REGISTRY_IMAGE/$CI_IMAGE_NAME:latest
services:
- docker:dind
stages:
- generate-ci
- triggers
generate-ci:
stage: generate-ci
@aviadlevy
aviadlevy / generic-deployment.yaml
Created December 19, 2021 08:06
Example for "generic" k8s deployment
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: app-xx
name: app-xx
namespace: {{NAMESPACE}}
spec:...
spec:
containers:
@aviadlevy
aviadlevy / .gitlab-ci-new.yml
Created August 12, 2019 07:37
.gitlab-ci-new.yml
image: docker:latest
services:
- docker:dind
stages:
- build
- integration-test
- pre-dev-deploy
- dev-deploy
- continue-to-prod
@aviadlevy
aviadlevy / run_build.sh
Last active August 12, 2019 07:52
run_build.sh
ENV=$1
APP=$2
PACKAGE=$3
mvn clean install
rc=$?
if [[ $rc -ne 0 ]]; then
echo "Maven build failed"; exit $rc
fi
@aviadlevy
aviadlevy / .gitlab-ci-old.yml
Last active August 12, 2019 07:39
.gitlab-ci-old.yml
image: docker:latest
services:
- docker:dind
stages:
- build
- integration-test
- push
- dev-deploy
- prod-deploy
@aviadlevy
aviadlevy / tag-changes.py
Created April 11, 2019 06:59
print changes between 2 last tags
import subprocess
import sys
def git(*args):
"""
:param args: the parameters for the git command
:return: the result of the git command as string
"""
@aviadlevy
aviadlevy / .gitlab-ci.yml
Created April 11, 2019 06:54
.gitlab-ci.yml with versioning and changelog
image: docker:latest
services:
- docker:dind
stages:
- build
- integration
- dev-release
- prod-release