Skip to content

Commit

Permalink
Remove build part
Browse files Browse the repository at this point in the history
  • Loading branch information
velioglu committed Oct 10, 2024
1 parent 545f61e commit 41165a2
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 122 deletions.
242 changes: 121 additions & 121 deletions .github/workflows/ubicloud-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,127 +46,127 @@ jobs:
matrix="$(echo $images | jq --argjson selecteds "$selected_images" '{include: .include | map(select(.image_type | IN($selecteds[])))}')"
echo "matrix<<EOF"$'\n'"$matrix"$'\n'EOF >> "$GITHUB_OUTPUT"
build:
needs: generate-matrix
name: build ${{ matrix.image_type }}
runs-on: ubicloud-standard-4
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
env:
MANAGED_IMAGE_NAME: "${{ matrix.image_type }}-${{inputs.image_version }}"
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup packer
uses: hashicorp/setup-packer@main
with:
version: 1.9.4

- name: Set variables
shell: pwsh
id: setvars
run: |
$ImageType = "${{ matrix.image_type }}"
$TemplateDirectoryName = if ($ImageType.StartsWith("ubuntu")) { "ubuntu/templates" } else { "windows/templates" }
$TemplateDirectoryPath = Join-Path "images" $TemplateDirectoryName | Resolve-Path
$TemplatePath = Join-Path $TemplateDirectoryPath "$ImageType.pkr.hcl"
"TemplateDirectoryPath=$TemplateDirectoryPath" >> $env:GITHUB_ENV
"TemplatePath=$TemplatePath" >> $env:GITHUB_ENV
- name: Build VM
shell: pwsh
run: |
./images.CI/linux-and-win/build-image.ps1 `
-ClientId "${{ secrets.AZURE_CLIENT_ID }}" `
-ClientSecret "${{ secrets.AZURE_CLIENT_SECRET }}" `
-TemplatePath "$env:TemplatePath" `
-ImageName "${{ env.MANAGED_IMAGE_NAME }}" `
-ImageResourceGroupName "${{ secrets.AZURE_RESOURCE_GROUP }}" `
-TempResourceGroupName "packer-temp-${{ env.MANAGED_IMAGE_NAME }}" `
-SubscriptionId "${{ secrets.AZURE_SUBSCRIPTION_ID }}" `
-TenantId "${{ secrets.AZURE_TENANT_ID }}" `
-Location "${{ env.AZURE_LOCATION }}" `
-ImageVersion "${{ inputs.image_version }}"
env:
PACKER_LOG: 1
PACKER_LOG_PATH: "/tmp/packer-log.txt"

- name: Convert managed image to VHD
shell: pwsh
timeout-minutes: 120
run: |
./images.CI/linux-and-win/convert-to-vhd.ps1 `
-SubscriptionId "${{ secrets.AZURE_SUBSCRIPTION_ID }}" `
-Location "${{ env.AZURE_LOCATION }}" `
-ResourceGroupName "${{ secrets.AZURE_RESOURCE_GROUP }}" `
-ManagedImageName "${{ env.MANAGED_IMAGE_NAME }}" `
-GalleryName "GitHubRunnerImages" `
-GalleryImageSku "${{ matrix.image_type }}" `
-GalleryImageVersion "${{ inputs.image_version }}" `
-StorageAccountName "${{ secrets.AZURE_STORAGE_ACCOUNT }}" `
-StorageAccountContainerName "images" `
-VhdName "${{ env.MANAGED_IMAGE_NAME }}.vhd" `
-ClientId "${{ secrets.AZURE_CLIENT_ID }}" `
-ClientSecret "${{ secrets.AZURE_CLIENT_SECRET }}" `
-TenantId "${{ secrets.AZURE_TENANT_ID }}" `
-RemoveManagedImage
- name: Copy image artifacts to the separate directory
shell: pwsh
run: |
$ImageType = "${{ matrix.image_type }}"
$rootDirectoryName = if ($ImageType.StartsWith("ubuntu")) { "ubuntu" } else { "windows" }
$rootDirectoryPath = Join-Path "images" $rootDirectoryName | Resolve-Path
$readmePath = Join-Path $rootDirectoryPath "${{ matrix.readme }}"
$softwareReportPath = Join-Path $rootDirectoryPath "software-report.json"
New-Item artifact -ItemType Directory
Copy-Item -Path $readmePath -Destination "artifact/"
if (Test-Path $softwareReportPath) {
Copy-Item -Path $softwareReportPath -Destination "artifact/"
}
- name: Print markdown software report
shell: pwsh
run: |
Get-Content -Path "artifact/${{ matrix.readme }}"
- name: Print json software report
shell: pwsh
run: |
$softwareReportPath = "artifact/software-report.json"
if (Test-Path $softwareReportPath) {
Get-Content -Path $softwareReportPath
}
- name: Publish Artifacts
uses: actions/upload-artifact@v4
with:
name: "${{ env.MANAGED_IMAGE_NAME }}-artifact"
path: artifact/*

- name: Print provisioners duration
shell: pwsh
run: |
./images.CI/measure-provisioners-duration.ps1 `
-PackerLogPath "/tmp/packer-log.txt" `
-PrefixToPathTrim "$env:TemplateDirectoryPath" `
-PrintTopNLongest 25
- name: Clean up resources
if: always()
shell: pwsh
run: |
./images.CI/linux-and-win/cleanup.ps1 `
-TempResourceGroupName "packer-temp-${{ env.MANAGED_IMAGE_NAME }}" `
-StorageAccount "${{ secrets.AZURE_STORAGE_ACCOUNT }}" `
-SubscriptionId "${{ secrets.AZURE_SUBSCRIPTION_ID }}" `
-ClientId "${{ secrets.AZURE_CLIENT_ID }}" `
-ClientSecret "${{ secrets.AZURE_CLIENT_SECRET }}" `
-TenantId "${{ secrets.AZURE_TENANT_ID }}"
# build:
# needs: generate-matrix
# name: build ${{ matrix.image_type }}
# runs-on: ubicloud-standard-4
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# env:
# MANAGED_IMAGE_NAME: "${{ matrix.image_type }}-${{inputs.image_version }}"
# steps:
# - name: Check out code
# uses: actions/checkout@v4

# - name: Setup packer
# uses: hashicorp/setup-packer@main
# with:
# version: 1.9.4

# - name: Set variables
# shell: pwsh
# id: setvars
# run: |
# $ImageType = "${{ matrix.image_type }}"
# $TemplateDirectoryName = if ($ImageType.StartsWith("ubuntu")) { "ubuntu/templates" } else { "windows/templates" }
# $TemplateDirectoryPath = Join-Path "images" $TemplateDirectoryName | Resolve-Path
# $TemplatePath = Join-Path $TemplateDirectoryPath "$ImageType.pkr.hcl"
# "TemplateDirectoryPath=$TemplateDirectoryPath" >> $env:GITHUB_ENV
# "TemplatePath=$TemplatePath" >> $env:GITHUB_ENV

# - name: Build VM
# shell: pwsh
# run: |
# ./images.CI/linux-and-win/build-image.ps1 `
# -ClientId "${{ secrets.AZURE_CLIENT_ID }}" `
# -ClientSecret "${{ secrets.AZURE_CLIENT_SECRET }}" `
# -TemplatePath "$env:TemplatePath" `
# -ImageName "${{ env.MANAGED_IMAGE_NAME }}" `
# -ImageResourceGroupName "${{ secrets.AZURE_RESOURCE_GROUP }}" `
# -TempResourceGroupName "packer-temp-${{ env.MANAGED_IMAGE_NAME }}" `
# -SubscriptionId "${{ secrets.AZURE_SUBSCRIPTION_ID }}" `
# -TenantId "${{ secrets.AZURE_TENANT_ID }}" `
# -Location "${{ env.AZURE_LOCATION }}" `
# -ImageVersion "${{ inputs.image_version }}"
# env:
# PACKER_LOG: 1
# PACKER_LOG_PATH: "/tmp/packer-log.txt"

# - name: Convert managed image to VHD
# shell: pwsh
# timeout-minutes: 120
# run: |
# ./images.CI/linux-and-win/convert-to-vhd.ps1 `
# -SubscriptionId "${{ secrets.AZURE_SUBSCRIPTION_ID }}" `
# -Location "${{ env.AZURE_LOCATION }}" `
# -ResourceGroupName "${{ secrets.AZURE_RESOURCE_GROUP }}" `
# -ManagedImageName "${{ env.MANAGED_IMAGE_NAME }}" `
# -GalleryName "GitHubRunnerImages" `
# -GalleryImageSku "${{ matrix.image_type }}" `
# -GalleryImageVersion "${{ inputs.image_version }}" `
# -StorageAccountName "${{ secrets.AZURE_STORAGE_ACCOUNT }}" `
# -StorageAccountContainerName "images" `
# -VhdName "${{ env.MANAGED_IMAGE_NAME }}.vhd" `
# -ClientId "${{ secrets.AZURE_CLIENT_ID }}" `
# -ClientSecret "${{ secrets.AZURE_CLIENT_SECRET }}" `
# -TenantId "${{ secrets.AZURE_TENANT_ID }}" `
# -RemoveManagedImage

# - name: Copy image artifacts to the separate directory
# shell: pwsh
# run: |
# $ImageType = "${{ matrix.image_type }}"
# $rootDirectoryName = if ($ImageType.StartsWith("ubuntu")) { "ubuntu" } else { "windows" }
# $rootDirectoryPath = Join-Path "images" $rootDirectoryName | Resolve-Path

# $readmePath = Join-Path $rootDirectoryPath "${{ matrix.readme }}"
# $softwareReportPath = Join-Path $rootDirectoryPath "software-report.json"

# New-Item artifact -ItemType Directory
# Copy-Item -Path $readmePath -Destination "artifact/"
# if (Test-Path $softwareReportPath) {
# Copy-Item -Path $softwareReportPath -Destination "artifact/"
# }

# - name: Print markdown software report
# shell: pwsh
# run: |
# Get-Content -Path "artifact/${{ matrix.readme }}"

# - name: Print json software report
# shell: pwsh
# run: |
# $softwareReportPath = "artifact/software-report.json"
# if (Test-Path $softwareReportPath) {
# Get-Content -Path $softwareReportPath
# }

# - name: Publish Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: "${{ env.MANAGED_IMAGE_NAME }}-artifact"
# path: artifact/*

# - name: Print provisioners duration
# shell: pwsh
# run: |
# ./images.CI/measure-provisioners-duration.ps1 `
# -PackerLogPath "/tmp/packer-log.txt" `
# -PrefixToPathTrim "$env:TemplateDirectoryPath" `
# -PrintTopNLongest 25

# - name: Clean up resources
# if: always()
# shell: pwsh
# run: |
# ./images.CI/linux-and-win/cleanup.ps1 `
# -TempResourceGroupName "packer-temp-${{ env.MANAGED_IMAGE_NAME }}" `
# -StorageAccount "${{ secrets.AZURE_STORAGE_ACCOUNT }}" `
# -SubscriptionId "${{ secrets.AZURE_SUBSCRIPTION_ID }}" `
# -ClientId "${{ secrets.AZURE_CLIENT_ID }}" `
# -ClientSecret "${{ secrets.AZURE_CLIENT_SECRET }}" `
# -TenantId "${{ secrets.AZURE_TENANT_ID }}"

upload:
if: ${{ inputs.upload_image }}
Expand Down
2 changes: 1 addition & 1 deletion images/ubuntu/scripts/build/install-haskell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set_etc_environment_variable "BOOTSTRAP_HASKELL_NONINTERACTIVE" $BOOTSTRAP_HASKE
set_etc_environment_variable "GHCUP_INSTALL_BASE_PREFIX" $GHCUP_INSTALL_BASE_PREFIX

# Install GHCup
while ! command -v ghcup > /dev/null 2>&1; do
while ! command -v ghcup; do
curl --proto '=https' --tlsv1.2 -fsSL https://get-ghcup.haskell.org | sh > /dev/null 2>&1 || true
export PATH="$ghcup_bin:$PATH"
prepend_etc_environment_path $ghcup_bin
Expand Down

0 comments on commit 41165a2

Please sign in to comment.