-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #429 from dnum-mi/develop
Develop
- Loading branch information
Showing
24 changed files
with
153 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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,58 @@ | ||
# This file is an example on how to use CI on Gitlab DSO platform, it is not yet functionnal with environnment | ||
# references for includes are at https://github.com/hexa-forge/gitlab-ci-catalog | ||
stages: | ||
- read-secret | ||
- build-push | ||
|
||
include: | ||
- project: $CATALOG_PATH | ||
file: vault-ci.yml | ||
ref: main | ||
- project: $CATALOG_PATH | ||
file: kaniko-ci.yml | ||
ref: main | ||
|
||
vault:read_secret: | ||
stage: read-secret | ||
|
||
.build-push-branches: | ||
only: | ||
refs: | ||
- branches | ||
extends: .kaniko:build-push | ||
stage: build-push | ||
variables: | ||
WORKING_DIR: . | ||
|
||
.build-push-tags: | ||
only: | ||
refs: | ||
- tags | ||
extends: .kaniko:build-push | ||
stage: build-push | ||
variables: | ||
WORKING_DIR: . | ||
|
||
build-push-server-tag: | ||
extends: .build-push-tags | ||
variables: | ||
IMAGES_NAMES: server:$CI_COMMIT_TAG server:latest | ||
DOCKERFILE: apps/server/Dockerfile | ||
|
||
build-push-client-tag: | ||
extends: .build-push-tags | ||
variables: | ||
IMAGES_NAMES: client:$CI_COMMIT_TAG client:latest | ||
DOCKERFILE: apps/client/Dockerfile | ||
|
||
build-push-server-branch: | ||
extends: .build-push-branches | ||
variables: | ||
IMAGES_NAMES: server:$CI_COMMIT_BRANCH | ||
DOCKERFILE: apps/server/Dockerfile | ||
|
||
build-push-client-branch: | ||
extends: .build-push-branches | ||
variables: | ||
IMAGES_NAMES: client:$CI_COMMIT_BRANCH | ||
DOCKERFILE: apps/client/Dockerfile |
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,24 +1,11 @@ | ||
repo_pull_sync: | ||
image: ubuntu:20.04 | ||
stage: build | ||
include: | ||
- project: $CATALOG_PATH | ||
file: mirror.yml | ||
ref: main | ||
|
||
repo_pull_sync: | ||
extends: .repo_pull_sync | ||
only: | ||
- api | ||
- triggers | ||
before_script: | ||
- apt-get update -y && apt install gpg wget -y | ||
- wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | tee /usr/share/keyrings/hashicorp-archive-keyring.gpg >/dev/null | ||
- echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com focal main" | tee /etc/apt/sources.list.d/hashicorp.list | ||
- apt-get update -y && apt-get install openssh-client git vault -y | ||
script: | ||
- export VAULT_ADDR=$VAULT_SERVER_URL | ||
- export VAULT_TOKEN="$(vault write -field=token auth/jwt/login role=default-ci jwt=$CI_JOB_JWT)" | ||
- export GIT_INPUT_USER=`vault kv get -field=GIT_INPUT_USER forge-dso/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}` | ||
- export GIT_INPUT_PASSWORD=`vault kv get -field=GIT_INPUT_PASSWORD forge-dso/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}` | ||
- export GIT_INPUT_URL=`vault kv get -field=GIT_INPUT_URL forge-dso/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}` | ||
- export GIT_OUTPUT_USER=`vault kv get -field=GIT_OUTPUT_USER forge-dso/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}` | ||
- export GIT_OUTPUT_PASSWORD=`vault kv get -field=GIT_OUTPUT_PASSWORD forge-dso/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}` | ||
- export GIT_OUTPUT_URL=`vault kv get -field=GIT_OUTPUT_URL forge-dso/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}` | ||
- git clone "https://${GIT_INPUT_USER}:${GIT_INPUT_PASSWORD}@${GIT_INPUT_URL}" ./clonerepo | ||
- cd clonerepo | ||
- git checkout ${GIT_BRANCH_DEPLOY} | ||
- git push --force --prune "https://${GIT_OUTPUT_USER}:${GIT_OUTPUT_PASSWORD}@${GIT_OUTPUT_URL}" | ||
- web |
This file contains 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 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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { Gitlab } from '@gitbeaker/node' | ||
import { gitlabToken, gitlabUrl, projectPath } from '../../../utils/env.js' | ||
import { gitlabToken, gitlabUrl, projectRootDir } from '../../../utils/env.js' | ||
|
||
export const api = new Gitlab({ token: gitlabToken, host: gitlabUrl }) | ||
|
||
let groupRootId | ||
|
||
export const getGroupRootId = async () => { | ||
if (groupRootId) return groupRootId | ||
const groupRootSearch = await api.Groups.search(projectPath.join('/')) | ||
groupRootId = (groupRootSearch.find(grp => grp.full_path === projectPath.join('/'))).id | ||
if (!groupRootId) throw Error(`Gitlab inaccessible, impossible de trouver le groupe ${projectPath}`) | ||
const groupRootSearch = await api.Groups.search(projectRootDir) | ||
groupRootId = (groupRootSearch.find(grp => grp.full_path === projectRootDir)).id | ||
if (!groupRootId) throw Error(`Gitlab inaccessible, impossible de trouver le groupe ${projectRootDir}`) | ||
return groupRootId | ||
} |
This file contains 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 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.