-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
95 lines (86 loc) · 2.67 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Jobs defined here use the idp/ci docker image from ECR by default.
# Images are built via the identity-devops GitLab pipeline.
variables:
BUNDLER_VERSION: "2.3.13"
ECR_REGISTRY: '${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com'
CI_SHA: 'sha256:32de10e332d04c3ce77e9352c50dafe8f02db91d3f9bd3072a76c4117b1ea8c4'
default:
image: '${ECR_REGISTRY}/identity_fakeserver/ci@${CI_SHA}'
.bundle_install: &bundle_install
- gem install bundler --version $BUNDLER_VERSION
- bundle check || bundle install --retry=3 --path vendor/bundle
.build_cache:
- &ruby_cache
key:
files:
- Gemfile.lock
paths:
- vendor/bundle
policy: pull
stages:
- .pre
- test
- deploy
install_dependencies:
stage: .pre
variables:
cache:
- <<: *ruby_cache
policy: pull-push
script:
- *bundle_install
test_release:
stage: test
needs:
- job: install_dependencies
cache:
- <<: *ruby_cache
script:
- *bundle_install
- make test
build-ci-image:
stage: .pre
interruptible: true
needs: []
tags:
- build-pool
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: ['']
rules:
# Build when there are changes to the Dockerfile
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "web"'
changes:
compare_to: 'refs/heads/main'
paths:
- dockerfiles/ci.Dockerfile
script:
- mkdir -p /kaniko/.docker
- |-
KANIKOCFG="\"credsStore\":\"ecr-login\""
if [ "x${http_proxy}" != "x" -o "x${https_proxy}" != "x" ]; then
KANIKOCFG="${KANIKOCFG}, \"proxies\": { \"default\": { \"httpProxy\": \"${http_proxy}\", \"httpsProxy\": \"${https_proxy}\", \"noProxy\": \"${no_proxy}\"}}"
fi
KANIKOCFG="{ ${KANIKOCFG} }"
echo "${KANIKOCFG}" > /kaniko/.docker/config.json
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/dockerfiles/ci.Dockerfile"
--destination "${ECR_REGISTRY}/identity_fakeserver/ci:latest"
--destination "${ECR_REGISTRY}/identity_fakeserver/ci:${CI_COMMIT_SHA}"
--build-arg "http_proxy=${http_proxy}" --build-arg "https_proxy=${https_proxy}" --build-arg "no_proxy=${no_proxy}"
deploy_to_cloudgov:
only:
- main
stage: deploy
script:
- *bundle_install
- bundle exec rake login:deploy_json
- bundle config set cache_all true
- bundle package
- cf8 login -a https://api.fr.cloud.gov -u "e1fdd211-f191-40e8-99c7-4e7164d9ae76" -p $CF8_PASS -o "gsa-login-prototyping" -s "$SPACE"
- cf8 push identity-fake-server -b ruby_buildpack -s cflinuxfs4
parallel:
matrix:
- SPACE: [pt]