Skip to content
Extraits de code Groupes Projets
Valider d89d1a50 rédigé par Steel's avatar Steel
Parcourir les fichiers

initial version

parent 53ebb357
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #8694 en échec
include:
# include the component located in the current project from the current SHA
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/my-component@$CI_COMMIT_SHA
inputs:
stage: build
stages: [build, test, release]
# Check if `component job of my-component` is added.
# This example job could also test that the included component works as expected.
# You can inspect data generated by the component, use GitLab API endpoints, or third-party tools.
ensure-job-added:
stage: test
image: badouralix/curl-jq
# Replace "component job of my-component" with the job name in your component.
script:
- |
route="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs"
count=`curl --silent "$route" | jq 'map(select(.name | contains("deploy-dokku"))) | length'`
if [ "$count" != "1" ]; then
exit 1; else
echo "Component Job present"
fi
# If the pipeline is for a new tag with a semantic version, and all previous jobs succeed,
# create the release.
create-release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
script: echo "Creating release $CI_COMMIT_TAG"
rules:
- if: $CI_COMMIT_TAG
release:
tag_name: $CI_COMMIT_TAG
description: "Release $CI_COMMIT_TAG of components repository $CI_PROJECT_PATH"
{
"yaml.schemas": {
"https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json": "file:///home/steel/code/arise/components/dokku/templates/deploy.yml"
}
}
\ No newline at end of file
spec:
inputs:
stage:
default: deploy
project:
description: "Le nom du projet Dokku"
when:
default: manual
environment:
default: production
url:
default: ""
image:
description: "L'image Docker à déployer"
default: ""
remote:
description: "L'adresse SSH du serveur Dokku"
default: "ssh://dokku@deploy.runner.iiens.net"
---
.dokku:
stage: $[[ inputs.stage ]]
when: $[[ inputs.when ]]
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/dokku/ci-docker-image
variables:
GIT_PUSH_FLAGS: --force
BRANCH: main
GIT_REMOTE_URL: $[[ inputs.remote ]]/$[[ inputs.project ]]
DEPLOY_DOCKER_IMAGE: $[[ inputs.image ]]
script:
- dokku-deploy
after_script:
- dokku-unlock
deploy-prod:
extends: .dokku
environment:
name: $[[ inputs.environment ]]
url: $[[ inputs.url ]]
action: start
on_stop: stop-prod
stop-deploy-dokku:
extends: .dokku-stop
environment:
name: $[[ inputs.environment ]]
url: $[[ inputs.url ]]
action: stop
script:
- setup-ssh
- ssh "$[[ inputs.remote ]]" -- ps:stop "$(parse-app-name)"
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter