semgrep:# A Docker image with Semgrep installed.image: semgrep/semgrep
# Run the "semgrep ci" command on the command line of the docker image.script: semgrep ci
rules:# Allow triggering a scan manually from the GitLab UI-if: $CI_PIPELINE_SOURCE == "web"
# Scan changed files in MRs, (diff-aware scanning):-if: $CI_MERGE_REQUEST_IID
# Scan mainline (default) branches and report all findings.-if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:# Connect to Semgrep AppSec Platform through your SEMGREP_APP_TOKEN.# Generate a token from Semgrep AppSec Platform > Settings# and add it as a variable in your GitLab CI/CD project settings.SEMGREP_APP_TOKEN: $SEMGREP_APP_TOKEN
こんな感じらしいです
当然ですがローカルで実行してエラーをすべて解消しないと CI してもエラーになるので注意してください
[[runners]]
name = "<name of the Runner you registered>"
[runners.docker]
privileged = true
volumes = [
"werf-cache:/home/build/.werf",
"buildah-cache:/home/build/.local/share/containers"
]
後者であれば以下のように設定します
[[runners]]
name = "<name of the Runner you registered>"
[runners.docker]
security_opt = ["seccomp:unconfined", "apparmor:unconfined"]
volumes = [
"werf-cache:/home/build/.werf",
"buildah-cache:/home/build/.local/share/containers"
]
.gitlab-ci.yml
Gitlab のコンテナレジストリはオンにしておきましょう
以下は werf を使って build and push する最低限の設定になります
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
lab 594be819ed90f0081179a4a268c6045413df7b83b21e1a225badccdd-1760658483401 9b378fddd07c About a minute ago 124MB
Error: unable to init storage manager: error get synchronization: unable to init http synchronization: unable to get client id for the http synchronization server: unable to get repo container-registry.your-gitlab-address/username-or-groupname/repo-name tags: unable to fetch tags for repo "container-registry.your-gitlab-address/username-or-groupname/repo-name": reading tags for "container-registry.your-gitlab-address/username-or-groupname/repo-name": GET https://xxx/jwt/auth?scope=repository%3Ausername-or-group%2Frepo-name%3Apull&service=container_registry: DENIED: access forbidden
Checking LDAP ...
LDAP: ... Server: ldapmain
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
DN: uid=hawk,dc=example,dc=org uid: hawk
Server: ldapsecondary
Exception: getaddrinfo: Name or service not known
Checking LDAP ... Finished
This job requires a manual action
This deployment job does not run automatically and must be started manually, but it's older than the latest deployment, and therefore can't run.
こんな感じで古いデプロイジョブは実行できなくなっています
対策その1
対象のブランチの HEAD から再度パイプラインを手動で実行してあげれば OK です
ただブランチのパイプラインなどの場合 workflow ルールで手動実行できないケースがあるのでその場合は以下の対策を試してください
対策その2
ブランチであれば一つコミットを打ち消して再度 push すれば OK です
git reset HEAD^
git add .
git commit -m "Re commit"
git push -u origin feature/branch_name
これで再度ブランチからパイプラインが作成されるのでそこからデプロイすれば OK です
最後に
古いデプロイジョブでも実行可能にするオプションがあるっぽいのでそれをオンにしても OK ですが間違って最新版以外をデプロイしまう可能性があるので注意しましょう