From f3bca75eeb461fbdfc4e3a99bf0b1bf1502893c1 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:06:59 -0600 Subject: [PATCH 1/9] ci updates --- .github/workflows/build_test.yml | 26 +++++++++----------------- .github/workflows/publish_latest.yml | 14 +++++++------- .github/workflows/publish_release.yml | 14 ++++++++------ 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 8ba384af6..7a1f53098 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -19,9 +19,6 @@ on: jobs: build-and-test: runs-on: ubuntu-latest - permissions: - contents: read - packages: write strategy: fail-fast: false @@ -39,18 +36,16 @@ jobs: stable, ] + registry: + image: registry:2 + ports: + - 5000:5000 + steps: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout Cycamore uses: actions/checkout@v4 @@ -60,9 +55,8 @@ jobs: uses: docker/build-push-action@v5 with: file: docker/Dockerfile - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max - tags: ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache + tags: localhost:5000/cycamore:local push: true build-args: | pkg_mgr=${{ matrix.pkg_mgr }} @@ -84,14 +78,12 @@ jobs: with: context: ${{ github.workspace }}/cymetric file: ${{ github.workspace }}/cymetric/docker/Dockerfile - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max + cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} - cycamore_tag=ci-image-cache build-contexts: | - ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache=docker-image://ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache@${{ steps.build-cycamore.outputs.digest }} + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore=docker-image://localhost:5000/cycamore:local - name: Export Environment Variables if: github.event_name == 'pull_request' diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml index 5512371fe..5e6eb44ff 100644 --- a/.github/workflows/publish_latest.yml +++ b/.github/workflows/publish_latest.yml @@ -49,18 +49,18 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Test Cycamore id: build-cycamore uses: docker/build-push-action@v5 with: - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max file: docker/Dockerfile push: true - tags: ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.tag }} + tags: ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.tag }} build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} @@ -78,9 +78,9 @@ jobs: with: context: ${{ github.workspace }}/cymetric file: ${{ github.workspace }}/cymetric/docker/Dockerfile - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max - tags: ghcr.io/${{ github.repository_owner }}/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.tag }} + cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max + tags: ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.tag }} push: true build-args: | pkg_mgr=${{ matrix.pkg_mgr }} diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 2987e3456..aedb83bc7 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -1,6 +1,9 @@ name: Publish Stable Cycamore on: + pull_request: + paths: + - '.github/workflows/publish_release.yml' release: types: [released] @@ -31,7 +34,7 @@ jobs: echo "stable_tag=ci-image-cache" >> "$GITHUB_ENV" - name: Tag as stable - if: ${{ github.repository_owner == 'cyclus' }} + if: ${{ github.repository_owner == 'cyclus' && github.event_name == 'release' }} run: | echo "version_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV" echo "stable_tag=stable" >> "$GITHUB_ENV" @@ -40,7 +43,7 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up Docker Buildx @@ -52,13 +55,12 @@ jobs: - name: Build, Test, and Push Cycamore uses: docker/build-push-action@v5 with: - cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache - cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache file: docker/Dockerfile push: true tags: | - ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.version_tag }} - ghcr.io/${{ github.repository_owner }}/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.stable_tag }} + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.version_tag }} + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.stable_tag }} build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} From e2356b98467899081361e6532714d4f1d822112a Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:08:23 -0600 Subject: [PATCH 2/9] forgot services --- .github/workflows/build_test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 7a1f53098..8efdf7535 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -36,10 +36,11 @@ jobs: stable, ] - registry: - image: registry:2 - ports: - - 5000:5000 + services: + registry: + image: registry:2 + ports: + - 5000:5000 steps: From c431b7d9cb5e99542f82cb85f36496f32afca956 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:10:20 -0600 Subject: [PATCH 3/9] change defualt cyclus_tag to latest --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8682a7c59..fb08841ad 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ ARG pkg_mgr=apt ARG ubuntu_version=22.04 -ARG cyclus_tag=stable +ARG cyclus_tag=latest FROM ghcr.io/cyclus/cyclus_${ubuntu_version}_${pkg_mgr}/cyclus:${cyclus_tag} as cycamore ARG make_cores=2 From 79f3bd4e86b4bd066e0375b9e33fe69dc03e9078 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:12:37 -0600 Subject: [PATCH 4/9] update CHANGELOG --- CHANGELOG.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8f64868cf..ae94b0ce9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,9 +5,9 @@ cycamore Change Log .. current developments **Added:** -* Downstream testing in CI workflows (#573, #580, #582) -* GitHub workflow for publishing images on release (#573, #582) -* GitHub workflows for building/testing on a PR and push to `main` (#549, #564, #573, #582) +* Downstream testing in CI workflows (#573, #580, #582, #583) +* GitHub workflow for publishing images on release (#573, #582, #583) +* GitHub workflows for building/testing on a PR and push to `main` (#549, #564, #573, #582, #583) * Add functionality for random behavior on the size (#550) and frequency (#565) of a sink * GitHub workflow to check that the CHANGELOG has been updated (#562) * Added inventory policies to Storage through the material buy policy (#574) From 7250e6674e54680d87640d83d447b8b6357fcfa7 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:16:45 -0600 Subject: [PATCH 5/9] reference ci-updates branch for now --- .github/workflows/build_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 8efdf7535..6e739afc0 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -69,6 +69,7 @@ jobs: uses: actions/checkout@v4 with: repository: cyclus/cymetric + ref: ci-updates path: ${{ github.workspace }}/cymetric - name: Build and Test Cymetric From dc156bb6f4f17eb073d5ad37a201471ea1485983 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:20:31 -0600 Subject: [PATCH 6/9] setup buildx correctly : --- .github/workflows/publish_latest.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml index 5e6eb44ff..d3e4ee105 100644 --- a/.github/workflows/publish_latest.yml +++ b/.github/workflows/publish_latest.yml @@ -44,6 +44,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host - name: Log in to the Container registry uses: docker/login-action@v3 From ac59ee88f339c543a4a7d90bb3071dceb1089514 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:25:07 -0600 Subject: [PATCH 7/9] reorder for clarity --- .github/workflows/build_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 6e739afc0..29734280e 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -80,12 +80,12 @@ jobs: with: context: ${{ github.workspace }}/cymetric file: ${{ github.workspace }}/cymetric/docker/Dockerfile + build-contexts: | + ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore=docker-image://localhost:5000/cycamore:local cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache build-args: | pkg_mgr=${{ matrix.pkg_mgr }} ubuntu_version=${{ matrix.ubuntu_versions }} - build-contexts: | - ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore=docker-image://localhost:5000/cycamore:local - name: Export Environment Variables if: github.event_name == 'pull_request' From 83907dd51108fdd13a61d2f3dbb904a46a580098 Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:31:28 -0600 Subject: [PATCH 8/9] use network settings on correct workflow --- .github/workflows/build_test.yml | 2 ++ .github/workflows/publish_latest.yml | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 29734280e..2ef1b4a59 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -46,6 +46,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + driver-opts: network=host - name: Checkout Cycamore uses: actions/checkout@v4 diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml index d3e4ee105..5e6eb44ff 100644 --- a/.github/workflows/publish_latest.yml +++ b/.github/workflows/publish_latest.yml @@ -44,8 +44,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - name: Log in to the Container registry uses: docker/login-action@v3 From 340441290c9b9e766d9e2227383d2e135a4a21ee Mon Sep 17 00:00:00 2001 From: bennibbelink <79653949+bennibbelink@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:08:49 -0600 Subject: [PATCH 9/9] remove checkout ref --- .github/workflows/build_test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 2ef1b4a59..8d62f4bcb 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -71,7 +71,6 @@ jobs: uses: actions/checkout@v4 with: repository: cyclus/cymetric - ref: ci-updates path: ${{ github.workspace }}/cymetric - name: Build and Test Cymetric