Newer
Older
- dev_pulling_repo
- dev_secrets_in_repo
- dev_linting_code
- dev_linting_docker
variables:
GITLAB_API: "https://labs.etsi.org/api/v4"
CI_JOB_TOKEN: $CI_JOB_TOKEN
CI_REGISTRY_USER: $CI_REGISTRY_USER
CI_REGISTRY_PASSWORD: $CI_REGISTRY_PASSWORD
CI_REGISTRY: $CI_REGISTRY
#dev_pulling_repo:
# stage: dev_pulling_repo
# script:
# - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git
# <<: *dev_common
- |
pip install trufflehog
trufflehog capif --exclude_paths capif/cicd/exclusions --max_depth=5
# needs: ["dev_pulling_repo"]
# define the process to do linting code: Sonarque, ruff?
- |
echo "###ruff checks###"
pip install ruff
# Download hadolint binary
wget https://github.com/hadolint/hadolint/releases/download/v2.8.0/hadolint-Linux-x86_64 -O hadolint
# Make it executable
chmod +x hadolint
# Move it to your binaries folder
#find . -name 'services/Dockerfile*' -exec hadolint --no-fail -f gitlab_codeclimate {} + > docker-lint.json
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
96
97
98
99
100
101
102
103
104
../hadolint services/vault/Dockerfile || true
echo "### nginx ###"
../hadolint services/nginx/Dockerfile || true
echo "### register ###"
../hadolint services/register/Dockerfile || true
echo "### TS29222_CAPIF_Access_Control_Policy_API ###"
../hadolint services/TS29222_CAPIF_Access_Control_Policy_API/Dockerfile || true
echo "### TS29222_CAPIF_API_Invoker_Management_API ###"
../hadolint services/TS29222_CAPIF_API_Invoker_Management_API/Dockerfile || true
echo "### TS29222_CAPIF_API_Provider_Management_API ###"
../hadolint services/TS29222_CAPIF_API_Provider_Management_API/Dockerfile || true
echo "### TS29222_CAPIF_Auditing_API ###"
../hadolint services/TS29222_CAPIF_Auditing_API/Dockerfile || true
echo "### TS29222_CAPIF_Discover_Service_API ###"
../hadolint services/TS29222_CAPIF_Discover_Service_API/Dockerfile || true
echo "### TS29222_CAPIF_Events_API ###"
../hadolint services/TS29222_CAPIF_Events_API/Dockerfile || true
echo "### TS29222_CAPIF_Logging_API_Invocation_API ###"
../hadolint services/TS29222_CAPIF_Logging_API_Invocation_API/Dockerfile || true
echo "### TS29222_CAPIF_Publish_Service_API ###"
../hadolint services/TS29222_CAPIF_Publish_Service_API/Dockerfile || true
echo "### TS29222_CAPIF_Routing_Info_API ###"
../hadolint services/TS29222_CAPIF_Routing_Info_API/Dockerfile || true
echo "### TS29222_CAPIF_Security_API ###"
../hadolint services/TS29222_CAPIF_Security_API/Dockerfile || true
# artifacts:
# name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
# when: always
# reports:
# codequality:
# - docker-lint.json
# interruptible: true
# NOT WORKING: failed when docker login. seem we need to use docker-in-docker rather than
# shell alpine runners
image: docker:19.03.12-dind
#services:
# - docker:19.03.12-dind
- docker login --username $CI_REGISTRY_USER --password $CAPIF_DOCKER_REGISTRY $CI_REGISTRY
- docker build -t CI_REGISTRY/ocf/capif/capif-client:$CI_COMMIT_REF_SLUG .
- docker logout $CI_REGISTRY
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
## NOT WORKING: failed when build de images - failed to mount overlay: operation not permitted" storage-driver=overlay2
#docker_login:
# stage: docker_login
# script:
# - |
# #!/bin/bash
#
# # Update your existing list of packages
# apk update
#
# # Install Docker
# apk add docker
#
# # Start the Docker service
# dockerd &
#
# # Verify the installation
# docker --version
#
# echo "### docker login ###"
# docker login --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD $CI_REGISTRY
#
# echo "### build & push capif-client ###"
# cd services/capif-client/ && docker build -t capif-client:$CI_COMMIT_REF_SLUG .
#
# docker push capif-client:$CI_COMMIT_REF_SLUG