Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .github/workflows/init_container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ jobs:
strategy:
matrix:
agents: [
{file: "agent.zip", platform: "linux"},
{file: "agent-alpine.zip", platform: "alpine"}
{name: "linux", file: "agent.zip", platform: "linux/amd64"},
{name: "alpine", file: "agent-alpine.zip", platform: "linux/amd64"},
{name: "linux-arm64", file: "agent-arm64.zip", platform: "linux/arm64"},
{name: "alpine-arm64", file: "agent-alpine-arm64.zip", platform: "linux/arm64"}
]
runs-on: ubuntu-latest
name: Build and push Docker image
Expand All @@ -45,6 +47,10 @@ jobs:

- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: ${{ success() }}
Expand All @@ -66,7 +72,7 @@ jobs:
run: |
python3 -m pip install semver
existing_tags=()
dockerhub_tags=$(curl -s "https://hub.docker.com/v2/namespaces/lightruncom/repositories/k8s-operator-init-java-agent-${{ matrix.agents.platform }}/tags?page_size=50" | jq -r ".results[].name")
dockerhub_tags=$(curl -s "https://hub.docker.com/v2/namespaces/lightruncom/repositories/k8s-operator-init-java-agent-${{ matrix.agents.name }}/tags?page_size=50" | jq -r ".results[].name")
if [[ $? -ne 0 ]] ; then
echo "Failed to fetch existing tags"
exit 1
Expand All @@ -82,24 +88,25 @@ jobs:
echo "Comparing existing tag: $tag with new: ${{steps.set_tag.outputs.TAG_NAME}}"
if [[ $(pysemver compare $tag ${{steps.set_tag.outputs.TAG_NAME}}) -ge 0 ]] ; then
echo "Existing tag: $tag is greater or equal than new: ${{ inputs.release_tag }}. Skip adding latest tag"
echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.platform }}:${{steps.set_tag.outputs.TAG_NAME}}" >> "$GITHUB_OUTPUT"
echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.name }}:${{steps.set_tag.outputs.TAG_NAME}}" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "Adding latest tag to ${{steps.set_tag.outputs.TAG_NAME}}"
echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.platform }}:${{steps.set_tag.outputs.TAG_NAME}},lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.platform }}:latest" >> "$GITHUB_OUTPUT"
echo "DOCKER_TAGS=lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.name }}:${{steps.set_tag.outputs.TAG_NAME}},lightruncom/k8s-operator-init-java-agent-${{ matrix.agents.name }}:latest" >> "$GITHUB_OUTPUT"

- name: Download agent artifacts
run: |
aws s3 cp s3://${{ secrets.RELEASE_ARTIFACTS_BUCKET }}/artifacts/${{ inputs.release_tag }}/${{ matrix.agents.file }} ./lightrun-init-agent/


- name: Build and push ${{ matrix.agents.platform }} container
- name: Build and push ${{ matrix.agents.name }} container
uses: docker/build-push-action@v4
with:
context: .
file: ./lightrun-init-agent/Dockerfile
push: true
platforms: ${{ matrix.agents.platform }}
tags: ${{steps.set_docker_tags.outputs.DOCKER_TAGS}}
build-args: |
FILE=${{ matrix.agents.file }}
Expand All @@ -111,6 +118,6 @@ jobs:
env:
SLACK_CHANNEL: devops-alerts
SLACK_COLOR: ${{ job.status }} # or a specific color like 'good' or '#ff00ff'
SLACK_MESSAGE: "Tag ${{ inputs.release_tag }} | Platform ${{ matrix.agents.platform }}"
SLACK_MESSAGE: "Tag ${{ inputs.release_tag }} | Platform ${{ matrix.agents.name }}"
SLACK_TITLE: Init contianer build status - ${{ job.status }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion examples/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 openjdk:11
FROM openjdk:11
WORKDIR /app
COPY PrimeMain.java /app
RUN javac -g PrimeMain.java
Expand Down
7 changes: 4 additions & 3 deletions lightrun-init-agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 alpine:latest
FROM alpine:latest

ARG FILE

Expand All @@ -9,8 +9,9 @@ RUN unzip -o /tmp/$FILE -d /agent ;\
# Erase default values
sed -i.bak "s|com.lightrun.secret=.*|com.lightrun.secret=|" /agent/agent.config && rm /agent/agent.config.bak && \
sed -i.bak "s|pinned_certs=.*|pinned_certs=|" /agent/agent.config && rm /agent/agent.config.bak && \
# In openshift UID will be dynamic per project, hence chmod and not chown
chmod -R 777 /agent
# In openshift UID will be dynamic per project, hence procide permissions to root group (defualt in k8s)
chgrp -R 0 /agent && \
chmod -R g=u /agent

USER 1000
COPY lightrun-init-agent/update_config.sh /update_config.sh
Expand Down