Skip to content

Build and push container to my local registry #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
34 changes: 21 additions & 13 deletions .github/workflows/build-ci-container-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ on:

jobs:
build-ci-container-windows:
if: github.repository_owner == 'llvm'
runs-on: windows-2019
# if: github.repository_owner == 'llvm'
runs-on: windows-2022
permissions:
packages: write
outputs:
container-name: ${{ steps.vars.outputs.container-name }}
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
Expand All @@ -34,31 +36,37 @@ jobs:
id: vars
run: |
$tag = [int64](Get-Date -UFormat %s)
$container_name="ghcr.io/$env:GITHUB_REPOSITORY_OWNER/ci-windows-2019"
$container_name="ghcr.io/$($env:GITHUB_REPOSITORY_OWNER.ToLower())/ci-windows-2019"
echo "container-name=${container_name}" >> $env:GITHUB_OUTPUT
echo "container-name-tag=${container_name}:${tag}" >> $env:GITHUB_OUTPUT
echo "container-filename=ci-windows-${tag}.tar" >> $env:GITHUB_OUTPUT
- name: Build Container
working-directory: .github/workflows/containers/github-action-ci-windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker build -t ${{ steps.vars.outputs.container-name-tag }} .
- name: Save container image
run: |
docker save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
- name: Upload container image
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: container
path: ${{ steps.vars.outputs.container-filename }}
retention-days: 14
docker tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest
docker login -u ${{ github.actor }} -p $env:GITHUB_TOKEN ghcr.io
docker push ${{ steps.vars.outputs.container-name-tag }}
docker push ${{ steps.vars.outputs.container-name }}:latest
# - name: Save container image
# run: |
# docker save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
# - name: Upload container image
# uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
# with:
# name: container
# path: ${{ steps.vars.outputs.container-filename }}
# retention-days: 14

push-ci-container:
if: github.event_name == 'push'
needs:
- build-ci-container-windows
permissions:
packages: write
runs-on: windows-2019
runs-on: windows-2022
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Agent image for LLVM org cluster.
# .net 4.8 is required by chocolately package manager.
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022

# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]

# Download the Build Tools bootstrapper.
ADD https://aka.ms/vs/16/release/vs_buildtools.exe /TEMP/vs_buildtools.exe
ADD https://aka.ms/vs/17/release/vs_buildtools.exe /TEMP/vs_buildtools.exe

RUN powershell -Command Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel
ARG CHANNEL_URL=https://aka.ms/vs/17/release/channel
ADD ${CHANNEL_URL} /TEMP/VisualStudio.chman

# Install Build Tools with C++ workload.
Expand Down Expand Up @@ -39,7 +39,8 @@ RUN regsvr32 /S "C:\BuildTools\DIA SDK\bin\amd64\msdia140.dll" & \

# install tools as described in https://llvm.org/docs/GettingStartedVS.html
# and a few more that were not documented...
RUN choco install -y ninja git sccache
# make is needed by LLDB tests
RUN choco install -y ninja git sccache make
# Pin an older version of Python; the current Python 3.10 fails when
# doing "pip install" for the other dependencies, as it fails to find libxml
# while compiling some package.
Expand Down