-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework all applications to use ArgumentParser
We already used argument parser in toaster-multiple-devices, and using different logic in other applications does not make sense. Standardize all applications to use ArgumentParser to improve future development and add -help function. This change is also crucial in order to add persistence. JIRA: LIGHTY-353 Signed-off-by: tobias.pobocik <[email protected]>
- Loading branch information
Showing
10 changed files
with
285 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Publish netconf-simulator | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Desired version of published docker image & helm charts, e.g. "XX.YY.ZZ" | ||
required: true | ||
image-tag-latest: | ||
description: Should be this docker labeled with tag latest? Enter `true` if the tag `latest` should be added for image. | ||
default: "true" | ||
required: true | ||
publish-access-key: | ||
description: The branch, tag or SHA to checkout. (if "default" the selected branch will be used) | ||
default: default | ||
required: true | ||
|
||
jobs: | ||
publish-docker-helm: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
IMAGE_NAME: "lighty-network-topology-device" | ||
PUBLISH_ACCESS_KEY: ${{ secrets.MM_PKG_WRITE }} | ||
name: "Publish netconf-simulator docker image. Checkout-ref: ${{ github.event.inputs.publish-access-key }}" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 21 | ||
distribution: 'temurin' | ||
|
||
- name: Build lighty-netconf-simulator | ||
shell: bash | ||
run: | | ||
echo "Building lighty-netconf-simulator..." | ||
mvn install -DskipTests | ||
- name: Run docker:build... | ||
shell: bash | ||
run: | | ||
echo "Image name set to:" ${{ env.IMAGE_NAME }} | ||
DOCKER_IMAGE_NAME=${{env.IMAGE_NAME}} | ||
DOCKER_IMAGE_NAME_TAG=$(echo $DOCKER_IMAGE_NAME:${{ inputs.version }}) | ||
DOCKER_IMAGE_NAME_GHCR=$(echo ghcr.io/pantheontech/${{ env.IMAGE_NAME }}) | ||
DOCKER_IMAGE_NAME_GHCR_TAG=$(echo $DOCKER_IMAGE_NAME_GHCR:${{ inputs.version }}) | ||
echo "cd examples/devices/lighty-network-topology-device" | ||
cd examples/devices/lighty-network-topology-device | ||
mvn docker:build | ||
echo "Docker image tag:" $DOCKER_IMAGE_NAME_GHCR $DOCKER_IMAGE_NAME_GHCR_TAG | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME_TAG | ||
if [ "${{ inputs.image-tag-latest }}" = 'true' ]; then | ||
docker tag $DOCKER_IMAGE_NAME $DOCKER_IMAGE_NAME:latest | ||
fi | ||
docker images | grep $DOCKER_IMAGE_NAME | ||
- name: List docker images | ||
shell: bash | ||
run: | | ||
docker images | ||
- name: Docker log in (ghcr.io) | ||
shell: bash | ||
run: | | ||
echo ${{ inputs.publish-access-key}} | docker login --username ${{ github.actor }} --password-stdin ghcr.io | ||
- name: Publish docker image (ghcr.io) | ||
shell: bash | ||
run: | | ||
docker push $DOCKER_IMAGE_NAME_GHCR_TAG | ||
if [ "${{ inputs.image-tag-latest }}" = 'true' ]; then | ||
docker push $DOCKER_IMAGE_NAME_GHCR:latest | ||
fi | ||
- name: Check if docker image is pullable (ghcr.io) | ||
shell: bash | ||
run: | | ||
docker rmi $DOCKER_IMAGE_NAME_GHCR_TAG | ||
docker pull $DOCKER_IMAGE_NAME_GHCR_TAG | ||
- name: Install yq (yaml processor) | ||
shell: bash | ||
run: | | ||
sudo snap install yq | ||
- name: Set image.name, image.version in values.yaml of helm chart | ||
shell: bash | ||
run: | | ||
yq eval '.image.name="ghcr.io/pantheontech/$'"IMAGE_NAME"'" | .image.version="'${{ inputs.version }}'"' "${{ inputs.app-helm-values-path }}" -i | ||
- name: Print values.yaml | ||
shell: bash | ||
run: | | ||
cat -A ${{ inputs.app-helm-values-path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
examples/devices/lighty-network-topology-device/src/main/docker/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM eclipse-temurin:21-jre-alpine | ||
|
||
WORKDIR /lighty-netconf-simulator | ||
|
||
COPY maven/${lighty.app.zip} ./ | ||
|
||
RUN unzip ${lighty.app.zip} && \ | ||
rm ${lighty.app.zip} | ||
|
||
WORKDIR /lighty-netconf-simulator/${lighty.app.name} | ||
|
||
ENTRYPOINT ["java", "-jar", "${lighty.app.jar}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.