Skip to content

Commit

Permalink
Update javascript image to include java to support selenium testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kharyam committed Oct 6, 2021
1 parent 01252fc commit 731a7cf
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 13 deletions.
131 changes: 120 additions & 11 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ jobs:
###########################
ploigos-tool-sonar_ubi8:
needs:
- ploigos-tool-javascript_ubi8
- ploigos-tool-javascript_java11_ubi8

runs-on: ubuntu-latest

Expand All @@ -1487,7 +1487,7 @@ jobs:
IMAGE_TAG_FLAVOR: .ubi8
IMAGE_IS_DEFAULT_FLAVOR: true
BASE_IMAGE_NAME: ploigos-tool-javascript
BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-javascript_ubi8.outputs.version }}
BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-javascript_java11_ubi8.outputs.version }}

services:
registry:
Expand Down Expand Up @@ -1999,23 +1999,130 @@ jobs:
- name: Image Digest 🔖
run: echo ${{ steps.image_build.outputs.digest }}

##################################
# ploigos-tool-javascript_ubi8 #
##################################
ploigos-tool-javascript_ubi8:
#########################################
# ploigos-tool-javascript_java8_ubi8 #
#########################################
ploigos-tool-javascript_java8_ubi8:
needs:
- ploigos-base_ubi8
- ploigos-tool-java_java8_ubi8

runs-on: ubuntu-latest

env:
IMAGE_CONTEXT: ./ploigos-tool-javascript
IMAGE_FILE: Containerfile.ubi8
IMAGE_NAME: ploigos-tool-javascript
IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-tool-javascript:latest.ubi8
BASE_IMAGE_NAME: ploigos-base
BASE_IMAGE_VERSION: ${{ needs.ploigos-base_ubi8.outputs.version }}
IMAGE_TAG_FLAVOR: .ubi8
IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-tool-javascript:latest.java8.ubi8
BASE_IMAGE_NAME: ploigos-tool-java
BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-java_java8_ubi8.outputs.version }}
IMAGE_TAG_FLAVOR: .java8.ubi8
IMAGE_IS_DEFAULT_FLAVOR: false

services:
registry:
image: registry:2
ports:
- 5000:5000

outputs:
version: ${{ steps.prep.outputs.version }}

steps:
- name: Checkout 🛎️
uses: actions/checkout@v2

- name: Determine Image Version and Tags ⚙️
id: prep
run: ${GITHUB_WORKSPACE}/.github/scripts/determine-image-version.sh

- name: Version 📌
run: echo ${{ steps.prep.outputs.version }}

- name: Image Tags 🏷
run: echo ${{ steps.prep.outputs.tags }}

- name: Set up QEMU 🧰
uses: docker/setup-qemu-action@v1.0.1

- name: Set up Docker Buildx 🧰
uses: docker/setup-buildx-action@v1.0.4
with:
driver-opts: network=host

- name: Cache Docker layers 🗃
uses: actions/cache@v2.1.3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Image 🛠
id: image_build
uses: docker/build-push-action@v2.2.1
env:
IMAGE_BUILD_ARGS: BASE_IMAGE=${{ secrets.REGISTRY_URI }}/${{ secrets.REGISTRY_REPOSITORY }}/${{ env.BASE_IMAGE_NAME }}:${{ env.BASE_IMAGE_VERSION }}
with:
context: ${{ env.IMAGE_CONTEXT }}
file: ${{ env.IMAGE_CONTEXT }}/${{ env.IMAGE_FILE }}
build-args: ${{ env.IMAGE_BUILD_ARGS }}
push: true
tags: ${{ env.IMAGE_TAG_LOCAL }}
labels: |
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Test Image 🧪
run: |
echo "Running: docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} javascript cli tools"
docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} npm --help
docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} node --help
echo "Running: docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} java -version"
docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} java -version
- name: Login to External Registry 🔑
uses: docker/login-action@v1
with:
registry: ${{ secrets.REGISTRY_URI }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push to External Registry 🔺
id: push
run: |
docker pull ${{ env.IMAGE_TAG_LOCAL }}
TAGS=${{ steps.prep.outputs.tags }}
for TAG in ${TAGS//,/ }; do
docker tag ${{ env.IMAGE_TAG_LOCAL }} ${TAG}
docker push ${TAG}
done
- name: Image Digest 🔖
run: echo ${{ steps.image_build.outputs.digest }}

#########################################
# ploigos-tool-javascript_java11_ubi8 #
#########################################
ploigos-tool-javascript_java11_ubi8:
needs:
- ploigos-tool-java_java11_ubi8

runs-on: ubuntu-latest

env:
IMAGE_CONTEXT: ./ploigos-tool-javascript
IMAGE_FILE: Containerfile.ubi8
IMAGE_NAME: ploigos-tool-javascript
IMAGE_TAG_LOCAL: localhost:5000/${{ secrets.REGISTRY_REPOSITORY }}/ploigos-tool-javascript:latest.java11.ubi8
BASE_IMAGE_NAME: ploigos-tool-java
BASE_IMAGE_VERSION: ${{ needs.ploigos-tool-java_java11_ubi8.outputs.version }}
IMAGE_TAG_FLAVOR: .java11.ubi8
IMAGE_IS_DEFAULT_FLAVOR: true

services:
Expand Down Expand Up @@ -2082,6 +2189,8 @@ jobs:
echo "Running: docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} javascript cli tools"
docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} npm --help
docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} node --help
echo "Running: docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} java -version"
docker run --entrypoint=which ${{ env.IMAGE_TAG_LOCAL }} java -version
- name: Login to External Registry 🔑
uses: docker/login-action@v1
Expand Down
5 changes: 4 additions & 1 deletion ploigos-tool-javascript/Containerfile.ubi8
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
ARG BASE_IMAGE=quay.io/ploigos/ploigos-base:latest.ubi8
# Note: selenium is a common framework used for user interface testing and UAT.
# The npm selenium web driver package requires java in order to execute
# selenium tests. For this reason, java is used as the base image
ARG BASE_IMAGE=quay.io/ploigos/ploigos-tool-java:latest.java11.ubi8
ARG NODEJS_STREAM=12
ARG NODEJS_PROFILE=common

Expand Down
4 changes: 4 additions & 0 deletions ploigos-tool-javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ javascript with [Nodejs](https://www.nodejs.org/) and [NPM](https://www.npmjs.co

This container image is intended to be used as the container image to run Ploigos workflow steps
in that require access to the [Nodejs](https://www.nodejs.org/) and [NPM](https://www.npmjs.com/) CLI tools.

**Note:** selenium is a common framework used for user interface testing and UAT.
The npm selenium web driver package requires java in order to execute
selenium tests. For this reason, java is used as the base image
2 changes: 1 addition & 1 deletion ploigos-tool-maven/Containerfile.ubi8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=quay.io/ploigos/ploigos-tool-java-8:latest.ubi8
ARG MAVEN_VERSION=3.8.1
ARG MAVEN_VERSION=3.8.3

FROM $BASE_IMAGE
ARG PLOIGOS_USER_UID
Expand Down

0 comments on commit 731a7cf

Please sign in to comment.