198 lines
5.9 KiB
YAML
198 lines
5.9 KiB
YAML
---
|
|
|
|
variables:
|
|
MY_PROJECT_ID: "57560288"
|
|
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/centurion_erp.git"
|
|
|
|
# Docker Build / Publish
|
|
DOCKER_IMAGE_BUILD_TARGET_PLATFORMS: "linux/amd64,linux/arm64"
|
|
DOCKER_IMAGE_BUILD_NAME: centurion-erp
|
|
DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE
|
|
DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA
|
|
|
|
# Docker Publish
|
|
DOCKER_IMAGE_PUBLISH_NAME: centurion-erp
|
|
DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing
|
|
DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME
|
|
|
|
# Docs NFC
|
|
PAGES_ENVIRONMENT_PATH: projects/centurion_erp/
|
|
|
|
# RELEASE_ADDITIONAL_ACTIONS_BUMP: ./.gitlab/additional_actions_bump.sh
|
|
|
|
|
|
include:
|
|
- local: .gitlab/pytest.gitlab-ci.yml
|
|
# - local: .gitlab/unit-test.gitlab-ci.yml
|
|
- project: nofusscomputing/projects/gitlab-ci
|
|
ref: development
|
|
file:
|
|
- .gitlab-ci_common.yaml
|
|
- template/automagic.gitlab-ci.yaml
|
|
|
|
|
|
Update Git Submodules:
|
|
extends: .ansible_playbook_git_submodule
|
|
|
|
|
|
Docker Container:
|
|
extends: .build_docker_container
|
|
resource_group: build
|
|
needs: []
|
|
script:
|
|
- update-binfmts --display
|
|
- |
|
|
|
|
echo "[DEBUG] building multiarch/specified arch image";
|
|
|
|
docker buildx build --platform=$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS . \
|
|
--label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \
|
|
--label org.opencontainers.image.documentation="$CI_PROJECT_URL" \
|
|
--label org.opencontainers.image.source="$CI_PROJECT_URL" \
|
|
--label org.opencontainers.image.revision="$CI_COMMIT_SHA" \
|
|
--push \
|
|
--build-arg CI_PROJECT_URL=$CI_PROJECT_URL \
|
|
--build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA \
|
|
--build-arg CI_COMMIT_TAG=$CI_COMMIT_TAG \
|
|
--file $DOCKER_DOCKERFILE \
|
|
--tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
|
|
docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
|
|
# during docker multi platform build there are >=3 additional unknown images added to gitlab container registry. cleanup
|
|
|
|
DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}");
|
|
|
|
docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
|
|
docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG;
|
|
|
|
rules: # rules manually synced from docker/publish.gitlab-ci.yaml removing git tag
|
|
|
|
# - if: # condition_master_branch_push
|
|
# $CI_COMMIT_BRANCH == "master" &&
|
|
# $CI_PIPELINE_SOURCE == "push"
|
|
# exists:
|
|
# - '{dockerfile,dockerfile.j2}'
|
|
# when: always
|
|
|
|
- if:
|
|
$CI_COMMIT_AUTHOR =='nfc_bot <helpdesk@nofusscomputing.com>'
|
|
&&
|
|
$CI_COMMIT_BRANCH == "development"
|
|
when: never
|
|
|
|
- if: # condition_not_master_or_dev_push
|
|
$CI_COMMIT_BRANCH != "master" &&
|
|
$CI_COMMIT_BRANCH != "development" &&
|
|
$CI_PIPELINE_SOURCE == "push"
|
|
exists:
|
|
- '{dockerfile,dockerfile.j2}'
|
|
changes:
|
|
paths:
|
|
- '{dockerfile,dockerfile.j2,includes/**/*}'
|
|
compare_to: 'development'
|
|
when: always
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
exists:
|
|
- '{dockerfile,dockerfile.j2}'
|
|
when: always
|
|
|
|
- if: # condition_dev_branch_push
|
|
(
|
|
$CI_COMMIT_BRANCH == "development"
|
|
||
|
|
$CI_COMMIT_BRANCH == "master"
|
|
)
|
|
&&
|
|
$CI_PIPELINE_SOURCE == "push"
|
|
exists:
|
|
- '{dockerfile,dockerfile.j2}'
|
|
allow_failure: true
|
|
when: on_success
|
|
|
|
- when: never
|
|
|
|
|
|
Docker.Hub.Branch.Publish:
|
|
extends: .publish-docker-hub
|
|
needs: [ "Docker Container" ]
|
|
resource_group: build
|
|
rules: # rules manually synced from docker/publish.gitlab-ci.yaml removing git tag
|
|
|
|
# - if: # condition_master_branch_push
|
|
# $CI_COMMIT_BRANCH == "master" &&
|
|
# $CI_PIPELINE_SOURCE == "push"
|
|
# exists:
|
|
# - '{dockerfile,dockerfile.j2}'
|
|
# when: always
|
|
|
|
- if:
|
|
$CI_COMMIT_AUTHOR =='nfc_bot <helpdesk@nofusscomputing.com>'
|
|
&&
|
|
$CI_COMMIT_BRANCH == "development"
|
|
when: never
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
exists:
|
|
- '{dockerfile,dockerfile.j2}'
|
|
when: always
|
|
|
|
- if: # condition_dev_branch_push
|
|
$CI_COMMIT_BRANCH == "development" &&
|
|
$CI_PIPELINE_SOURCE == "push"
|
|
exists:
|
|
- '{dockerfile,dockerfile.j2}'
|
|
allow_failure: true
|
|
when: on_success
|
|
|
|
- when: never
|
|
|
|
|
|
Github (Push --mirror):
|
|
extends:
|
|
- .git_push_mirror
|
|
needs: []
|
|
rules:
|
|
- if: '$JOB_STOP_GIT_PUSH_MIRROR'
|
|
when: never
|
|
|
|
- if: $GIT_SYNC_URL == null
|
|
when: never
|
|
|
|
- if: # condition_master_or_dev_push
|
|
(
|
|
$CI_COMMIT_BRANCH == "master"
|
|
||
|
|
$CI_COMMIT_BRANCH == "development"
|
|
||
|
|
$CI_COMMIT_BRANCH == "14-feat-project-management"
|
|
) &&
|
|
$CI_PIPELINE_SOURCE == "push"
|
|
when: always
|
|
|
|
- when: never
|
|
|
|
|
|
Website.Submodule.Deploy:
|
|
extends: .submodule_update_trigger
|
|
variables:
|
|
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website
|
|
environment:
|
|
url: https://nofusscomputing.com/$PAGES_ENVIRONMENT_PATH
|
|
name: Documentation
|
|
rules:
|
|
- if: # condition_dev_branch_push
|
|
$CI_COMMIT_BRANCH == "development" &&
|
|
$CI_PIPELINE_SOURCE == "push"
|
|
exists:
|
|
- '{docs/**,pages/**}/*.md'
|
|
changes:
|
|
paths:
|
|
- '{docs/**,pages/**}/*.md'
|
|
compare_to: 'master'
|
|
when: always
|
|
|
|
- when: never
|