Skip to content

Commit 5a599cf

Browse files
refactor: make ref checkout for picasso scripts configurable (#37)
This change makes the use of versions different than default possible, so the code available matches the version of the workflow used.
1 parent b537848 commit 5a599cf

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ on:
3434
required: false
3535
type: string
3636
default: '3.12'
37+
PICASSO_VERSION:
38+
description: 'Picasso version to use for the workflow scripts and utility functions. This should be a valid branch, tag or commit and it should match the version of the workflow used.'
39+
required: false
40+
type: string
41+
default: 'v1'
3742
secrets:
3843
DOCKERHUB_USERNAME:
3944
description: 'DockerHub username for login'
@@ -70,7 +75,7 @@ jobs:
7075
uses: actions/checkout@v4
7176
with:
7277
repository: edunext/picasso
73-
ref: v1
78+
ref: ${{ inputs.PICASSO_VERSION }}
7479
path: picasso
7580

7681
- name: Checkout strains repository for build configurations

README.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Key features of the Picasso Workflow include:
2626
- **Configurable BuildKit parallelism**: By default, the workflow limits parallelism during the build process to optimize resource usage, although this can be changed using the ``ENABLE_LIMIT_BUILDKIT_PARALLELISM`` input. This is useful for low-powered machines, like `Github Actions standard runners`_.
2727
- **Private repository access**: SSH keys are used to clone private repositories securely. The SSH private key should be stored as a secret in the repository, and must have access to the repository specified in ``STRAIN_REPOSITORY``.
2828
- **Extra commands**: The workflow allows running additional custom commands with ``tutor picasso run-extra-commands``. For details, refer to the `tutor-contrib-picasso`_ documentation.
29-
- **Environment setup**: The workflow sets up and configures Tutor Virtual Environments (TVM), installs necessary plugins like ``tutor-contrib-picasso``, and prepares the environment to build and push Docker images using the `Tutor CLI`_.
29+
- **Environment setup**: The workflow sets up installs necessary plugins like ``tutor-contrib-picasso``, and prepares the environment to build and push Docker images using the `Tutor CLI`_.
3030

3131
.. _tutor-contrib-picasso: https://github.com/eduNEXT/tutor-contrib-picasso/
3232
.. _Github Actions standard runners: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
@@ -88,6 +88,18 @@ Before using the workflow, ensure that you have set up the following configurati
8888
- Enables limiting parallelism with buildkit to decrease resource consumption for those setups with low-powered machines. Default is ``true``.
8989
- boolean
9090
- Input
91+
* - RUNNER_WORKFLOW_LABEL (Optional)
92+
- The label of the runner workflow to use. Default is ``ubuntu-24.04``.
93+
- string
94+
- Input
95+
* - PYTHON_VERSION (Optional)
96+
- The Python version to use in the workflow. Default is ``3.12``.
97+
- string
98+
- Input
99+
* - PICASSO_VERSION (Optional)
100+
- Picasso version to use for the workflow scripts and utility functions. This should be a valid branch, tag or commit and it should match the version of the workflow used. Default is the latest release major version, e.g., ``v1``.
101+
- string
102+
- Input
91103

92104
Usage
93105
*****

docs/source/how_tos/configure_workflow.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Inputs are the parameters that you can set to customize the behavior of the Pica
1515
* ``STRAIN_PATH (required)``: The path to the directory that contains the strain configuration file. This path should be relative to the root of the repository.
1616
* ``SERVICE (required)``: The name of the service that will be built. This service should be supported by Tutor or by a tutor plugin previously installed.
1717
* ``ENABLE_LIMIT_BUILDKIT_PARALLELISM (optional)``: If set to ``true``, the build process parallel steps will be limited by 3, which is the threshold found where both Open edX and MFE images are built without running out of resources in the Github Actions runner (please, see `PR #12`_ for more details) . If set to ``false``, the buildkit configuration default will be used. Default is ``true``. Set to ``false`` if you have a runner with more resources.
18+
* ``RUNNER_WORKFLOW_LABEL (optional)``: This label should match the label of the runner that will execute the workflow. By default, the workflow will use one of the `Github Actions standard runners`_, e.g., ``ubuntu-24.04``.
19+
* ``PYTHON_VERSION (optional)``: The Python version to use in the workflow. By default, the workflow will use Python 3.12.
20+
* ``PICASSO_VERSION (optional)``: Picasso version to use for the workflow scripts and utility functions. This should be a valid branch, tag or commit and it should match the version of the workflow used. By default, the workflow will use the latest release major version, e.g., ``v1``.
1821

1922
These inputs can be set in the workflow file that calls the Picasso workflow using the ``with`` keyword, by manually setting them in the workflow file, or by using the ``workflow_dispatch`` event. For more details on how to set input values in Github Actions, please refer to the `Workflow syntax for GitHub Actions`_ documentation.
2023

@@ -34,6 +37,9 @@ Here is an example of how to use the Picasso workflow with the inputs set:
3437
STRAIN_PATH: redwood/base
3538
SERVICE: mfe
3639
ENABLE_LIMIT_BUILDKIT_PARALLELISM: false
40+
RUNNER_WORKFLOW_LABEL: ubuntu-latest
41+
PYTHON_VERSION: 3.10
42+
PICASSO_VERSION: main
3743
3844
.. _`PR #12`: https://github.com/eduNEXT/picasso/pull/12
3945

@@ -93,3 +99,5 @@ Or using an AWS registry:
9399
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
94100
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
95101
AWS_REGION: ${{ secrets.AWS_REGION }}
102+
103+
.. _`Github Actions standard runners`: https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories

docs/source/topic_guides/reusable_build_workflow.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ The Picasso Workflow is designed to build Open edX Docker images for Tutor envir
2222

2323
Key features of the Picasso Workflow include:
2424

25-
- **Runs on GitHub-hosted runners**: By default, the workflow uses ``ubuntu-latest`` runners to execute jobs. This can't be changed to self-hosted runners for the time being.
25+
- **Runs on GitHub-hosted runners**: By default, the workflow uses GitHub hosted runners to execute jobs. This can't be changed to self-hosted runners for the time being.
2626
- **Builds and pushes Docker images**: The workflow pushes images to Dockerhub by default. This can be customized to push images to other registries.
2727
- **Supports multiple services**: You can specify the service to build (e.g., ``openedx``, ``mfe``, ``codejail``, etc.) using the ``SERVICE`` input.
2828
- **Customizable repository and strain**: The workflow allows for specifying the repository, branch, and path to the strain being built. This enables building images from different configurations.
2929
- **Configurable BuildKit parallelism**: By default, the workflow limits parallelism during the build process to optimize resource usage, although this can be changed using the ``ENABLE_LIMIT_BUILDKIT_PARALLELISM`` input. This is useful for low-powered machines, like `Github Actions standard runners`_.
3030
- **Private repository access**: SSH keys are used to clone private repositories securely. The SSH private key should be stored as a secret in the repository, and must have access to the repository specified in ``STRAIN_REPOSITORY``.
31+
- **Configures docker registry**: The workflow sets up the Docker registry to push images to Dockerhub or AWS ECR.
3132
- **Extra commands**: The workflow allows running additional custom commands with ``tutor picasso run-extra-commands``. For details, refer to the `tutor-contrib-picasso`_ documentation.
32-
- **Environment setup**: The workflow sets up and configures Tutor Virtual Environments (TVM), installs necessary plugins like ``tutor-contrib-picasso``, and prepares the environment to build and push Docker images using the `Tutor CLI`_.
33+
- **Environment setup**: The workflow sets up installs necessary plugins like ``tutor-contrib-picasso``, and prepares the environment to build and push Docker images using the `Tutor CLI`_.
3334

3435
.. _tutor-contrib-picasso: https://github.com/eduNEXT/tutor-contrib-picasso/
3536
.. _Github Actions standard runners: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners

0 commit comments

Comments
 (0)