Skip to content
Snippets Groups Projects
Commit d0c017138497 authored by Simon Chabot's avatar Simon Chabot
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
---
image: python:latest
include: "templates/no-duplicate-pipelines.yml"
stages:
- lint
yamllint:
stage: lint
rules:
- changes:
- "**/*.yaml"
- "*.yaml"
- "**/*.yml"
- "*.yml"
script:
- pip install tox
- tox -e yamllint
extends: default
rules:
document-start: disable
line-length: disable
indentation:
spaces: 2
ignore: |
.tox/
node_modules/
# Logilab's public gitlab-ci templates
In the `templates/` you can find some of our gitlab-ci templates.
You can include them in your gitlab-ci.
See [release-new's gitlab-ci](https://forge.extranet.logilab.fr/open-source/release-new/-/blob/branch/default/.gitlab-ci.yml)
for instance, to see how it can be used.
You can also find the official documentation [here](https://docs.gitlab.com/ee/ci/yaml/includes.html),
and some examples [here](https://docs.gitlab.com/ee/ci/yaml/README.html#include).
---
variables:
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
build-debian:
stage: build-debian
image: logilab/cubicweb:buster-buildpackage
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_TAG'
when: on_success
- when: manual
script:
- buildpackage -d `pwd`
- cp -r /repo .
artifacts:
paths:
- repo
upload-deb-to-heptapod:
stage: upload-deb
image: curlimages/curl:latest
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_TAG'
when: on_success
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}"\
--upload-file "repo/${CI_PROJECT_NAME}_${CI_COMMIT_TAG}-1_all.deb"\
"${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}_${CI_COMMIT_TAG}-1_all.deb"
---
image_build:
stage: release
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/Dockerfile
--destination $CI_REGISTRY_IMAGE:$CI_COMMIT_HG_SHORT_SHA
rules:
- if: '$CI_COMMIT_REF_NAME != "branch/default"'
image_build_latest:
stage: release
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor
--context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/Dockerfile
--destination $CI_REGISTRY_IMAGE:$CI_COMMIT_HG_SHORT_SHA
--destination $CI_REGISTRY_IMAGE:latest
rules:
- if: '$CI_COMMIT_REF_NAME == "branch/default"'
---
# avoid running duplicate pipelines for both topic head and MR
# see: https://docs.gitlab.com/ee/ci/yaml/#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_REF_NAME =~ /^topic\/.*/ && $CI_OPEN_MERGE_REQUESTS'
when: never
- when: always
---
pypi-publish:
stage: publish
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_TAG'
when: on_success
script:
- pip install tox
- tox -e pypi-publish
---
create-release-on-heptapod:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: '$CI_MERGE_REQUEST_ID'
when: never
- if: '$CI_COMMIT_TAG'
when: on_success
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG"\
--tag-name $CI_COMMIT_TAG\
--assets-link "{\"name\":\"${CI_PROJECT_NAME}_${CI_COMMIT_TAG}-1_all.deb\",\"url\":\"${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}_${CI_COMMIT_TAG}-1_all.deb\", \"link_type\": \"package\"}"
[tox]
envlist = yamllint
[testenv:yamllint]
skip_install = true
deps = yamllint
commands =
yamllint .
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment