diff --git a/.github/workflows/docker_images_template.yaml b/.github/workflows/docker_images_template.yaml new file mode 100644 index 0000000000..315cf48ca4 --- /dev/null +++ b/.github/workflows/docker_images_template.yaml @@ -0,0 +1,46 @@ +# Reusable workflow to setup a specific WMCore component for pip + +on: + workflow_call: + inputs: + wmcore_component: + required: true + type: string + +jobs: + build_images_from_template: + runs-on: ubuntu-latest + steps: + - name: Get the Ref + id: get-ref + uses: ankitvgupta/ref-to-tag-action@master + with: + ref: ${{ github.ref }} + head_ref: ${{ github.head_ref }} + + - name: Build image + run: | + curl -ksLO https://raw.githubusercontent.com/dmwm/CMSKubernetes/master/docker/pypi/${{inputs.wmcore_component}}/Dockerfile + sed -i -e "s,ENV TAG=.*,ENV TAG=${{steps.get-ref.outputs.tag}},g" Dockerfile + cat Dockerfile + docker build --tag registry.cern.ch/cmsweb/${{inputs.wmcore_component}}:${{steps.get-ref.outputs.tag}} . + + - name: Images + run: | + docker images + + - name: Login to registry.cern.ch + uses: docker/login-action@v2 + with: + registry: registry.cern.ch + username: ${{ secrets.CERN_LOGIN }} + password: ${{ secrets.CERN_TOKEN }} + + - name: Publish image to registry.cern.ch + uses: docker/build-push-action@v1 + with: + registry: registry.cern.ch + username: ${{ secrets.CERN_LOGIN }} + password: ${{ secrets.CERN_TOKEN }} + repository: cmsweb/${{inputs.wmcore_component}} + tag_with_ref: true diff --git a/.github/workflows/pypi_build_and_images.yaml b/.github/workflows/pypi_build_and_images.yaml new file mode 100644 index 0000000000..f929e82f5e --- /dev/null +++ b/.github/workflows/pypi_build_and_images.yaml @@ -0,0 +1,51 @@ +# This workflow will build and upload WMCore core services to the production PyPI +# based on tag releases, see build_and_publish_services job. Then, the second +# named build_images, will build appropriate docker images using CMSKubernetes +# Dockefiles and upload them to CERN registry. +# +# The build_and_publish_services job relies on pypi_build_template.yaml +# The build_images relies on docker_images_template.yaml template +# Each job use matrics target (as input list to iterate) and setup +# wmcore_component which is used by corresponding template to perform +# set of actions. We also define here necessary secrets used by given template. + +on: + # this section fires workflow on a specific tag which matches some pattern + push: + tags: + - '*.*.*' + # this section forces manual builds + workflow_dispatch: + inputs: + name: + description: 'WMCore services' + +jobs: + # first job performs build and upload of packages to PyPI + build_and_publish_services: + name: Build_and_upload_to_pypi + strategy: + matrix: + target: [wmagent, wmagent-devtools, wmcore, reqmon, reqmgr2, global-workqueue, acdcserver, reqmgr2ms-unmerged, + reqmgr2ms-output, reqmgr2ms-rulecleaner, reqmgr2ms-transferor, reqmgr2ms-monitor] + uses: ./.github/workflows/pypi_build_publish_template.yaml + with: + wmcore_component: ${{ matrix.target }} + secrets: + pypy_token: ${{ secrets.PYPY_PRODUCTION }} + + # second job, depends on build_and_publish_services, builds and upload + # docker images to CERN registry + build_images: + name: Build_images + needs: [build_and_publish_services] + strategy: + matrix: + target: [wmagent, reqmon, reqmgr2, reqmgr2ms-unmerged, global-workqueue, + reqmgr2ms-output, reqmgr2ms-rulecleaner, reqmgr2ms-transferor, reqmgr2ms-monitor] + uses: ./.github/workflows/docker_images_template.yaml + with: + wmcore_component: ${{ matrix.target }} + secrets: + CERN_LOGIN: ${{ secrets.CERN_LOGIN }} + CERN_TOKEN: ${{ secrets.CERN_TOKEN }} diff --git a/.github/workflows/pypy_build_publish_template.yaml b/.github/workflows/pypi_build_publish_template.yaml similarity index 100% rename from .github/workflows/pypy_build_publish_template.yaml rename to .github/workflows/pypi_build_publish_template.yaml diff --git a/.github/workflows/pypy_build_publish.yaml b/.github/workflows/pypy_build_publish.yaml deleted file mode 100644 index 3cbd0a98b2..0000000000 --- a/.github/workflows/pypy_build_publish.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# This workflow will build and upload WMCore core services to the production PYPY -# based on tag releases - -on: - push: - tags: - - '*.*.*' - -jobs: - build_and_publish_services: - strategy: - matrix: - target: [wmagent, wmagent-devtools, wmcore, reqmon, reqmgr2, global-workqueue, acdcserver, reqmgr2ms-unmerged, - reqmgr2ms-output, reqmgr2ms-rulecleaner, reqmgr2ms-transferor, reqmgr2ms-monitor] - uses: ./.github/workflows/pypy_build_publish_template.yaml - with: - wmcore_component: ${{ matrix.target }} - secrets: - pypy_token: ${{ secrets.PYPY_PRODUCTION }}