Skip to content

Commit

Permalink
Merge pull request #135 from katalon-studio/qtest
Browse files Browse the repository at this point in the history
Use katalon studio base image
  • Loading branch information
quidl authored Jun 26, 2023
2 parents 9af9b95 + 580d38f commit 2d0c2e0
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 240 deletions.
207 changes: 0 additions & 207 deletions .github/workflows/nodejs.yml

This file was deleted.

25 changes: 14 additions & 11 deletions .github/workflows/publish_agent_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Sets tag for latest version
if: ${{ inputs.is-latest }}
run: |
echo "DOCKER_TAG_NAME=latest" >> $GITHUB_ENV
- name: Sets tag for non-latest version
if: ${{ ! inputs.is-latest }}
run: |
echo "DOCKER_TAG_NAME=${{ inputs.version }}" >> $GITHUB_ENV
with:
ref: release

- name: Login Docker Hub
uses: docker/login-action@v1
Expand All @@ -44,4 +36,15 @@ jobs:
build-args: AGENT_VERSION=${{ inputs.version }}
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: katalonstudio/agent:${{ env.DOCKER_TAG_NAME }}
tags: katalonstudio/agent:${{ inputs.version }}

- name: Build and push Docker images
uses: docker/build-push-action@v2
if: ${{ inputs.is-latest }}
with:
context: ./
file: ./Dockerfile
build-args: AGENT_VERSION=${{ inputs.version }}
builder: ${{ steps.buildx.outputs.name }}
push: true
tags: katalonstudio/agent:latest
33 changes: 14 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN chmod a+x ./docker/scripts/build_agent.sh
RUN ./docker/scripts/build_agent.sh

# Build docker image
FROM ubuntu:20.04
FROM katalonstudio/katalon:8.6.5

# Agent arguement
ARG AGENT_VERSION
Expand Down Expand Up @@ -45,34 +45,29 @@ ENV XVFB_RUN=''
ENV X11_DISPLAY=''
ENV KEEP_FILES=''
ENV NO_KEEP_FILES=''
ENV AUTO_UPGRADE_ENVIRONMENT=false

# PATH Environment
ENV PATH "$PATH:$KATALON_SCRIPT_DIR:$KATALON_AGENT_DIR:$GRADLE_BIN"
RUN echo "PATH=\"$PATH\"" > /etc/environment

# Copy script files
RUN apt update && apt -y install openjdk-8-jdk && update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
# Copy agent
WORKDIR $KATALON_AGENT_DIR
COPY --from=build /katalon/bin/cli-linux-x64 *.sh ./

# Copy script files
RUN mkdir -p $KATALON_SCRIPT_DIR
# RUN apt update && apt -y install openjdk-8-jdk && update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

# Copy script files and setup
WORKDIR $KATALON_SCRIPT_DIR
COPY ./docker/scripts/wrap_chrome_binary.sh wrap_chrome_binary.sh
COPY ./docker/scripts/setup_environment.sh setup_environment.sh
# COPY ./docker/scripts/wrap_chrome_binary.sh wrap_chrome_binary.sh
# COPY ./docker/scripts/setup_environment.sh setup_environment.sh
COPY ./docker/scripts/upgrade_environment.sh upgrade_environment.sh
COPY ./docker/scripts/setup_agent.sh setup_agent.sh
COPY ./docker/scripts/setup.sh setup.sh
COPY ./docker/scripts/agent.sh agent.sh

# Copy agent
WORKDIR $KATALON_AGENT_DIR
COPY --from=build /katalon/bin/cli-linux-x64 *.sh ./

# Setup
WORKDIR $KATALON_SCRIPT_DIR
RUN chmod -R 777 ./
RUN ./setup.sh

# PATH Environment
ENV PATH "$PATH:$KATALON_SCRIPT_DIR:$KATALON_AGENT_DIR:$GRADLE_BIN"
RUN echo "PATH=\"$PATH\"" > /etc/environment

WORKDIR /
COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN ["chmod", "+x", "/usr/local/bin/entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
Expand Down
3 changes: 3 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -xe

echo "Entrypoint"

if [ "$AUTO_UPGRADE_ENVIRONMENT" = true ]; then
/katalon/scripts/upgrade_environment.sh || true
fi
if [ -z "$KATALON_USER_ID" ]; then
exec "$@"
else
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cd $KATALON_AGENT_DIR
--no-keep-files "$NO_KEEP_FILES"
args=("./cli-linux-x64" "$@")

xvfb-run -s "-screen 0 $DISPLAY_CONFIGURATION" "${args[@]}"
xvfb-run -e /dev/stdout -s "-screen 0 $DISPLAY_CONFIGURATION" -a "${args[@]}"
ret_code=$?

exit $ret_code
2 changes: 1 addition & 1 deletion docker/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

set -xe

./setup_environment.sh
# ./setup_environment.sh
./setup_agent.sh
10 changes: 10 additions & 0 deletions docker/scripts/upgrade_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -xe

echo "Upgrade Google Chrome"
chrome_package='google-chrome-stable_current_amd64.deb'
wget -O $chrome_package https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i $chrome_package || apt -y -f install
rm $chrome_package
echo "$(google-chrome --version)" >> $KATALON_VERSION_FILE || true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "katalon-agent",
"version": "v1.7.6",
"version": "v1.7.7",
"description": "",
"main": "cli.js",
"scripts": {
Expand Down

0 comments on commit 2d0c2e0

Please sign in to comment.