Skip to content

Commit

Permalink
CI: Push docker image to GHCR
Browse files Browse the repository at this point in the history
Signed-off-by: Anil Belur <[email protected]>
  • Loading branch information
askb committed Sep 14, 2023
1 parent afa448d commit f09456a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 10 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Run Docker Image
name: Build Ubuntu/CentOS Docker Image and Push them to Docker registry

on:
push:
Expand All @@ -12,6 +12,8 @@ on:
type: string
default: ubuntu

env:
DOCKER_REGISTRY: "ghcr.io"

jobs:
builder-docker-image:
Expand All @@ -21,7 +23,7 @@ jobs:
uses: actions/checkout@v3

- name: Build Ubuntu Docker image
run: docker build -t ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }} builder/${{ vars.OS_FLAVOR }}
run: docker build -t ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }} builder/${{ inputs.OS_FLAVOR }}

- name: Clone and test repo
run: |
Expand All @@ -38,6 +40,18 @@ jobs:
- name: Push Docker image
run: docker push ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }}

- name: Authenticate and push GHCR
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the hello-docker Docker image
run: |
docker build . --tag ${{ env.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }}:latest
docker run ${{ env.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }}:latest
docker push ${{ env.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }}:latest
Build-And-Test-Robot-Docker-Image:
runs-on: ubuntu-latest
services:
Expand Down Expand Up @@ -68,6 +82,7 @@ jobs:
--variable ODL_SYSTEM_IP:opendaylight \
--variable ODL_SYSTEM_USER:centos \
./restconf_modules.robot'
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
Expand All @@ -76,3 +91,15 @@ jobs:

- name: Push Docker image
run: docker push ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ROBOT_BASE_IMAGE_NAME }}

- name: Authenticate and push GHCR
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the hello-docker Docker image
run: |
docker build . --tag ${{ env.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }}/${{ vars.ROBOT_BASE_IMAGE_NAME }}:latest
docker run ${{ env.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }}/${{ vars.ROBOT_BASE_IMAGE_NAME }}:latest
docker push ${{ env.DOCKER_REGISTRY }}/${{ vars.DOCKER_REPOSITORY }}/${{ vars.ROBOT_BASE_IMAGE_NAME }}:latest
9 changes: 5 additions & 4 deletions .github/workflows/csit-1-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: CSIT-1-Node-Test

on:
push:
# Trigger the workflow on a push event
branches:
- main

jobs:
csit:
Expand Down Expand Up @@ -74,11 +75,11 @@ jobs:
elif [ "${{ matrix.test_suite }}" == "distribution" ]; then
robot_test_file="karaf_sequence_install.robot karaf_stop.robot size.robot"
elif [ "${{ matrix.test_suite }}" == "aaa" ]; then
robot_test_file="authn"
robot_test_file="authn"
fi
# Run robot tests in the appropriate directory
docker exec robot bash -c "git clone https://github.com/opendaylight/integration-test.git &&
cd integration-test/csit/suites/${test_suite} &&
docker exec robot bash -c "git clone https://github.com/opendaylight/integration-test.git &&
cd integration-test/csit/suites/${test_suite} &&
robot -L debug --variable USER_HOME:/root \
--variable WORKSPACE:/home/youruser \
-v BUNDLEFOLDER:karaf-0.18.1 \
Expand Down
4 changes: 2 additions & 2 deletions builder/centos/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN yum install -y java-17-openjdk java-17-openjdk-devel
# Download and install Maven 3.8
RUN wget -q https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz && \
tar -xf apache-maven-3.8.8-bin.tar.gz -C /opt && \
rm apache-maven-3.8.8-bin.tar.gz
rm apache-maven-3.8.8-bin.tar.gz

# Set environment variables
ENV MAVEN_HOME=/opt/apache-maven-3.8.8
Expand All @@ -30,4 +30,4 @@ RUN java -version && \
# Add Maven settings.xml file
RUN mkdir -p /root/.m2 \
&& wget -q -O /tmp/settings.xml https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml \
&& mv /tmp/settings.xml /root/.m2/settings.xml
&& mv /tmp/settings.xml /root/.m2/settings.xml
4 changes: 2 additions & 2 deletions builder/ubuntu/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get install openjdk-17-jdk openjdk-17-jre -y
# Download and install Maven 3.8
RUN wget -q https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz && \
tar -xf apache-maven-3.8.8-bin.tar.gz -C /opt && \
rm apache-maven-3.8.8-bin.tar.gz
rm apache-maven-3.8.8-bin.tar.gz

# Set environment variables
ENV MAVEN_HOME=/opt/apache-maven-3.8.8
Expand All @@ -25,4 +25,4 @@ RUN java -version && \
# Add Maven settings.xml file
RUN mkdir -p /root/.m2 \
&& wget -q -O /tmp/settings.xml https://raw.githubusercontent.com/opendaylight/odlparent/master/settings.xml \
&& mv /tmp/settings.xml /root/.m2/settings.xml
&& mv /tmp/settings.xml /root/.m2/settings.xml

0 comments on commit f09456a

Please sign in to comment.