-
-
Notifications
You must be signed in to change notification settings - Fork 10
GitLab CI/CD support for cookieplone generated template #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
erral
wants to merge
8
commits into
main
Choose a base branch
from
erral-gitlab-container-names
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
928ef66
get back GitLab support for cookieplone generated template
erral 9bce534
changelog
erral fbb6b4b
changelog
erral a7fa347
Update templates/projects/monorepo/{{ cookiecutter.__folder_name }}/d…
erral d69590b
Update templates/projects/monorepo/{{ cookiecutter.__folder_name }}/d…
erral 1831bfd
Update templates/projects/monorepo/{{ cookiecutter.__folder_name }}/d…
erral 89be37f
Update templates/projects/monorepo/{{ cookiecutter.__folder_name }}/d…
erral a1e65c9
Update templates/projects/monorepo/{{ cookiecutter.__folder_name }}/d…
stevepiercy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| GitLab CI/CD support @erral | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
175 changes: 175 additions & 0 deletions
175
templates/projects/monorepo/{{ cookiecutter.__folder_name }}/.gitlab-ci.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| default: | ||
| image: docker:24.0.5 | ||
| services: | ||
| - docker:24.0.5-dind | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common | ||
| - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin | ||
|
|
||
| stages: | ||
| - check | ||
| - test | ||
| - build | ||
| - deploy | ||
|
|
||
| variables: | ||
| # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled | ||
| # DOCKER_HOST: tcp://docker:2376 | ||
| DOCKER_TLS_CERTDIR: "/certs" | ||
| CONTAINER_BACKEND_RELEASE_IMAGE: $CI_REGISTRY_IMAGE/backend | ||
| CONTAINER_FRONTEND_RELEASE_IMAGE: $CI_REGISTRY_IMAGE/frontend | ||
| {%- if cookiecutter.devops_cache == '1' %} | ||
| CONTAINER_VARNISH_RELEASE_IMAGE: $CI_REGISTRY_IMAGE/varnish | ||
| {%- endif %} | ||
|
|
||
| check-backend: | ||
| stage: check | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common git | ||
| script: | ||
| - cd backend | ||
| - make check | ||
|
|
||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
|
|
||
| check-frontend: | ||
| image: node:20-alpine | ||
| stage: check | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common git | ||
| - corepack enable | ||
| script: | ||
| - cd frontend | ||
| - make install | ||
| - make lint | ||
| - make ci-i18n | ||
|
|
||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
|
|
||
|
|
||
| test-backend: | ||
| stage: test | ||
| image: python:3.11-bookworm | ||
| before_script: | ||
| - apt update | ||
| - apt install build-essential python3 python3-dev git -y | ||
| script: | ||
| - cd backend | ||
| - make install | ||
| - make test | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
|
|
||
| test-frontend: | ||
| image: node:20-alpine | ||
| stage: test | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common git | ||
| - corepack enable | ||
|
|
||
| script: | ||
| - cd frontend | ||
| - make install | ||
| - make ci-test | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
|
|
||
| build-backend: | ||
| stage: build | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common | ||
| script: | ||
| - set -e # Stop if the execution of any command fails | ||
| - cd backend | ||
| - make build-image | ||
| - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin | ||
| - docker push $CONTAINER_BACKEND_RELEASE_IMAGE:latest | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
|
|
||
| build-frontend: | ||
| stage: build | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common | ||
|
|
||
| script: | ||
| - set -e # Stop if the execution of any command fails | ||
| - cd frontend | ||
| - make build-image | ||
| - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin | ||
| - docker push $CONTAINER_FRONTEND_RELEASE_IMAGE:latest | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
|
|
||
| {%- if cookiecutter.devops_cache == '1' %} | ||
| build-varnish: | ||
| stage: build | ||
| before_script: | ||
| - apk add --no-cache make bash python3 ncurses openssh-client-common | ||
| script: | ||
| - cd devops/varnish | ||
| - docker build . -t $CONTAINER_VARNISH_RELEASE_IMAGE:latest | ||
| - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin | ||
| - docker push $CONTAINER_VARNISH_RELEASE_IMAGE:latest | ||
|
|
||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == 'merge_request_event' | ||
| {%- endif %} | ||
|
|
||
| deploy: | ||
| stage: deploy | ||
| rules: | ||
| - if: $CI_COMMIT_REF_NAME == "main" | ||
| script: | ||
| - mkdir -p ~/.ssh/ | ||
| - touch ~/.ssh/known_hosts | ||
| - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts | ||
| - chmod 644 ~/.ssh/known_hosts | ||
| - cd devops | ||
| - eval `ssh-agent -s` | ||
| - echo "${DEPLOY_SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null # add ssh key | ||
| - export TERM=dumb | ||
| - touch .env | ||
| - 'echo "DEPLOY_ENV: ${DEPLOY_ENV}" >> .env' | ||
| - 'echo "DEPLOY_HOST: ${DEPLOY_HOST}" >> .env' | ||
| - 'echo "DEPLOY_PORT: ${DEPLOY_PORT}" >> .env' | ||
| - 'echo "DEPLOY_USER: ${DEPLOY_USER}" >> .env' | ||
| - 'echo "DOCKER_CONFIG: ${DOCKER_CONFIG}" >> .env' | ||
| - 'echo "STACK_NAME: ${STACK_NAME}" >> .env' | ||
| - 'echo "STACK_PARAM: ${CI_COMMIT_TAG}" >> .env' | ||
| - make docker-setup | ||
| - make stack-deploy | ||
| environment: production | ||
| # deploy-with-auxiliary-docker-image: | ||
| # stage: deploy | ||
| # variables: | ||
| # REGISTRY: ${CI_REGISTRY} | ||
| # USERNAME: ${CI_REGISTRY_USER} | ||
| # PASSWORD: ${CI_REGISTRY_PASSWORD} | ||
| # REMOTE_HOST: ${DEPLOY_HOST} | ||
| # REMOTE_PORT: ${DEPLOY_PORT} | ||
| # REMOTE_USER: ${DEPLOY_USER} | ||
| # REMOTE_PRIVATE_KEY: "${DEPLOY_SSH_PRIVATE_KEY}" | ||
| # STACK_FILE: devops/stacks/${DEPLOY_HOST}.yml | ||
| # STACK_NAME: ${STACK_NAME} | ||
| # DEPLOY_IMAGE: ghcr.io/kitconcept/docker-stack-deploy:latest | ||
| # script: | ||
| # - docker pull ${DEPLOY_IMAGE} | ||
| # - docker run --rm | ||
| # -v "$(pwd)":/github/workspace | ||
| # -v /var/run/docker.sock:/var/run/docker.sock | ||
| # -e REGISTRY=${REGISTRY} | ||
| # -e USERNAME=${USERNAME} | ||
| # -e PASSWORD=${PASSWORD} | ||
| # -e REMOTE_HOST=${REMOTE_HOST} | ||
| # -e REMOTE_PORT=${REMOTE_PORT} | ||
| # -e REMOTE_USER=${REMOTE_USER} | ||
| # -e REMOTE_PRIVATE_KEY="${REMOTE_PRIVATE_KEY}" | ||
| # -e STACK_FILE=${STACK_FILE} | ||
| # -e STACK_NAME=${STACK_NAME} | ||
| # ${DEPLOY_IMAGE} | ||
| # only: | ||
| # - main | ||
| # environment: production |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.