Skip to content
Snippets Groups Projects
Commit bc8989b4 authored by Sébastien Heurtematte's avatar Sébastien Heurtematte :speech_balloon:
Browse files

ci: publish eddie-docker

Related to #19



Signed-off-by: Sébastien Heurtematte's avatarsebastien.heurtematte <sebastien.heurtematte@eclipse-foundation.org>
parent 10075547
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,86 @@ include:
dco:
extends: .dco
.build-with-buildkit:
stage: build
image:
name: eclipsefdn/containertools
entrypoint: [""]
variables:
SERVICE_ADDRESS: "tcp://buildkitd.foundation-internal-infra-buildkitd:1234"
script:
- test -n "$CI_REGISTRY" || (
echo "CI_REGISTRY not provided. Docker registry deployment can not continue."
&& exit 1 )
- test -n "$CI_REGISTRY_IMAGE" || (
echo "CI_REGISTRY_IMAGE not provided. Docker registry deployment can not continue."
&& exit 1 )
- test -n "$CI_REGISTRY_USER" || (
echo "CI_REGISTRY_USER not provided. Docker registry deployment can not continue."
&& exit 1 )
- test -n "$CI_REGISTRY_PASSWORD" || (
echo "CI_REGISTRY_PASSWORD not provided. Docker registry deployment can not continue."
&& exit 1 )
- |
set -xe
export HOME=$CI_PROJECT_DIR
crane auth login "$CI_REGISTRY" --username "$CI_REGISTRY_USER" --password "$CI_REGISTRY_PASSWORD"
BUILD_DATE="$(date '+%FT%T%z' | sed -E -n 's/(\+[0-9]{2})([0-9]{2})$/\1:\2/p')" #rfc 3339 date
BUILD_TITLE=$(echo "$CI_PROJECT_TITLE" | tr " " "_")
IMAGE_ANNOTATIONS="annotation.build-date=$BUILD_DATE,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.cijoburl=$CI_JOB_URL,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.commiturl=$CI_PROJECT_URL/commit/$CI_COMMIT_SHA,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.email=$GITLAB_USER_EMAIL,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.mrurl=$CI_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_ID,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.pipelineurl=$CI_PIPELINE_URL,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.tagorbranch=$CI_COMMIT_REF_NAME,"
IMAGE_ANNOTATIONS+="annotation.com.gitlab.ci.user=$CI_SERVER_URL/$GITLAB_USER_LOGIN,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.authors=$CI_SERVER_URL/$GITLAB_USER_LOGIN,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.created=$BUILD_DATE,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.description=$BUILD_TITLE,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.documentation=$CI_PROJECT_URL,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.licenses=$CI_PROJECT_URL,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.ref.name=$CI_REGISTRY:$CI_COMMIT_REF_NAME,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.revision=$CI_COMMIT_SHA,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.source=$CI_PROJECT_URL,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.title=$BUILD_TITLE,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.url=$CI_PROJECT_URL,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.vendor=$CI_SERVER_URL/$GITLAB_USER_LOGIN,"
IMAGE_ANNOTATIONS+="annotation.org.opencontainers.image.version=$CI_COMMIT_TAG,"
IMAGE_ANNOTATIONS+="annotation.vcs-url=$CI_PROJECT_URL"
echo "Building and shipping image to $CI_REGISTRY"
OUTPUT="$CONTAINER_NAME.tar"
buildctl --addr="$SERVICE_ADDRESS" \
build \
--progress=plain \
--frontend=dockerfile.v0 \
--local context="$CI_PROJECT_DIR/.ci" \
--local dockerfile="$CI_PROJECT_DIR/.ci" \
--output "type=oci,$IMAGE_ANNOTATIONS,dest=$OUTPUT"
crane push "$OUTPUT" "$CI_REGISTRY_IMAGE/$CONTAINER_NAME"
crane tag "$CI_REGISTRY_IMAGE/$CONTAINER_NAME" "latest"
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- .ci/*
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
changes:
- .ci/*
build-bitbake-builder:
extends: .build-with-buildkit
variables:
CONTAINER_NAME: eddie
build:
image: docker.io/onirocore/eddie:latest
stage: build
image: francescopham/eddie-docker:latest
needs:
- job: build-bitbake-builder
optional: true
script:
- mkdir build && cd build
- cmake .. && make
......@@ -39,7 +116,7 @@ eddie-zephyr:
test:
stage: test
image: francescopham/eddie-docker:latest
image: docker.io/onirocore/eddie:latest
variables:
CFLAGS: "--coverage"
CXXFLAGS: "--coverage"
......@@ -53,7 +130,7 @@ test:
docs_deploy:
stage: deploy
image: francescopham/eddie-docker:latest
image: docker.io/onirocore/eddie:latest
allow_failure: true
rules:
- if: '$CI_COMMIT_REF_PROTECTED == "true"'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment