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