Skip to content

Commit

Permalink
Bug fix: change container tag and PIP option for dev release builds (f…
Browse files Browse the repository at this point in the history
…ixes #1259)
  • Loading branch information
ipspace committed Jul 31, 2024
1 parent 10b1ee8 commit 1d5ef4e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM mcr.microsoft.com/devcontainers/python:3.11-bookworm

ARG PIP_OPTIONS
ENV PIP_OPTIONS=${PIP_OPTIONS}
ENV NETLAB_DEVICES_FRR_CLAB_GROUP__VARS_NETLAB__MGMT__VRF=False
ENV ANSIBLE_CONFIG=./ansible.cfg
LABEL org.opencontainers.image.source https://github.com/ipspace/netlab
Expand All @@ -16,7 +18,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 \
Expand Down
7 changes: 5 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
{
"build": {
"dockerfile": "./Dockerfile"
},
"dockerfile": "./Dockerfile",
"args": {
"PIP_OPTIONS": "${localEnv:PIP_OPTIONS}"
}
},
"name": "netlab development container",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"remoteUser": "vscode",
Expand Down
11 changes: 11 additions & 0 deletions .github/get-container-tags.sh
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions .github/workflows/devcontainer-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ on:
docker-tags:
required: True
type: string
pip-options:
required: False
type: string
secrets:
GHCR_TOKEN:
required: True

env:
REGISTRY: ghcr.io
PIP_OPTIONS: ${{ inputs.pip-options }}

jobs:
build:
Expand All @@ -35,3 +39,5 @@ jobs:
imageName: ghcr.io/${{ github.repository }}/devcontainer
imageTag: ${{ inputs.docker-tags }}
push: always
env: |
PIP_OPTIONS
1 change: 1 addition & 0 deletions .github/workflows/devcontainer-devc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ jobs:
uses: ./.github/workflows/devcontainer-build.yml
with:
docker-tags: devc
pip-options: --pre
secrets:
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/devcontainer-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-container-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 }}

0 comments on commit 1d5ef4e

Please sign in to comment.