Skip to content

Allow using private repos for git depenendencies in the test-installation #224

@llucax

Description

@llucax

What's needed?

We need to support using private repos as dependencies using git to fetch them.

Proposed solution

This is a working solution based on:

But that also needs to make the frequenz-io/gh-action-git-setup public. Since there is quite some overlap between the action and the code we need to put inside the Dockerfile, and that code is very small, we can also consider making this job independent of the git-setup action.

diff --git a/.github/containers/test-installation/Dockerfile b/.github/containers/test-installation/Dockerfile
index 5d556fd..83d36ba 100644
--- a/.github/containers/test-installation/Dockerfile
+++ b/.github/containers/test-installation/Dockerfile
@@ -12,5 +12,8 @@ RUN apt-get update -y && \
     python -m pip install --upgrade --no-cache-dir pip
 
 COPY dist dist
-RUN pip install dist/*.whl && \
-    rm -rf dist
+# This git-credentials file is made available by the GitHub ci.yaml workflow
+COPY git-credentials /root/.git-credentials
+RUN git config --global credential.helper store && \
+    pip install dist/*.whl && \
+    rm -rf dist /root/.git-credentials
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index c6f3358..1da6a98 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -141,6 +141,11 @@ jobs:
     needs: ["build"]
     runs-on: ubuntu-20.04
     steps:
+      - name: Setup Git
+        uses: frequenz-io/[email protected]
+        with:
+          username: ${{ secrets.GIT_USER }}
+          password: ${{ secrets.GIT_PASS }}
       - name: Fetch sources
         uses: actions/checkout@v4
       - name: Download package
@@ -153,6 +153,8 @@ jobs:
         with:
           name: dist-packages
           path: dist
+      - name: Make Git credentials available to docker
+        run: cp ~/.git-credentials git-credentials
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v3
       - name: Set up docker-buildx

Use cases

No response

Alternatives and workarounds

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    part:ciAffects the GitHub workflow and other parts for running CIpart:cookiecutterAffects the generation of projects using cookiecutterpart:toolingAffects the development tooling (CI, deployment, dependency management, etc.)priority:highAddress this as soon as possibletype:enhancementNew feature or enhancement visitble to users

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions