Skip to content
Snippets Groups Projects
Commit 3d554a89 authored by Lukasz Dorau's avatar Lukasz Dorau
Browse files

common: migrate from Docker Hub to GitHub Container Registry

parent b7b770a8
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,9 @@ on:
env:
GITHUB_REPO: pmem/pmdk
DOCKER_REPO: pmem/pmdk
DOCKER_REPO: ghcr.io/pmem/pmdk
GH_CR_USER: ${{ secrets.GH_CR_USER }}
GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
HOST_WORKDIR: /home/runner/work/pmdk/pmdk
......
......@@ -4,15 +4,15 @@ on: [push, pull_request]
env:
GITHUB_REPO: pmem/pmdk
DOCKER_REPO: pmem/pmdk
DOCKER_REPO: ghcr.io/pmem/pmdk
GH_CR_USER: ${{ secrets.GH_CR_USER }}
GH_CR_PAT: ${{ secrets.GH_CR_PAT }}
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
DOC_UPDATE_GITHUB_TOKEN: ${{ secrets.DOC_UPDATE_GITHUB_TOKEN }}
HOST_WORKDIR: /home/runner/work/pmdk/pmdk
WORKDIR: utils/docker
......
......@@ -11,7 +11,7 @@ services:
env:
global:
- GITHUB_REPO=pmem/pmdk
- DOCKER_REPO=pmem/pmdk
- DOCKER_REPO=ghcr.io/pmem/pmdk
- OS=ubuntu
- OS_VER=19.10
- MAKE_PKG=0
......
......@@ -15,5 +15,5 @@ subdirectory and then do git-rebase before pushing your commits to the
repository, make sure that you do not squash the commit which is the head in
your repository. This will let Travis and GitHub Actions CIs recreate
Docker images used during the build before the build. Otherwise the not-updated
Docker image will be pulled from the Docker Hub and used during the build on
Travis and GitHub Actions CIs.
Docker image will be pulled from GitHub Container Registry and used during
the build on Travis and GitHub Actions CIs.
......@@ -34,7 +34,7 @@ export PMDK_CC=${PMDK_CC:-gcc}
export PMDK_CXX=${PMDK_CXX:-g++}
export EXPERIMENTAL=${EXPERIMENTAL:-n}
export VALGRIND=${VALGRIND:-1}
export DOCKER_REPO=${DOCKER_REPO:-pmem/pmdk}
export DOCKER_REPO=${DOCKER_REPO:-ghcr.io/pmem/pmdk}
export GITHUB_REPO=${GITHUB_REPO:-pmem/pmdk}
if [[ -z "$OS" || -z "$OS_VER" ]]; then
......
......@@ -3,11 +3,11 @@
# Copyright 2016-2020, Intel Corporation
#
# push-image.sh - pushes the Docker image to the Docker Hub.
# push-image.sh - pushes the Docker image to GitHub Container Registry.
#
# The script utilizes $DOCKERHUB_USER and $DOCKERHUB_PASSWORD variables
# to log in to Docker Hub. The variables can be set in the Travis project's
# configuration for automated builds.
# The script utilizes $GH_CR_USER and $GH_CR_PAT variables
# to log in to GitHub Container Registry. The variables can be set
# in the Travis project's configuration for automated builds.
#
set -e
......@@ -44,8 +44,8 @@ then
exit 1
fi
# Log in to the Docker Hub
docker login -u="$DOCKERHUB_USER" -p="$DOCKERHUB_PASSWORD"
# Log in to GitHub Container Registry
docker login https://ghcr.io -u="$GH_CR_USER" -p="$GH_CR_PAT"
# Push the image to the repository
# Push the image to GitHub Container Registry
docker push ${DOCKER_REPO}:${TAG}
......@@ -12,11 +12,11 @@
#
# If the Travis build is not of the "pull_request" type (i.e. in case of
# merge after pull_request) and it succeed, the Docker image should be pushed
# to the Docker Hub repository. An empty file is created to signal that to
# further scripts.
# to GitHub Container Registry repository. An empty file is created to signal
# that to further scripts.
#
# If the Docker image does not have to be rebuilt, it will be pulled from
# Docker Hub.
# GitHub Container Registry.
#
set -e
......@@ -82,7 +82,7 @@ for file in $files; do
./build-image.sh ${OS}-${OS_VER} ${CI_CPU_ARCH}
popd
# Check if the image has to be pushed to Docker Hub
# Check if the image has to be pushed to GitHub Container Registry
# (i.e. the build is triggered by commits to the $GITHUB_REPO
# repository's stable-* or master branch, and the Travis build is not
# of the "pull_request" type). In that case, create the empty
......@@ -92,10 +92,10 @@ for file in $files; do
&& $CI_EVENT_TYPE != "pull_request" \
&& $PUSH_IMAGE == "1" ]]
then
echo "The image will be pushed to Docker Hub"
echo "The image will be pushed to GitHub Container Registry"
touch $CI_FILE_PUSH_IMAGE_TO_REPO
else
echo "Skip pushing the image to Docker Hub"
echo "Skip pushing the image to GitHub Container Registry"
fi
if [[ $PUSH_IMAGE == "1" ]]
......@@ -108,5 +108,10 @@ for file in $files; do
done
# Getting here means rebuilding the Docker image is not required.
# Pull the image from Docker Hub.
# The image will be pulled from GitHub Container Registry.
# Log in to GitHub Container Registry
docker login https://ghcr.io -u="$GH_CR_USER" -p="$GH_CR_PAT"
# Pull the image from GitHub Container Registry.
docker pull ${DOCKER_REPO}:1.10-${OS}-${OS_VER}-${CI_CPU_ARCH}
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