From a5a90f49113fba27cf53066a22d486ce901660c4 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Sat, 13 Mar 2021 15:35:18 -0700 Subject: [PATCH 1/7] [CI/CD] Docker login bugfixing --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 586a22730..9b81db480 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -181,7 +181,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry - if: ${{ github.ref == 'refs/heads/master' || needs.change_detect.outputs.force_upload }} + if: ${{ (github.ref == 'refs/heads/master') || (needs.change_detect.outputs.force_upload == true) }} uses: docker/login-action@v1 with: registry: ghcr.io From d37ae8a8c5d77bdf41f07cb4663e63d1dccfaf20 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Mon, 18 Oct 2021 11:20:14 -0600 Subject: [PATCH 2/7] Changed docker repo to github repository --- .github/workflows/build.yml | 10 +++++----- .github/workflows/docker.yml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77ccb1527..d99b23355 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }} name: ${{ matrix.config.name }} runs-on: ubuntu-18.04 - container: ghcr.io/lnis-uofu/openfpga-build-${{ matrix.config.cc}} + container: ghcr.io/${{ github.repository_owner }}/openfpga-build-${{ matrix.config.cc}} # Branch on different OS and settings strategy: fail-fast: false @@ -194,12 +194,12 @@ jobs: file: ./docker/Dockerfile.master push: ${{ github.ref == 'refs/heads/master' || needs.change_detect.outputs.force_upload }} tags: | - ghcr.io/lnis-uofu/openfpga-master:latest - ghcr.io/lnis-uofu/openfpga-master:${{ needs.change_detect.outputs.sha_short }} + ghcr.io/${{github.repository_owner}}/openfpga-master:latest + ghcr.io/${{github.repository_owner}}/openfpga-master:${{ needs.change_detect.outputs.sha_short }} linux_regression_tests: name: linux_regression_tests runs-on: ubuntu-18.04 - container: ghcr.io/lnis-uofu/openfpga-env + container: ghcr.io/${{github.repository_owner}}/openfpga-env needs: linux_build strategy: fail-fast: false @@ -248,7 +248,7 @@ jobs: if: ${{ !fromJSON(needs.change_detect.outputs.source_modified) }} name: docker_regression_tests runs-on: ubuntu-18.04 - container: ghcr.io/lnis-uofu/openfpga-master:latest + container: ghcr.io/${{github.repository_owner}}/openfpga-master:latest strategy: fail-fast: false matrix: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bfce9fc79..d51cf1120 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,14 +24,14 @@ jobs: context: . file: ./docker/Dockerfile.base push: true - tags: ghcr.io/lnis-uofu/openfpga-build-base:latest + tags: ghcr.io/${{ github.repository_owner }}/openfpga-build-base:latest - name: Build environment image uses: docker/build-push-action@v2 with: context: . file: ./docker/Dockerfile.env push: true - tags: ghcr.io/lnis-uofu/openfpga-env:latest + tags: ghcr.io/${{ github.repository_owner }}/openfpga-env:latest compiler_images: name: Build ${{ matrix.compiler }} compiler image needs: base_images @@ -65,4 +65,4 @@ jobs: context: . file: ./docker/Dockerfile.${{ matrix.compiler }} push: true - tags: ghcr.io/lnis-uofu/openfpga-build-${{ matrix.compiler }}:latest + tags: ghcr.io/${{ github.repository_owner }}/openfpga-build-${{ matrix.compiler }}:latest From fdc9e318fdc30c972e6c3e42c20dd8a5efff9ef8 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Mon, 18 Oct 2021 11:55:43 -0600 Subject: [PATCH 3/7] [CI] Addding conditional docker push --- .github/workflows/build.yml | 21 ++++++++++++++++----- .github/workflows/docker.yml | 26 +++++++++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d99b23355..69d9f8fae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,8 @@ env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release MAKEFLAGS: "-j8" + DOCKER_REPO: ${{ secrets.DOCKER_REPO }} + REPO_OWNER: ${{ github.repository_owner }} # Multiple job to tests jobs: @@ -24,6 +26,7 @@ jobs: source_modified: ${{ steps.changes.outputs.status_code == '1' }} force_upload: false sha_short: ${{ steps.changes.outputs.sha_short }} + docker_repo: ${{ steps.changes.outputs.docker_repo }} steps: - name: Checkout OpenFPGA repo uses: actions/checkout@v2 @@ -43,14 +46,22 @@ jobs: echo "Current brnach is master forcing source_modified" echo "::set-output name=status_code::1" fi + if [[ -n "${DOCKER_REPO}" ]]; then + echo "name=docker_repo::$DOCKER_REPO" + echo "::set-output name=docker_repo::$DOCKER_REPO" + else + echo "name=docker_repo::$REPO_OWNER" + echo "::set-output name=docker_repo::$REPO_OWNER" + fi echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + # Test the compilation compatibility linux_build: needs: change_detect if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }} name: ${{ matrix.config.name }} runs-on: ubuntu-18.04 - container: ghcr.io/${{ github.repository_owner }}/openfpga-build-${{ matrix.config.cc}} + container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}} # Branch on different OS and settings strategy: fail-fast: false @@ -194,12 +205,12 @@ jobs: file: ./docker/Dockerfile.master push: ${{ github.ref == 'refs/heads/master' || needs.change_detect.outputs.force_upload }} tags: | - ghcr.io/${{github.repository_owner}}/openfpga-master:latest - ghcr.io/${{github.repository_owner}}/openfpga-master:${{ needs.change_detect.outputs.sha_short }} + ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-master:latest + ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-master:${{ needs.change_detect.outputs.sha_short }} linux_regression_tests: name: linux_regression_tests runs-on: ubuntu-18.04 - container: ghcr.io/${{github.repository_owner}}/openfpga-env + container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-env needs: linux_build strategy: fail-fast: false @@ -248,7 +259,7 @@ jobs: if: ${{ !fromJSON(needs.change_detect.outputs.source_modified) }} name: docker_regression_tests runs-on: ubuntu-18.04 - container: ghcr.io/${{github.repository_owner}}/openfpga-master:latest + container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-master:latest strategy: fail-fast: false matrix: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d51cf1120..27bbf3d42 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,6 +1,12 @@ name: Build docker CI images on: - workflow_dispatch + +# Environment variables +env: + DOCKER_REPO: ${{ secrets.DOCKER_REPO }} + REPO_OWNER: ${{ github.repository_owner }} + jobs: base_images: name: Push Docker images @@ -8,6 +14,16 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Check for source code changes + id: changes + run: | + if [[ -n "${DOCKER_REPO}" ]]; then + echo "name=docker_repo::$DOCKER_REPO" + echo "::set-output name=docker_repo::$DOCKER_REPO" + else + echo "name=docker_repo::$REPO_OWNER" + echo "::set-output name=docker_repo::$REPO_OWNER" + fi - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx @@ -16,7 +32,7 @@ jobs: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ needs.change_detect.outputs.docker_repo }} password: ${{ secrets.CR_PAT }} - name: Build base uses: docker/build-push-action@v2 @@ -24,14 +40,14 @@ jobs: context: . file: ./docker/Dockerfile.base push: true - tags: ghcr.io/${{ github.repository_owner }}/openfpga-build-base:latest + tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-base:latest - name: Build environment image uses: docker/build-push-action@v2 with: context: . file: ./docker/Dockerfile.env push: true - tags: ghcr.io/${{ github.repository_owner }}/openfpga-env:latest + tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-env:latest compiler_images: name: Build ${{ matrix.compiler }} compiler image needs: base_images @@ -57,7 +73,7 @@ jobs: uses: docker/login-action@v1 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ needs.change_detect.outputs.docker_repo }} password: ${{ secrets.CR_PAT }} - name: Build ${{ matrix.compiler }} image uses: docker/build-push-action@v2 @@ -65,4 +81,4 @@ jobs: context: . file: ./docker/Dockerfile.${{ matrix.compiler }} push: true - tags: ghcr.io/${{ github.repository_owner }}/openfpga-build-${{ matrix.compiler }}:latest + tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.compiler }}:latest From 32f234f4fc012eddcfa1ff1c90b1f88f9d79ec9e Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Mon, 18 Oct 2021 12:31:08 -0600 Subject: [PATCH 4/7] Made LNIS Repo as default --- .github/workflows/build.yml | 11 ++++++----- .github/workflows/docker.yml | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69d9f8fae..3734ab726 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,8 +50,8 @@ jobs: echo "name=docker_repo::$DOCKER_REPO" echo "::set-output name=docker_repo::$DOCKER_REPO" else - echo "name=docker_repo::$REPO_OWNER" - echo "::set-output name=docker_repo::$REPO_OWNER" + echo "name=docker_repo::lnis-uofu" + echo "::set-output name=docker_repo::lnis-uofu" fi echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" @@ -190,9 +190,10 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx + if: ${{ env.DOCKER_REPO }} uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry - if: ${{ (github.ref == 'refs/heads/master') || (needs.change_detect.outputs.force_upload == true) }} + if: ${{ (github.ref == 'refs/heads/master' && (env.DOCKER_REPO)) || (needs.change_detect.outputs.force_upload == true) }} uses: docker/login-action@v1 with: registry: ghcr.io @@ -203,15 +204,15 @@ jobs: with: context: . file: ./docker/Dockerfile.master - push: ${{ github.ref == 'refs/heads/master' || needs.change_detect.outputs.force_upload }} + push: ${{ (github.ref == 'refs/heads/master' && (env.DOCKER_REPO)) || needs.change_detect.outputs.force_upload }} tags: | ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-master:latest ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-master:${{ needs.change_detect.outputs.sha_short }} linux_regression_tests: name: linux_regression_tests runs-on: ubuntu-18.04 + needs: [linux_build, change_detect] container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-env - needs: linux_build strategy: fail-fast: false matrix: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 27bbf3d42..daa82ba45 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,8 +21,8 @@ jobs: echo "name=docker_repo::$DOCKER_REPO" echo "::set-output name=docker_repo::$DOCKER_REPO" else - echo "name=docker_repo::$REPO_OWNER" - echo "::set-output name=docker_repo::$REPO_OWNER" + echo "name=docker_repo::lnis-uofu" + echo "::set-output name=docker_repo::lnis-uofu" fi - name: Set up QEMU uses: docker/setup-qemu-action@v1 From ed5942ce56abc10c89e319ec03e0e5652e55aa44 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Mon, 18 Oct 2021 14:17:30 -0600 Subject: [PATCH 5/7] Added DOCKER_REPO variable --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3734ab726..d68d2ebb4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,8 +47,8 @@ jobs: echo "::set-output name=status_code::1" fi if [[ -n "${DOCKER_REPO}" ]]; then - echo "name=docker_repo::$DOCKER_REPO" - echo "::set-output name=docker_repo::$DOCKER_REPO" + echo "name=docker_repo::$REPO_OWNER" + echo "::set-output name=docker_repo::$REPO_OWNER" else echo "name=docker_repo::lnis-uofu" echo "::set-output name=docker_repo::lnis-uofu" @@ -190,6 +190,7 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx + # Temp change remove this if: ${{ env.DOCKER_REPO }} uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry From ba7a6764290b1607fc0d0c9688842b20f1cdb86f Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Mon, 18 Oct 2021 21:42:39 -0600 Subject: [PATCH 6/7] Updated docker yml --- .github/workflows/docker.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index daa82ba45..d1cf27e40 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,6 +11,7 @@ jobs: base_images: name: Push Docker images runs-on: ubuntu-latest + if: ${{ secrets.DOCKER_REPO }} steps: - name: Checkout uses: actions/checkout@v2 @@ -18,8 +19,8 @@ jobs: id: changes run: | if [[ -n "${DOCKER_REPO}" ]]; then - echo "name=docker_repo::$DOCKER_REPO" - echo "::set-output name=docker_repo::$DOCKER_REPO" + echo "name=docker_repo::$REPO_OWNER" + echo "::set-output name=docker_repo::$REPO_OWNER" else echo "name=docker_repo::lnis-uofu" echo "::set-output name=docker_repo::lnis-uofu" From de539432081125cd108130e070e8b017f444cd39 Mon Sep 17 00:00:00 2001 From: Ganesh Gore Date: Mon, 18 Oct 2021 21:43:05 -0600 Subject: [PATCH 7/7] Removed dummy changes --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d68d2ebb4..dcb4ac4cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,8 +190,6 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx - # Temp change remove this - if: ${{ env.DOCKER_REPO }} uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry if: ${{ (github.ref == 'refs/heads/master' && (env.DOCKER_REPO)) || (needs.change_detect.outputs.force_upload == true) }}