From e8aecee3ce890ddd2633c8d1f3670b3480a24de8 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 29 Jul 2024 16:39:11 -0400 Subject: [PATCH 01/28] feat: add first version of picasso builder action --- action.yml | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 action.yml diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..d86a7be --- /dev/null +++ b/action.yml @@ -0,0 +1,145 @@ +name: Picasso V2 +description: 'Picasso is a tool for building Open edX images. These images are used to launch Open edX environments for both production and development.' +inputs: + STRAIN_REPOSITORY: + description: '...' + required: true + STRAIN_REPOSITORY_BRANCH: + description: '...' + required: true + STRAIN_PATH: + description: '...' + required: true + SERVICE: + description: '...' + required: true + DOCKERHUB_USERNAME: + description: '...' + required: true + DOCKERHUB_PASSWORD: + description: '...' + required: true + REPO_DEPLOYMENT_KEY: + description: '...' + required: true + +runs: + using: 'composite' + steps: + - name: Login in DockerHub + uses: docker/login-action@v3 + with: + username: ${{ inputs.DOCKERHUB_USERNAME }} + password: ${{ inputs.DOCKERHUB_PASSWORD }} + + - name: Checkout strains repository + uses: actions/checkout@v2 + with: + repository: ${{ inputs.STRAIN_REPOSITORY }} + ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} + token: ${{ inputs.REPO_DEPLOYMENT_KEY }} + + - name: Get Global Variables + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} + run: | + if [ ! -e "./config.yml" ]; then + echo "ERROR: file config.yml doesn't exist" + exit 1 # terminate and indicate error + fi + + # Initialize variables + strain_name="" + strain_tutor_version="" + + # Read config.yml line by line + while IFS= read -r line || [[ -n $line ]]; do + if [[ "$line" == *":"* ]]; then + name=$(echo "$line" | cut -d ":" -f1) + value=$(echo "$line" | cut -d ":" -f2- | awk '{$1=$1};1' | tr -d '\r') + + case $name in + *"TUTOR_APP_NAME"*) + strain_name=$value + ;; + *"TUTOR_VERSION"*) + strain_tutor_version=$value + ;; + esac + fi + done < "config.yml" + + # Check if variables are set + if [ -z "$strain_name" ]; then + echo "ERROR: TUTOR_APP_NAME not found in the given config.yml" >&2 + exit 1 + fi + + if [ -z "$strain_tutor_version" ]; then + echo "ERROR: TUTOR_VERSION not found in the given config.yml" >&2 + exit 1 + fi + + echo "TUTOR_APP_NAME=${strain_name}" >> $GITHUB_ENV + echo "TUTOR_VERSION=${strain_tutor_version}" >> $GITHUB_ENV + + - name: Install TVM + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} + env: + TUTOR_VERSION: ${{ env.TUTOR_VERSION }} + TUTOR_APP_NAME: ${{ env.TUTOR_APP_NAME }} + run: | + tvm install $TUTOR_VERSION + tvm project init $TUTOR_APP_NAME $TUTOR_VERSION + + # This command copies all the files and folders + # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder + cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ + + - name: Configure TVM Project + shell: bash + working-directory: ${{ github.workspace }}/strains/${{ env.STRAIN_PATH }}/$TUTOR_APP_NAME + run: | + . .tvm/bin/activate + tutor config save + + - name: Execute extra commands + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} + run: | + . .tvm/bin/activate + tutor plugins update + + major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) + distro_version=$( + git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \\ + | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \\ + | tail -n 1 \\ + | awk -F'/' '{print $NF}' \\ + ) + + pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version + + tutor plugins list + tutor plugins enable distro + + syntax_validation=$(tutor distro syntax-validator) + + # Fails if the returned value doesn't contain the word 'Success' + if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then + echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 + exit 1 + fi + + tutor distro run-extra-commands + tutor config save + + - name: Build service + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} + env: + SERVICE: ${{ inputs.SERVICE }} + run: | + . .tvm/bin/activate + tutor images build $SERVICE --no-cache From a934cdf4b2d4b55a1cc30b1b8c71cb1eb02124e6 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 29 Jul 2024 17:29:43 -0400 Subject: [PATCH 02/28] refactor: comment repo deployment key for now --- action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index d86a7be..c53a0e7 100644 --- a/action.yml +++ b/action.yml @@ -19,9 +19,9 @@ inputs: DOCKERHUB_PASSWORD: description: '...' required: true - REPO_DEPLOYMENT_KEY: - description: '...' - required: true + # REPO_DEPLOYMENT_KEY: + # description: '...' + # required: true runs: using: 'composite' @@ -33,11 +33,11 @@ runs: password: ${{ inputs.DOCKERHUB_PASSWORD }} - name: Checkout strains repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: ${{ inputs.STRAIN_REPOSITORY }} ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} - token: ${{ inputs.REPO_DEPLOYMENT_KEY }} + # token: ${{ inputs.REPO_DEPLOYMENT_KEY }} - name: Get Global Variables shell: bash From b3f0c8bbd59b5452c3b0219c7f9bacd6d3a23f31 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 29 Jul 2024 18:21:52 -0400 Subject: [PATCH 03/28] Revert "refactor: comment repo deployment key for now" This reverts commit a934cdf4b2d4b55a1cc30b1b8c71cb1eb02124e6. --- action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index c53a0e7..d86a7be 100644 --- a/action.yml +++ b/action.yml @@ -19,9 +19,9 @@ inputs: DOCKERHUB_PASSWORD: description: '...' required: true - # REPO_DEPLOYMENT_KEY: - # description: '...' - # required: true + REPO_DEPLOYMENT_KEY: + description: '...' + required: true runs: using: 'composite' @@ -33,11 +33,11 @@ runs: password: ${{ inputs.DOCKERHUB_PASSWORD }} - name: Checkout strains repository - uses: actions/checkout@v4 + uses: actions/checkout@v2 with: repository: ${{ inputs.STRAIN_REPOSITORY }} ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} - # token: ${{ inputs.REPO_DEPLOYMENT_KEY }} + token: ${{ inputs.REPO_DEPLOYMENT_KEY }} - name: Get Global Variables shell: bash From 1fdf90e6fca4064ee43e57e522d3207809e22958 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 19:49:52 -0400 Subject: [PATCH 04/28] fix: install tvm before using it --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index d86a7be..c49f54c 100644 --- a/action.yml +++ b/action.yml @@ -90,6 +90,7 @@ runs: TUTOR_VERSION: ${{ env.TUTOR_VERSION }} TUTOR_APP_NAME: ${{ env.TUTOR_APP_NAME }} run: | + pip install git+https://github.com/eduNEXT/tvm.git tvm install $TUTOR_VERSION tvm project init $TUTOR_APP_NAME $TUTOR_VERSION From 926ef7a0e11a84427841f10fdb475945371d60aa Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 19:55:52 -0400 Subject: [PATCH 05/28] refactor: use correct working directory for steps --- action.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index c49f54c..9a64ce9 100644 --- a/action.yml +++ b/action.yml @@ -41,7 +41,7 @@ runs: - name: Get Global Variables shell: bash - working-directory: ${{ inputs.STRAIN_PATH }} + working-directory: ./${{ inputs.STRAIN_PATH }} run: | if [ ! -e "./config.yml" ]; then echo "ERROR: file config.yml doesn't exist" @@ -85,7 +85,7 @@ runs: - name: Install TVM shell: bash - working-directory: ${{ inputs.STRAIN_PATH }} + working-directory: ./${{ inputs.STRAIN_PATH }} env: TUTOR_VERSION: ${{ env.TUTOR_VERSION }} TUTOR_APP_NAME: ${{ env.TUTOR_APP_NAME }} @@ -100,7 +100,8 @@ runs: - name: Configure TVM Project shell: bash - working-directory: ${{ github.workspace }}/strains/${{ env.STRAIN_PATH }}/$TUTOR_APP_NAME + + working-directory: ./${{ inputs.STRAIN_PATH }} run: | . .tvm/bin/activate tutor config save @@ -138,7 +139,7 @@ runs: - name: Build service shell: bash - working-directory: ${{ inputs.STRAIN_PATH }} + working-directory: ./${{ inputs.STRAIN_PATH }} env: SERVICE: ${{ inputs.SERVICE }} run: | From 98a2821ffd27c5d0ed8a8349a737d0461d914983 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 20:08:46 -0400 Subject: [PATCH 06/28] refactor: comment further steps while testing --- action.yml | 89 +++++++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/action.yml b/action.yml index 9a64ce9..88debef 100644 --- a/action.yml +++ b/action.yml @@ -83,6 +83,15 @@ runs: echo "TUTOR_APP_NAME=${strain_name}" >> $GITHUB_ENV echo "TUTOR_VERSION=${strain_tutor_version}" >> $GITHUB_ENV + - name: Install dependencies and activate virtualenv + shell: bash + run: | + python -m venv venv + python -m pip install --upgrade pip + . venv/bin/activate + pip install git+https://github.com/eduNEXT/tvm.git + echo PATH=$PATH >> $GITHUB_ENV + - name: Install TVM shell: bash working-directory: ./${{ inputs.STRAIN_PATH }} @@ -90,7 +99,6 @@ runs: TUTOR_VERSION: ${{ env.TUTOR_VERSION }} TUTOR_APP_NAME: ${{ env.TUTOR_APP_NAME }} run: | - pip install git+https://github.com/eduNEXT/tvm.git tvm install $TUTOR_VERSION tvm project init $TUTOR_APP_NAME $TUTOR_VERSION @@ -100,48 +108,47 @@ runs: - name: Configure TVM Project shell: bash - working-directory: ./${{ inputs.STRAIN_PATH }} run: | . .tvm/bin/activate tutor config save - - name: Execute extra commands - shell: bash - working-directory: ${{ inputs.STRAIN_PATH }} - run: | - . .tvm/bin/activate - tutor plugins update - - major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) - distro_version=$( - git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \\ - | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \\ - | tail -n 1 \\ - | awk -F'/' '{print $NF}' \\ - ) - - pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version - - tutor plugins list - tutor plugins enable distro - - syntax_validation=$(tutor distro syntax-validator) - - # Fails if the returned value doesn't contain the word 'Success' - if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then - echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 - exit 1 - fi - - tutor distro run-extra-commands - tutor config save - - - name: Build service - shell: bash - working-directory: ./${{ inputs.STRAIN_PATH }} - env: - SERVICE: ${{ inputs.SERVICE }} - run: | - . .tvm/bin/activate - tutor images build $SERVICE --no-cache + # - name: Execute extra commands + # shell: bash + # working-directory: ./${{ inputs.STRAIN_PATH }} + # run: | + # . .tvm/bin/activate + # tutor plugins update + + # major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) + # distro_version=$( + # git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \\ + # | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \\ + # | tail -n 1 \\ + # | awk -F'/' '{print $NF}' \\ + # ) + + # pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version + + # tutor plugins list + # tutor plugins enable distro + + # syntax_validation=$(tutor distro syntax-validator) + + # # Fails if the returned value doesn't contain the word 'Success' + # if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then + # echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 + # exit 1 + # fi + + # tutor distro run-extra-commands + # tutor config save + + # - name: Build service + # shell: bash + # working-directory: ./${{ inputs.STRAIN_PATH }} + # env: + # SERVICE: ${{ inputs.SERVICE }} + # run: | + # . .tvm/bin/activate + # tutor images build $SERVICE --no-cache From 39fd6a0541ce91bb47b62f9e57e9afc06a0a7615 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 20:15:33 -0400 Subject: [PATCH 07/28] temp: use debug logs --- action.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index 88debef..d28ce86 100644 --- a/action.yml +++ b/action.yml @@ -41,8 +41,9 @@ runs: - name: Get Global Variables shell: bash - working-directory: ./${{ inputs.STRAIN_PATH }} + working-directory: ${{ inputs.STRAIN_PATH }} run: | + pwd if [ ! -e "./config.yml" ]; then echo "ERROR: file config.yml doesn't exist" exit 1 # terminate and indicate error @@ -86,19 +87,19 @@ runs: - name: Install dependencies and activate virtualenv shell: bash run: | + pwd python -m venv venv python -m pip install --upgrade pip . venv/bin/activate pip install git+https://github.com/eduNEXT/tvm.git + echo $PATH echo PATH=$PATH >> $GITHUB_ENV - name: Install TVM shell: bash - working-directory: ./${{ inputs.STRAIN_PATH }} - env: - TUTOR_VERSION: ${{ env.TUTOR_VERSION }} - TUTOR_APP_NAME: ${{ env.TUTOR_APP_NAME }} + working-directory: ${{ inputs.STRAIN_PATH }} run: | + pwd tvm install $TUTOR_VERSION tvm project init $TUTOR_APP_NAME $TUTOR_VERSION @@ -106,12 +107,14 @@ runs: # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ - - name: Configure TVM Project - shell: bash - working-directory: ./${{ inputs.STRAIN_PATH }} - run: | - . .tvm/bin/activate - tutor config save + ls $TUTOR_APP_NAME/ + + # - name: Configure TVM Project + # shell: bash + # working-directory: ${{ inputs.STRAIN_PATH }} + # run: | + # . .tvm/bin/activate + # tutor config save # - name: Execute extra commands # shell: bash From 142d3367ded42a3d73aa4f53f511549a7958c5f6 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 21:06:03 -0400 Subject: [PATCH 08/28] temp: use debug logs --- action.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index d28ce86..d0dd369 100644 --- a/action.yml +++ b/action.yml @@ -99,22 +99,20 @@ runs: shell: bash working-directory: ${{ inputs.STRAIN_PATH }} run: | - pwd tvm install $TUTOR_VERSION tvm project init $TUTOR_APP_NAME $TUTOR_VERSION - + ls -a # This command copies all the files and folders # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ + echo TUTOR_ROOT=$TUTOR_ROOT >> $GITHUB_ENV + echo TUTOR_PLUGINS_ROOT=$TUTOR_PLUGINS_ROOT >> $GITHUB_ENV - ls $TUTOR_APP_NAME/ - - # - name: Configure TVM Project - # shell: bash - # working-directory: ${{ inputs.STRAIN_PATH }} - # run: | - # . .tvm/bin/activate - # tutor config save + - name: Configure TVM Project + shell: bash + run: | + . .tvm/bin/activate + tutor config save # - name: Execute extra commands # shell: bash From 19bfd1b4a34069c43e5935f74a60c14dc9a87550 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 21:14:07 -0400 Subject: [PATCH 09/28] refactor: use working directory with tvm environment --- action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d0dd369..8b56901 100644 --- a/action.yml +++ b/action.yml @@ -101,15 +101,14 @@ runs: run: | tvm install $TUTOR_VERSION tvm project init $TUTOR_APP_NAME $TUTOR_VERSION - ls -a + # This command copies all the files and folders # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ - echo TUTOR_ROOT=$TUTOR_ROOT >> $GITHUB_ENV - echo TUTOR_PLUGINS_ROOT=$TUTOR_PLUGINS_ROOT >> $GITHUB_ENV - name: Configure TVM Project shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} run: | . .tvm/bin/activate tutor config save From 934e2615d2e2ab3580b93ef5068444a92f56b9ac Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 21:17:31 -0400 Subject: [PATCH 10/28] refactor: uncomment further steps for testing --- action.yml | 78 +++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/action.yml b/action.yml index 8b56901..1ed826e 100644 --- a/action.yml +++ b/action.yml @@ -113,42 +113,42 @@ runs: . .tvm/bin/activate tutor config save - # - name: Execute extra commands - # shell: bash - # working-directory: ./${{ inputs.STRAIN_PATH }} - # run: | - # . .tvm/bin/activate - # tutor plugins update - - # major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) - # distro_version=$( - # git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \\ - # | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \\ - # | tail -n 1 \\ - # | awk -F'/' '{print $NF}' \\ - # ) - - # pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version - - # tutor plugins list - # tutor plugins enable distro - - # syntax_validation=$(tutor distro syntax-validator) - - # # Fails if the returned value doesn't contain the word 'Success' - # if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then - # echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 - # exit 1 - # fi - - # tutor distro run-extra-commands - # tutor config save - - # - name: Build service - # shell: bash - # working-directory: ./${{ inputs.STRAIN_PATH }} - # env: - # SERVICE: ${{ inputs.SERVICE }} - # run: | - # . .tvm/bin/activate - # tutor images build $SERVICE --no-cache + - name: Execute extra commands + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} + run: | + . .tvm/bin/activate + tutor plugins update + + major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) + distro_version=$( + git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \\ + | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \\ + | tail -n 1 \\ + | awk -F'/' '{print $NF}' \\ + ) + + pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version + + tutor plugins list + tutor plugins enable distro + + syntax_validation=$(tutor distro syntax-validator) + + # Fails if the returned value doesn't contain the word 'Success' + if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then + echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 + exit 1 + fi + + tutor distro run-extra-commands + tutor config save + + - name: Build service + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} + env: + SERVICE: ${{ inputs.SERVICE }} + run: | + . .tvm/bin/activate + tutor images build $SERVICE --no-cache From acb78ae5b28de9de616de2221ddae1ecca5008d1 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 30 Jul 2024 21:28:22 -0400 Subject: [PATCH 11/28] temp: comment syntax validator for now --- action.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index 1ed826e..8ea7093 100644 --- a/action.yml +++ b/action.yml @@ -122,10 +122,10 @@ runs: major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) distro_version=$( - git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \\ - | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \\ - | tail -n 1 \\ - | awk -F'/' '{print $NF}' \\ + git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \ + | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \ + | tail -n 1 \ + | awk -F'/' '{print $NF}' \ ) pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version @@ -133,13 +133,13 @@ runs: tutor plugins list tutor plugins enable distro - syntax_validation=$(tutor distro syntax-validator) + # syntax_validation=$(tutor distro syntax-validator) - # Fails if the returned value doesn't contain the word 'Success' - if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then - echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 - exit 1 - fi + # # Fails if the returned value doesn't contain the word 'Success' + # if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then + # echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 + # exit 1 + # fi tutor distro run-extra-commands tutor config save From 90db1b4652e5f9e5449088b4c322bd0bc47c994f Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 31 Jul 2024 21:32:31 -0400 Subject: [PATCH 12/28] refactor: use reusable action instead of composite --- action.yml | 302 ++++++++++++++++++++++++++--------------------------- 1 file changed, 150 insertions(+), 152 deletions(-) diff --git a/action.yml b/action.yml index 8ea7093..ffba2c1 100644 --- a/action.yml +++ b/action.yml @@ -1,154 +1,152 @@ name: Picasso V2 description: 'Picasso is a tool for building Open edX images. These images are used to launch Open edX environments for both production and development.' -inputs: - STRAIN_REPOSITORY: - description: '...' - required: true - STRAIN_REPOSITORY_BRANCH: - description: '...' - required: true - STRAIN_PATH: - description: '...' - required: true - SERVICE: - description: '...' - required: true - DOCKERHUB_USERNAME: - description: '...' - required: true - DOCKERHUB_PASSWORD: - description: '...' - required: true - REPO_DEPLOYMENT_KEY: - description: '...' - required: true - -runs: - using: 'composite' - steps: - - name: Login in DockerHub - uses: docker/login-action@v3 - with: - username: ${{ inputs.DOCKERHUB_USERNAME }} - password: ${{ inputs.DOCKERHUB_PASSWORD }} - - - name: Checkout strains repository - uses: actions/checkout@v2 - with: - repository: ${{ inputs.STRAIN_REPOSITORY }} - ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} - token: ${{ inputs.REPO_DEPLOYMENT_KEY }} - - - name: Get Global Variables - shell: bash - working-directory: ${{ inputs.STRAIN_PATH }} - run: | - pwd - if [ ! -e "./config.yml" ]; then - echo "ERROR: file config.yml doesn't exist" - exit 1 # terminate and indicate error - fi - - # Initialize variables - strain_name="" - strain_tutor_version="" - - # Read config.yml line by line - while IFS= read -r line || [[ -n $line ]]; do - if [[ "$line" == *":"* ]]; then - name=$(echo "$line" | cut -d ":" -f1) - value=$(echo "$line" | cut -d ":" -f2- | awk '{$1=$1};1' | tr -d '\r') - - case $name in - *"TUTOR_APP_NAME"*) - strain_name=$value - ;; - *"TUTOR_VERSION"*) - strain_tutor_version=$value - ;; - esac - fi - done < "config.yml" - - # Check if variables are set - if [ -z "$strain_name" ]; then - echo "ERROR: TUTOR_APP_NAME not found in the given config.yml" >&2 - exit 1 - fi - - if [ -z "$strain_tutor_version" ]; then - echo "ERROR: TUTOR_VERSION not found in the given config.yml" >&2 - exit 1 - fi - - echo "TUTOR_APP_NAME=${strain_name}" >> $GITHUB_ENV - echo "TUTOR_VERSION=${strain_tutor_version}" >> $GITHUB_ENV - - - name: Install dependencies and activate virtualenv - shell: bash - run: | - pwd - python -m venv venv - python -m pip install --upgrade pip - . venv/bin/activate - pip install git+https://github.com/eduNEXT/tvm.git - echo $PATH - echo PATH=$PATH >> $GITHUB_ENV - - - name: Install TVM - shell: bash - working-directory: ${{ inputs.STRAIN_PATH }} - run: | - tvm install $TUTOR_VERSION - tvm project init $TUTOR_APP_NAME $TUTOR_VERSION - - # This command copies all the files and folders - # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder - cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ - - - name: Configure TVM Project - shell: bash - working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} - run: | - . .tvm/bin/activate - tutor config save - - - name: Execute extra commands - shell: bash - working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} - run: | - . .tvm/bin/activate - tutor plugins update - - major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) - distro_version=$( - git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \ - | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \ - | tail -n 1 \ - | awk -F'/' '{print $NF}' \ - ) - - pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version - - tutor plugins list - tutor plugins enable distro - - # syntax_validation=$(tutor distro syntax-validator) - - # # Fails if the returned value doesn't contain the word 'Success' - # if [ -n "$syntax_validation" ] && ! echo "$syntax_validation" | grep -q "Success"; then - # echo "SYNTAX ERROR was found in the given config.yml: '$syntax_validation'" >&2 - # exit 1 - # fi - - tutor distro run-extra-commands - tutor config save - - - name: Build service - shell: bash - working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} - env: - SERVICE: ${{ inputs.SERVICE }} - run: | - . .tvm/bin/activate - tutor images build $SERVICE --no-cache + +on: + workflow_call: + inputs: + STRAIN_REPOSITORY: + description: 'The repository URL for strains' + required: true + type: string + STRAIN_REPOSITORY_BRANCH: + description: 'The branch of the repository to checkout' + required: true + type: string + STRAIN_PATH: + description: 'The path within the repository for strains' + required: true + type: string + SERVICE: + description: 'The service name to build' + required: true + type: string + secrets: + DOCKERHUB_USERNAME: + description: 'DockerHub username for login' + required: true + DOCKERHUB_PASSWORD: + description: 'DockerHub password for login' + required: true + REPO_DEPLOYMENT_KEY: + description: 'Deployment key for repository checkout' + required: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Checkout strains repository + uses: actions/checkout@v2 + with: + repository: ${{ inputs.STRAIN_REPOSITORY }} + ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} + token: ${{ secrets.REPO_DEPLOYMENT_KEY }} + + - name: Set TVM project name and version + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} + run: | + if [ ! -e "./config.yml" ]; then + echo "ERROR: file config.yml doesn't exist" + exit 1 # terminate and indicate error + fi + + # Initialize variables + strain_name="" + strain_tutor_version="" + + # Read config.yml line by line + while IFS= read -r line || [[ -n $line ]]; do + if [[ "$line" == *":"* ]]; then + name=$(echo "$line" | cut -d ":" -f1) + value=$(echo "$line" | cut -d ":" -f2- | awk '{$1=$1};1' | tr -d '\r') + + case $name in + *"TUTOR_APP_NAME"*) + strain_name=$value + ;; + *"TUTOR_VERSION"*) + strain_tutor_version=$value + ;; + esac + fi + done < "config.yml" + + # Check if variables are set + if [ -z "$strain_name" ]; then + echo "ERROR: TUTOR_APP_NAME not found in the given config.yml" >&2 + exit 1 + fi + + if [ -z "$strain_tutor_version" ]; then + echo "ERROR: TUTOR_VERSION not found in the given config.yml" >&2 + exit 1 + fi + + echo "TUTOR_APP_NAME=${strain_name}" >> $GITHUB_ENV + echo "TUTOR_VERSION=${strain_tutor_version}" >> $GITHUB_ENV + + - name: Install dependencies and activate virtualenv + shell: bash + run: | + python -m venv venv + python -m pip install --upgrade pip + . venv/bin/activate + pip install git+https://github.com/eduNEXT/tvm.git + echo $PATH + echo PATH=$PATH >> $GITHUB_ENV + + - name: Configure TVM project + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} + run: | + tvm install $TUTOR_VERSION + tvm project init $TUTOR_APP_NAME $TUTOR_VERSION + + # This command copies all the files and folders + # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder + cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ + + - name: Enable distro plugin + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} + run: | + . .tvm/bin/activate + tutor plugins update + + major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) + distro_version=$( + git ls-remote --tags https://github.com/eduNEXT/tutor-contrib-edunext-distro \ + | grep -E "$major_version\\.[0-9]+\\.[0-9]+$" \ + | tail -n 1 \ + | awk -F'/' '{print $NF}' \ + ) + + pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version + + tutor plugins list + tutor plugins enable distro + + - name: Execute extra commands + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} + run: | + . .tvm/bin/activate + tutor distro run-extra-commands + + - name: Build service image with no cache + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} + env: + SERVICE: ${{ inputs.SERVICE }} + run: | + . .tvm/bin/activate + tutor config save + tutor images build $SERVICE --no-cache From e7054ad5418b49a62fd1976d86e50e05a4bd954f Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 31 Jul 2024 21:35:25 -0400 Subject: [PATCH 13/28] refactor: move reusable action definition to workflows folder --- action.yml => .github/workflows/action.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename action.yml => .github/workflows/action.yml (100%) diff --git a/action.yml b/.github/workflows/action.yml similarity index 100% rename from action.yml rename to .github/workflows/action.yml From 89726a6fb951471b6ebe63688d948d953863522f Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 31 Jul 2024 21:37:12 -0400 Subject: [PATCH 14/28] fix: remove unnecessary description field --- .github/workflows/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index ffba2c1..a697d58 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -1,5 +1,4 @@ name: Picasso V2 -description: 'Picasso is a tool for building Open edX images. These images are used to launch Open edX environments for both production and development.' on: workflow_call: From 35495fc964ee200f7e58c20d3f6f3eeb507a8964 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 31 Jul 2024 22:16:12 -0400 Subject: [PATCH 15/28] refactor: move workflow to build yml file --- .github/workflows/{action.yml => build.yml} | 8 ++++++++ 1 file changed, 8 insertions(+) rename .github/workflows/{action.yml => build.yml} (93%) diff --git a/.github/workflows/action.yml b/.github/workflows/build.yml similarity index 93% rename from .github/workflows/action.yml rename to .github/workflows/build.yml index a697d58..e53e824 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/build.yml @@ -140,6 +140,14 @@ jobs: . .tvm/bin/activate tutor distro run-extra-commands + - name: Prepare docker if building MFE + if: ${{ inputs.SERVICE == 'mfe' }} + shell: bash + run: | + echo "[worker.oci]" > buildkit.toml + echo "max-parallelism = 2" >> buildkit.toml + docker buildx create --use --node=max2cpu --driver=docker-container --config=./buildkit.toml + - name: Build service image with no cache shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} From 1dddf54f2ae4b14eb5b93015535c89063af15563 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 13:00:37 -0400 Subject: [PATCH 16/28] refactor: use environment variable instead of turning tvm on each time --- .github/workflows/build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e53e824..a81c4fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: STRAIN_REPOSITORY: - description: 'The repository URL for strains' + description: 'The repository for strains to checkout. It should follow the format: ORGANIZATION/REPO' required: true type: string STRAIN_REPOSITORY_BRANCH: @@ -113,11 +113,12 @@ jobs: # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ + echo "TVM_PROJECT_ENV=${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }}" >> $GITHUB_ENV + - name: Enable distro plugin shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} run: | - . .tvm/bin/activate tutor plugins update major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) @@ -137,7 +138,6 @@ jobs: shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} run: | - . .tvm/bin/activate tutor distro run-extra-commands - name: Prepare docker if building MFE @@ -154,6 +154,5 @@ jobs: env: SERVICE: ${{ inputs.SERVICE }} run: | - . .tvm/bin/activate tutor config save tutor images build $SERVICE --no-cache From 05e8b01ce466e9f0080d56ff15be313de9c1017d Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 13:00:58 -0400 Subject: [PATCH 17/28] feat: add missing push step --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a81c4fd..4d6818f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -156,3 +156,11 @@ jobs: run: | tutor config save tutor images build $SERVICE --no-cache + + - name: Push service image to DockerHub + shell: bash + working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} + env: + SERVICE: ${{ inputs.SERVICE }} + run: | + tutor images push $SERVICE From 6e56a6e1017a8548c1ee92dc26f752526394a861 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 14:07:00 -0400 Subject: [PATCH 18/28] Revert "refactor: use environment variable instead of turning tvm on each time" This reverts commit 1dddf54f2ae4b14eb5b93015535c89063af15563. --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d6818f..c77fab6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: STRAIN_REPOSITORY: - description: 'The repository for strains to checkout. It should follow the format: ORGANIZATION/REPO' + description: 'The repository URL for strains' required: true type: string STRAIN_REPOSITORY_BRANCH: @@ -113,12 +113,11 @@ jobs: # from the repository STRAIN_PATH to the recently above created TVM PROJECT folder cp -r $(ls --ignore=$TUTOR_APP_NAME) $TUTOR_APP_NAME/ - echo "TVM_PROJECT_ENV=${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }}" >> $GITHUB_ENV - - name: Enable distro plugin shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} run: | + . .tvm/bin/activate tutor plugins update major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) @@ -138,6 +137,7 @@ jobs: shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} run: | + . .tvm/bin/activate tutor distro run-extra-commands - name: Prepare docker if building MFE @@ -154,6 +154,7 @@ jobs: env: SERVICE: ${{ inputs.SERVICE }} run: | + . .tvm/bin/activate tutor config save tutor images build $SERVICE --no-cache From 55095fdf8abbc774d624da3e477f62a51d1a8406 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 14:07:22 -0400 Subject: [PATCH 19/28] docs: improve documentation for strains repository input --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c77fab6..497183e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: STRAIN_REPOSITORY: - description: 'The repository URL for strains' + description: 'The repository for strains to checkout. It should follow the format: ORGANIZATION/REPO' required: true type: string STRAIN_REPOSITORY_BRANCH: From 3c70de205aaa5617020a54935532755b87bb1768 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 14:18:02 -0400 Subject: [PATCH 20/28] fix: activate tvm before pushing image --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 497183e..3ab31a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -164,4 +164,5 @@ jobs: env: SERVICE: ${{ inputs.SERVICE }} run: | + . .tvm/bin/activate tutor images push $SERVICE From 13da45d78f0e0583a391f66a54b32ad28da34a9d Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 16:12:56 -0400 Subject: [PATCH 21/28] temp: try build without virtual env --- .github/workflows/build.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ab31a3..045afaa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,15 +92,19 @@ jobs: echo "TUTOR_APP_NAME=${strain_name}" >> $GITHUB_ENV echo "TUTOR_VERSION=${strain_tutor_version}" >> $GITHUB_ENV - - name: Install dependencies and activate virtualenv + # - name: Install main dependencies and activate virtualenv + # shell: bash + # run: | + # python -m venv venv + # . venv/bin/activate + # echo PATH=$PATH >> $GITHUB_ENV + + - name: Install TVM shell: bash + working-directory: ${{ inputs.STRAIN_PATH }} run: | - python -m venv venv - python -m pip install --upgrade pip - . venv/bin/activate pip install git+https://github.com/eduNEXT/tvm.git - echo $PATH - echo PATH=$PATH >> $GITHUB_ENV + tvm --version - name: Configure TVM project shell: bash From b4c9f685d56bf1a87eda14d58199fd1a6f961ca4 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 16:36:13 -0400 Subject: [PATCH 22/28] refactor: remote tutor plugins update and list from step --- .github/workflows/build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 045afaa..e8a5877 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -122,7 +122,6 @@ jobs: working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} run: | . .tvm/bin/activate - tutor plugins update major_version=$(pip show tutor | grep Version | awk '{print $2}' | cut -d'.' -f1) distro_version=$( @@ -133,8 +132,6 @@ jobs: ) pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version - - tutor plugins list tutor plugins enable distro - name: Execute extra commands From 7c370f99968f37ff3c2e6e5a6912fb6b7d49b0ee Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 16:46:09 -0400 Subject: [PATCH 23/28] refactor: update checkout action to latest release --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e8a5877..d4ceb41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Checkout strains repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: ${{ inputs.STRAIN_REPOSITORY }} ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} From 23da84ac381aa129f1e667f4533be51bad8f775d Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 16:46:22 -0400 Subject: [PATCH 24/28] refactor: remove debug tvm command --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4ceb41..49e46cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -104,7 +104,6 @@ jobs: working-directory: ${{ inputs.STRAIN_PATH }} run: | pip install git+https://github.com/eduNEXT/tvm.git - tvm --version - name: Configure TVM project shell: bash From 7cbd2e60999b2f43636dbc9159c9a83c3470ce9f Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Thu, 1 Aug 2024 16:46:40 -0400 Subject: [PATCH 25/28] refactor!: drop creating virtual env --- .github/workflows/build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49e46cd..838cc05 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,13 +92,6 @@ jobs: echo "TUTOR_APP_NAME=${strain_name}" >> $GITHUB_ENV echo "TUTOR_VERSION=${strain_tutor_version}" >> $GITHUB_ENV - # - name: Install main dependencies and activate virtualenv - # shell: bash - # run: | - # python -m venv venv - # . venv/bin/activate - # echo PATH=$PATH >> $GITHUB_ENV - - name: Install TVM shell: bash working-directory: ${{ inputs.STRAIN_PATH }} From a43ca1372556e7eff2abf1d6b31d9ee9341897ba Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 7 Aug 2024 13:01:32 -0400 Subject: [PATCH 26/28] feat: use service account ssh key instead --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 838cc05..62d73b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,8 @@ on: DOCKERHUB_PASSWORD: description: 'DockerHub password for login' required: true - REPO_DEPLOYMENT_KEY: - description: 'Deployment key for repository checkout' + SSH_PRIVATE_KEY: + description: 'Service user SSH key for repository checkout' required: true jobs: @@ -46,7 +46,7 @@ jobs: with: repository: ${{ inputs.STRAIN_REPOSITORY }} ref: ${{ inputs.STRAIN_REPOSITORY_BRANCH }} - token: ${{ secrets.REPO_DEPLOYMENT_KEY }} + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - name: Set TVM project name and version shell: bash From abf7ca76ef2867336796300de68c5009129e31fa Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 20 Aug 2024 11:25:15 -0400 Subject: [PATCH 27/28] feat: setup ssh key for private repo cloning --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62d73b9..d783b77 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -126,6 +126,11 @@ jobs: pip install git+https://github.com/eduNEXT/tutor-contrib-edunext-distro@$distro_version tutor plugins enable distro + - name: Setup SSH agent for private repositories cloning + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Execute extra commands shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }} From 5765f2b09c8f326182863a26edbdbdd2a7126adf Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 20 Aug 2024 12:12:15 -0400 Subject: [PATCH 28/28] fix: add github to known hosts --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d783b77..3c045a3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -131,6 +131,11 @@ jobs: with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Add GitHub to known hosts + shell: bash + run: | + ssh-keyscan github.com >> ~/.ssh/known_hosts + - name: Execute extra commands shell: bash working-directory: ${{ inputs.STRAIN_PATH }}/${{ env.TUTOR_APP_NAME }}