From 0f75941d12c497b04b34f2b44ea17c604894b8ce Mon Sep 17 00:00:00 2001 From: Sebastian Kunze Date: Mon, 21 Nov 2022 11:37:21 +0100 Subject: [PATCH 1/3] Push container images to GitHub instead of Google Container Registry --- .github/workflows/container-image-squid.yml | 29 +++++++++++ .../workflows/container-image-strongswan.yml | 29 +++++++++++ .github/workflows/container-image-toolbox.yml | 29 +++++++++++ .github/workflows/container-image.yml | 51 +++++++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 .github/workflows/container-image-squid.yml create mode 100644 .github/workflows/container-image-strongswan.yml create mode 100644 .github/workflows/container-image-toolbox.yml create mode 100644 .github/workflows/container-image.yml diff --git a/.github/workflows/container-image-squid.yml b/.github/workflows/container-image-squid.yml new file mode 100644 index 0000000000..7aa9e39078 --- /dev/null +++ b/.github/workflows/container-image-squid.yml @@ -0,0 +1,29 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Build and push the Squid container image" + +on: + push: + branches: + - master + paths: + - 'modules/cloud-config-container/squid/docker/**' + +jobs: + build-push-squid-container-image: + uses: ./.github/workflows/container-image.yml + with: + image_name: squid + docker_context: modules/cloud-config-container/squid/docker diff --git a/.github/workflows/container-image-strongswan.yml b/.github/workflows/container-image-strongswan.yml new file mode 100644 index 0000000000..e127ce8f77 --- /dev/null +++ b/.github/workflows/container-image-strongswan.yml @@ -0,0 +1,29 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Build and push the strongSwan container image" + +on: + push: + branches: + - master + paths: + - 'modules/cloud-config-container/onprem/docker-images/strongswan/**' + +jobs: + build-push-strongswan-container-image: + uses: ./.github/workflows/container-image.yml + with: + image_name: strongswan + docker_context: modules/cloud-config-container/onprem/docker-images/strongswan diff --git a/.github/workflows/container-image-toolbox.yml b/.github/workflows/container-image-toolbox.yml new file mode 100644 index 0000000000..90ca7b19ea --- /dev/null +++ b/.github/workflows/container-image-toolbox.yml @@ -0,0 +1,29 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Build and push the Toolbox container image" + +on: + push: + branches: + - master + paths: + - 'modules/cloud-config-container/onprem/docker-images/toolbox/**' + +jobs: + build-push-toolbox-container-image: + uses: ./.github/workflows/container-image.yml + with: + image_name: toolbox + docker_context: modules/cloud-config-container/onprem/docker-images/toolbox diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml new file mode 100644 index 0000000000..5ddfb7d0c9 --- /dev/null +++ b/.github/workflows/container-image.yml @@ -0,0 +1,51 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Build and push a generic container image" + +on: + workflow_call: + inputs: + image_name: + required: true + type: string + docker_context: + required: true + type: string + +jobs: + build-push-generic-container-image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d')" + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: ${{ inputs.docker_context }} + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:latest + ghcr.io/${{ github.repository_owner }}/${{ inputs.image_name }}:${{ steps.date.outputs.date }} From 7bac8d7867a8ccee3a0fb495014edb7363f36af1 Mon Sep 17 00:00:00 2001 From: Sebastian Kunze Date: Mon, 21 Nov 2022 15:04:47 +0100 Subject: [PATCH 2/3] Make container build manually triggerable --- .github/workflows/container-image-squid.yml | 1 + .github/workflows/container-image-strongswan.yml | 1 + .github/workflows/container-image-toolbox.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/container-image-squid.yml b/.github/workflows/container-image-squid.yml index 7aa9e39078..7cd599cb76 100644 --- a/.github/workflows/container-image-squid.yml +++ b/.github/workflows/container-image-squid.yml @@ -15,6 +15,7 @@ name: "Build and push the Squid container image" on: + workflow_dispatch: push: branches: - master diff --git a/.github/workflows/container-image-strongswan.yml b/.github/workflows/container-image-strongswan.yml index e127ce8f77..6413dec644 100644 --- a/.github/workflows/container-image-strongswan.yml +++ b/.github/workflows/container-image-strongswan.yml @@ -15,6 +15,7 @@ name: "Build and push the strongSwan container image" on: + workflow_dispatch: push: branches: - master diff --git a/.github/workflows/container-image-toolbox.yml b/.github/workflows/container-image-toolbox.yml index 90ca7b19ea..b45c554790 100644 --- a/.github/workflows/container-image-toolbox.yml +++ b/.github/workflows/container-image-toolbox.yml @@ -15,6 +15,7 @@ name: "Build and push the Toolbox container image" on: + workflow_dispatch: push: branches: - master From b8f7c605f5369966657192706953594409f0ac2f Mon Sep 17 00:00:00 2001 From: Sebastian Kunze Date: Mon, 21 Nov 2022 15:41:12 +0100 Subject: [PATCH 3/3] Prefix container images --- .github/workflows/container-image-squid.yml | 2 +- .github/workflows/container-image-strongswan.yml | 2 +- .github/workflows/container-image-toolbox.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/container-image-squid.yml b/.github/workflows/container-image-squid.yml index 7cd599cb76..f6b0050270 100644 --- a/.github/workflows/container-image-squid.yml +++ b/.github/workflows/container-image-squid.yml @@ -26,5 +26,5 @@ jobs: build-push-squid-container-image: uses: ./.github/workflows/container-image.yml with: - image_name: squid + image_name: fabric-squid docker_context: modules/cloud-config-container/squid/docker diff --git a/.github/workflows/container-image-strongswan.yml b/.github/workflows/container-image-strongswan.yml index 6413dec644..1dc5d0eaaa 100644 --- a/.github/workflows/container-image-strongswan.yml +++ b/.github/workflows/container-image-strongswan.yml @@ -26,5 +26,5 @@ jobs: build-push-strongswan-container-image: uses: ./.github/workflows/container-image.yml with: - image_name: strongswan + image_name: fabric-strongswan docker_context: modules/cloud-config-container/onprem/docker-images/strongswan diff --git a/.github/workflows/container-image-toolbox.yml b/.github/workflows/container-image-toolbox.yml index b45c554790..37870fce36 100644 --- a/.github/workflows/container-image-toolbox.yml +++ b/.github/workflows/container-image-toolbox.yml @@ -26,5 +26,5 @@ jobs: build-push-toolbox-container-image: uses: ./.github/workflows/container-image.yml with: - image_name: toolbox + image_name: fabric-toolbox docker_context: modules/cloud-config-container/onprem/docker-images/toolbox