diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 957262526..8cb419720 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -16,7 +16,7 @@ RUN sudo mkdir -p -m 755 /etc/apt/keyrings \ # install containerlab and tools RUN apt update && \ apt install -y python3-pip && \ - python3 -m pip install --break-system-packages networklab && \ + python3 -m pip install --break-system-packages $PIP_OPTIONS networklab && \ apt install -y --no-install-recommends containerlab \ btop \ gh \ diff --git a/.github/get-container-tags.sh b/.github/get-container-tags.sh new file mode 100755 index 000000000..9f9af11b8 --- /dev/null +++ b/.github/get-container-tags.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +TAG=${1#release_} +XTAG=latest +if [[ $TAG == *"dev"* ]]; then + XTAG=dev + echo "PIP_OPTIONS=--pre" +else + echo "PIP_OPTIONS=" +fi +echo "IMAGE_TAG=$TAG,$XTAG" diff --git a/.github/workflows/devcontainer-build.yml b/.github/workflows/devcontainer-build.yml index 0f43dec81..8a0b3d5ef 100644 --- a/.github/workflows/devcontainer-build.yml +++ b/.github/workflows/devcontainer-build.yml @@ -35,3 +35,5 @@ jobs: imageName: ghcr.io/${{ github.repository }}/devcontainer imageTag: ${{ inputs.docker-tags }} push: always + env: | + PIP_OPTIONS=${{ inputs.pip-options }} diff --git a/.github/workflows/devcontainer-devc.yml b/.github/workflows/devcontainer-devc.yml index cb07638a8..201cb3d02 100644 --- a/.github/workflows/devcontainer-devc.yml +++ b/.github/workflows/devcontainer-devc.yml @@ -13,5 +13,6 @@ jobs: uses: ./.github/workflows/devcontainer-build.yml with: docker-tags: devc + pip-options: --pre secrets: GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} diff --git a/.github/workflows/devcontainer-release.yml b/.github/workflows/devcontainer-release.yml index 97b4d1dbd..0fe45ce0d 100644 --- a/.github/workflows/devcontainer-release.yml +++ b/.github/workflows/devcontainer-release.yml @@ -16,12 +16,13 @@ jobs: steps: - name: Find release tag id: release_tag - run: echo "IMAGE_TAG=${GITHUB_REF_NAME#release_}" >> $GITHUB_OUTPUT + run: .github/get-contaienr-tags.sh $GITHUB_REF_NAME >> $GITHUB_OUTPUT build: needs: [ setup ] uses: ./.github/workflows/devcontainer-build.yml with: - docker-tags: ${{ needs.setup.outputs.IMAGE_TAG }},latest + docker-tags: ${{ needs.setup.outputs.IMAGE_TAG }} + pip-options: ${{ needs.setup.outputs.PIP_OPTIONS }} secrets: GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}