Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reusable workflow for publishing service artifacts #94

Merged
merged 3 commits into from
May 2, 2023

Conversation

turkenf
Copy link
Contributor

@turkenf turkenf commented Apr 26, 2023

Description of your changes

This PR adds a reusable workflow to be reused by official provider repositories for publishing service artifacts.

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Manually tested on turkenf/uptest and turkenf/provider-azure

if: ${{ github.actor == 'OWNER' || github.actor == 'turkenf' || contains(github.event.repository.collaborators, github.actor) }}
runs-on: ubuntu-22.04

steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not with this initial PR but as a next step, we should consider parallelizing using a matrix strategy.

jobs:
  package_matrix:
    strategy:
      matrix:
        subpackage: [config, ec2, rds] # consider calculating this from sub packages input.
        arch: [amd64, arm64]

Copy link
Contributor

@ulucinar ulucinar Apr 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we had better also give this a try @turkenf. The disadvantage might be the initial setup needed for running these jobs that are normally be shared by the build process (such as buildx setup, caching, vendoring, etc.) will be duplicated. But we may find a way to share this step between the jobs generated by the matrix strategy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the idea of triggering the publish-service-artifacts job via the gh tool.

@turkenf turkenf force-pushed the provider-publish-service-artifacts branch from 963b5e1 to 9b9d952 Compare April 27, 2023 14:49
@turkenf turkenf force-pushed the provider-publish-service-artifacts branch from 9b9d952 to 4d6a5a1 Compare April 27, 2023 15:18
@turkenf turkenf force-pushed the provider-publish-service-artifacts branch from 4d6a5a1 to 1f4de98 Compare April 28, 2023 08:27
workflow_call:
inputs:
subpackages:
description: 'Subpackages to be built individually (e.g. monolith config ec2)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value could be monolith.


on:
workflow_call:
inputs:
Copy link
Contributor

@ulucinar ulucinar May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also add the following input parameters to this workflow?

  • version: Required, no default (ideally we would like to make version optional and only set the VERSION make variable if the version Github workflow input parameter is specified but we can do this in a follow-up PR). Again we need to set the VERSION make variable in both Publish Artifacts & Build Artifacts steps. An example value for the description could be: v0.1.0.


- name: Publish Artifacts
run: |
make -j ${{ steps.build_artifacts.outputs.num_packages }} SUBPACKAGES="${{ inputs.subpackages }}" publish
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please hardcode the following so that we only build & push for the release candidates organization?
We had better hardcode the following make variables in Publish Artifacts & Build Artifacts steps: make -j $num_packages SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE=upbound-release-candidates build.all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


- name: Publish Artifacts
run: |
make -j ${{ steps.build_artifacts.outputs.num_packages }} SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE =xpkg.upbound.io/upbound-release-candidates VERSION=${{ inputs.version }} publish
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
make -j ${{ steps.build_artifacts.outputs.num_packages }} SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE =xpkg.upbound.io/upbound-release-candidates VERSION=${{ inputs.version }} publish
make -j ${{ steps.build_artifacts.outputs.num_packages }} SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE=xpkg.upbound.io/upbound-release-candidates VERSION=${{ inputs.version }} publish

if [ $num_packages -gt 10 ]; then
num_packages=10
fi
make -j $num_packages SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE =xpkg.upbound.io/upbound-release-candidates VERSION=${{ inputs.version }} build.all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
make -j $num_packages SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE =xpkg.upbound.io/upbound-release-candidates VERSION=${{ inputs.version }} build.all
make -j $num_packages SUBPACKAGES="${{ inputs.subpackages }}" XPKG_REG_ORGS=xpkg.upbound.io/upbound-release-candidates XPKG_REG_ORGS_NO_PROMOTE=xpkg.upbound.io/upbound-release-candidates VERSION=${{ inputs.version }} build.all

@turkenf turkenf force-pushed the provider-publish-service-artifacts branch from 35cde7d to 3948f2f Compare May 2, 2023 12:20
Copy link
Contributor

@ulucinar ulucinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @turkenf, lgtm.

@turkenf turkenf merged commit 102c16c into upbound:main May 2, 2023
@turkenf turkenf deleted the provider-publish-service-artifacts branch May 2, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants