From 792f17057325cad02fbbbfd24adc52742e63b315 Mon Sep 17 00:00:00 2001 From: Kevin Palis Date: Fri, 14 Jun 2024 15:46:43 -0400 Subject: [PATCH 1/2] Adding a new image for the new WARP automated test framework --- .gitignore | 3 +++ 3rd-party-tools/warp-tester/Dockerfile | 33 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 3rd-party-tools/warp-tester/Dockerfile diff --git a/.gitignore b/.gitignore index b8f98456..546df273 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,6 @@ atlassian-ide-plugin.xml # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser + +# .DS_Store files +.DS_Store \ No newline at end of file diff --git a/3rd-party-tools/warp-tester/Dockerfile b/3rd-party-tools/warp-tester/Dockerfile new file mode 100644 index 00000000..c623075e --- /dev/null +++ b/3rd-party-tools/warp-tester/Dockerfile @@ -0,0 +1,33 @@ + +# Use the official Ubuntu LTS base image +FROM ubuntu:24.04 + +LABEL author="Kevin Palis " + +# Install dependencies, tools, and utilities. Then remove the package list to reduce the image size +RUN apt-get update && apt-get install -y \ + curl \ + gnupg \ + lsb-release \ + software-properties-common \ + unzip \ + tree \ + python3 \ + python3-pip \ + kubectl \ + jq \ + netcat \ + && rm -rf /var/lib/apt/lists/* + +# Install cromshell +RUN pip3 install cromshell + +# Add any additional environment variables here if needed +# ENV VAR_NAME=value + +# Set working directory +WORKDIR /workspace + + +# Set the entrypoint to bash +ENTRYPOINT ["/bin/bash"] From 3a2f293de75fecbdbd90417f0b3c1193022f1a85 Mon Sep 17 00:00:00 2001 From: Kevin Palis Date: Fri, 14 Jun 2024 15:54:45 -0400 Subject: [PATCH 2/2] Adding automation for the new docker image --- .github/workflows/build-warp-tester.yml | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/build-warp-tester.yml diff --git a/.github/workflows/build-warp-tester.yml b/.github/workflows/build-warp-tester.yml new file mode 100644 index 00000000..884b7a56 --- /dev/null +++ b/.github/workflows/build-warp-tester.yml @@ -0,0 +1,78 @@ + +name: WARP Tester CI + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "develop" and "master" branch + pull_request: + branches: [ "develop", "master" ] + paths: + - '3rd-party-tools/warp-tester/**' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + inputs: + image_tag: + description: 'Docker Image Tag (default: branch_name)' + +env: + PROJECT_NAME: WARP 3rd Party Tools + # Github repo name + REPOSITORY_NAME: ${{ github.event.repository.name }} + # Region-specific Google Docker repository where GOOGLE_PROJECT/REPOSITORY_NAME can be found + DOCKER_REGISTRY: us.gcr.io + GCR_PATH: broad-gotc-prod/warp-tester + ACR_PATH: warp-tester + TAG: ${{ github.event.inputs.image_tag || github.head_ref || github.ref_name }} + +jobs: + build-for-gcr: + runs-on: ubuntu-latest + defaults: + run: + working-directory: 3rd-party-tools/warp-tester + # Map a step output to a job output + outputs: + imagePath: ${{ steps.saveImagePath.outputs.url }} + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag ${DOCKER_REGISTRY}/${GCR_PATH}:${TAG} + # Save the image path to an output + - id: 'saveImagePath' + run: echo "url=${DOCKER_REGISTRY}/${GCR_PATH}:${TAG}" >> $GITHUB_OUTPUT + # Log into the Google Docker registry + - id: 'Auth' + name: Login to GCR + uses: docker/login-action@v2 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: _json_key + password: ${{ secrets.GCR_CI_KEY }} + # Push the image to the Google Docker registry + - name: Push image + run: "docker push ${DOCKER_REGISTRY}/${GCR_PATH}:${TAG}" + + build-for-acr: + runs-on: ubuntu-latest + defaults: + run: + working-directory: 3rd-party-tools/warp-tester + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@v3 + + - name: 'Login via Azure CLI' + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + - name: 'Build and push image' + uses: azure/docker-login@v1 + with: + login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - run: | + docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/${ACR_PATH}:${TAG} + docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/${ACR_PATH}:${TAG} \ No newline at end of file