Skip to content
Snippets Groups Projects
Commit bcd72749 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

simply CI/CD pipelie

parent ea7d6dbe
Branches
No related tags found
1 merge request!7Repair cicd
Pipeline #40978 passed with warnings
...@@ -4,7 +4,7 @@ stages: ...@@ -4,7 +4,7 @@ stages:
- deploy_to_production - deploy_to_production
docker-build-main: docker-build:
# Official docker image. # Official docker image.
image: docker:stable image: docker:stable
stage: build stage: build
...@@ -18,33 +18,16 @@ docker-build-main: ...@@ -18,33 +18,16 @@ docker-build-main:
# deploy test/dev version on 'sdc-dev.astron.nl' # deploy test/dev version on 'sdc-dev.astron.nl'
docker-deploy-main-test: docker-deploy-to-test:
image: docker:latest
stage: deploy_to_test stage: deploy_to_test
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
##
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
##
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client rsync -y )'
##
## Run ssh-agent (inside the build environment)
##
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
##
## Create the SSH directory and give it the right permissions
##
- echo "$SSH_PRIVATE_KEY_USER_SDC" | tr -d '\r' | ssh-add - - echo "$SSH_PRIVATE_KEY_USER_SDC" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- ssh-keyscan dop814.astron.nl >> ~/.ssh/known_hosts - ssh-keyscan dop814.astron.nl >> ~/.ssh/known_hosts
- ssh-keyscan sdc-dev.astron.nl >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts
script: script:
## deploy the docker-compose file and use it to spin up the containers ## deploy the docker-compose file and use it to spin up the containers
...@@ -57,33 +40,15 @@ docker-deploy-main-test: ...@@ -57,33 +40,15 @@ docker-deploy-main-test:
docker-deploy-main-production: docker-deploy-main-production:
# image: docker:latest image: docker:latest
stage: deploy_to_production stage: deploy_to_production
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
##
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
##
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client rsync -y )'
##
## Run ssh-agent (inside the build environment)
##
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
##
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
##
##
## Create the SSH directory and give it the right permissions
##
- echo "$SSH_PRIVATE_KEY_USER_SDC" | tr -d '\r' | ssh-add - - echo "$SSH_PRIVATE_KEY_USER_SDC" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- chmod 700 ~/.ssh - chmod 700 ~/.ssh
- ssh-keyscan dop821.astron.nl >> ~/.ssh/known_hosts - ssh-keyscan dop821.astron.nl >> ~/.ssh/known_hosts
- ssh-keyscan sdc.astron.nl >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts
script: script:
## deploy the docker-compose file and use it to spin up the containers ## deploy the docker-compose file and use it to spin up the containers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment