diff --git a/.github/workflows/_containerTemplate.yml b/.github/workflows/_containerTemplate.yml index e72c182..9c47ec9 100644 --- a/.github/workflows/_containerTemplate.yml +++ b/.github/workflows/_containerTemplate.yml @@ -56,7 +56,7 @@ jobs: - name: Install cosign id: install_cosign uses: sigstore/cosign-installer@v3.7.0 - if: github.event_name != 'pull_request' + # if: github.event_name != 'pull_request' with: cosign-release: 'v2.2.0' @@ -74,7 +74,7 @@ jobs: - name: Login Container Registry id: registry_login uses: docker/login-action@v3.3.0 - if: github.event_name != 'pull_request' + # if: github.event_name != 'pull_request' with: registry: ${{ inputs.registry_uri }} username: ${{ secrets.USER_NAME }} @@ -101,7 +101,8 @@ jobs: with: context: ${{ inputs.working_directory }} file: ${{ inputs.working_directory }}/Dockerfile - push: ${{ github.event_name != 'pull_request' }} + # push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} cache-from: type=gha diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 60959f4..c1c6d8c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ on: jobs: lint: name: Lint and Test - runs-on: [ubuntu-latest] + runs-on: [self-hosted] continue-on-error: false steps: @@ -21,12 +21,19 @@ jobs: with: python-version: "3.11" + # Setup Node + - name: Setup Node + id: node_setup + uses: actions/setup-node@v4 + with: + node-version: 20 + # Setup Terraform - name: Setup Terraform id: terraform_setup uses: hashicorp/setup-terraform@v3 with: - terraform_version: "1.9.6" + terraform_version: "1.10.4" terraform_wrapper: true # Checkout repository diff --git a/code/container/Dockerfile b/code/container/Dockerfile index 509ed69..b5137b2 100644 --- a/code/container/Dockerfile +++ b/code/container/Dockerfile @@ -1,10 +1,12 @@ -FROM myoung34/github-runner-base:ubuntu-focal +FROM ghcr.io/actions/actions-runner:2.322.0 LABEL maintainer="info@perfectthymetech.com" +USER root + ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache RUN mkdir -p /opt/hostedtoolcache +RUN mkdir -p /_work -ARG GH_RUNNER_VERSION="2.322.0" ARG AZURE_CLI_VERSION="2.68.0" ARG PWSH_VERSION="7.5.0" ARG TARGETPLATFORM @@ -12,17 +14,20 @@ ARG TARGETPLATFORM SHELL ["/bin/bash", "-o", "pipefail", "-c"] WORKDIR /actions-runner -COPY install_actions.sh install_dependencies.sh /actions-runner/ +COPY install_dependencies.sh /actions-runner/ -RUN chmod +x /actions-runner/install_actions.sh /actions-runner/install_dependencies.sh \ - && /actions-runner/install_actions.sh ${GH_RUNNER_VERSION} ${TARGETPLATFORM} \ +RUN apt-get update \ + && apt-get install -y curl jq \ + && chmod +x /actions-runner/install_dependencies.sh \ + && apt-get clean \ && /actions-runner/install_dependencies.sh ${AZURE_CLI_VERSION} ${PWSH_VERSION} \ - && rm /actions-runner/install_actions.sh \ && rm /actions-runner/install_dependencies.sh \ && chown runner /_work /actions-runner /opt/hostedtoolcache COPY token.sh entrypoint.sh app_token.sh / RUN chmod +x /token.sh /entrypoint.sh /app_token.sh +USER runner + ENTRYPOINT ["/entrypoint.sh"] CMD ["./bin/Runner.Listener", "run", "--startuptype", "service"] diff --git a/code/container/install_actions.sh b/code/container/install_actions.sh deleted file mode 100644 index 10421a8..0000000 --- a/code/container/install_actions.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -ex -GH_RUNNER_VERSION=$1 -TARGETPLATFORM=$2 - -export TARGET_ARCH="x64" -if [[ $TARGETPLATFORM == "linux/arm64" ]]; then - export TARGET_ARCH="arm64" -fi -curl -L "https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/actions-runner-linux-${TARGET_ARCH}-${GH_RUNNER_VERSION}.tar.gz" > actions.tar.gz -tar -zxf actions.tar.gz -rm -f actions.tar.gz -./bin/installdependencies.sh -mkdir /_work diff --git a/code/container/install_dependencies.sh b/code/container/install_dependencies.sh index 3380a11..6fd80e0 100644 --- a/code/container/install_dependencies.sh +++ b/code/container/install_dependencies.sh @@ -3,20 +3,21 @@ AZURE_CLI_VERSION=$1 PWSH_VERSION=$2 # Install Azure CLI -sudo apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg \ - && sudo mkdir -p /etc/apt/keyrings \ - && curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/microsoft.gpg > /dev/null \ - && sudo chmod go+r /etc/apt/keyrings/microsoft.gpg \ +apt-get install -y ca-certificates curl apt-transport-https lsb-release gnupg \ + && mkdir -p /etc/apt/keyrings \ + && curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/keyrings/microsoft.gpg > /dev/null \ + && chmod go+r /etc/apt/keyrings/microsoft.gpg \ && AZ_DIST=$(lsb_release -cs) \ - && echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $AZ_DIST main" | sudo tee /etc/apt/sources.list.d/azure-cli.list \ - && sudo apt-get update \ + && echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $AZ_DIST main" | tee /etc/apt/sources.list.d/azure-cli.list \ + && apt-get update \ && AZ_DIST=$(lsb_release -cs) \ - && sudo apt-get install -y azure-cli=$AZURE_CLI_VERSION-1~$AZ_DIST + && apt-get install -y azure-cli=$AZURE_CLI_VERSION-1~$AZ_DIST # Install Powershell -sudo apt-get install -y wget \ +apt-get update \ + && apt-get install -y wget \ && wget https://github.com/PowerShell/PowerShell/releases/download/v$PWSH_VERSION/powershell_$PWSH_VERSION-1.deb_amd64.deb \ - && sudo dpkg -i powershell_$PWSH_VERSION-1.deb_amd64.deb \ - && sudo apt-get install -fy \ + && dpkg -i powershell_$PWSH_VERSION-1.deb_amd64.deb \ + && apt-get install -fy \ && rm powershell_$PWSH_VERSION-1.deb_amd64.deb \ && pwsh -Command "Install-Module -Name Az -Repository PSGallery -Force"