diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d40be41..82049f0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,5 @@ -name: Build and Run Docker Image +--- +name: Build Ubuntu/CentOS Docker Image and Push them to Docker registry on: push: @@ -8,10 +9,12 @@ on: inputs: OS_FLAVOR: description: "Linux Flavor" - required: false + required: true type: string default: ubuntu +env: + DOCKER_REGISTRY: "ghcr.io" jobs: builder-docker-image: @@ -21,11 +24,12 @@ 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 }} + # yamllint disable-line rule:line-length + run: docker build -t ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }} builder/ubuntu - name: Clone and test repo - run: | - docker run ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }} \ + # yamllint disable-line rule:line-length + run: docker run ${{ vars.DOCKER_REPOSITORY }}/${{ vars.ODL_BASE_IMAGE_NAME }} \ bash -c 'git clone "https://git.opendaylight.org/gerrit/integration/distribution" && \ cd /distribution && mvn clean install' @@ -36,8 +40,23 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Push Docker image + # yamllint disable-line rule:line-length 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 + # yamllint disable-line rule:line-length + 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: @@ -68,6 +87,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: @@ -76,3 +96,16 @@ 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 diff --git a/.github/workflows/csit-1-node.yaml b/.github/workflows/csit-1-node.yaml index d001c0f..c9902e8 100644 --- a/.github/workflows/csit-1-node.yaml +++ b/.github/workflows/csit-1-node.yaml @@ -1,8 +1,10 @@ +--- name: CSIT-1-Node-Test on: push: - # Trigger the workflow on a push event + branches: + - main jobs: csit: @@ -74,11 +76,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 \ diff --git a/.github/workflows/maven-build.yaml b/.github/workflows/maven-build.yaml index 14df242..ae42629 100644 --- a/.github/workflows/maven-build.yaml +++ b/.github/workflows/maven-build.yaml @@ -1,3 +1,4 @@ +--- name: Build and Run Docker Image on: diff --git a/builder/centos/dockerfile b/builder/centos/dockerfile index aba34c3..eb0a346 100644 --- a/builder/centos/dockerfile +++ b/builder/centos/dockerfile @@ -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 @@ -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 \ No newline at end of file + && mv /tmp/settings.xml /root/.m2/settings.xml diff --git a/builder/ubuntu/dockerfile b/builder/ubuntu/dockerfile index 47995f1..9d170b5 100644 --- a/builder/ubuntu/dockerfile +++ b/builder/ubuntu/dockerfile @@ -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 @@ -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 \ No newline at end of file + && mv /tmp/settings.xml /root/.m2/settings.xml