-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path.gitlab-ci.yml
46 lines (42 loc) · 978 Bytes
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
stages:
- build
- deploy
before_script:
- "$LATEST_TAG=$(git describe --abbrev=0)"
- '$BUILD_NAME="WS2022-$LATEST_TAG-$(Get-Date -Format yyMMdd)-$CI_PIPELINE_IID"'
- '$env:PKR_VAR_vm_notes="$BUILD_NAME by Stefan Zimmermann"'
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- when: never
packer:
stage: build
before_script:
- 'Remove-Item -Path .\build\ -Recurse -Force; $exit_code = $?'
script:
- "packer init -upgrade ."
- "packer build -timestamp-ui -force ."
- 'tar -C build/ -cvf build/$($BUILD_NAME).ova *.mf *.ovf *.vmdk'
tags:
- packer
- tar
cache:
paths:
- packer_cache/
artifacts:
paths:
- "build/*.ova"
expire_in: 1 hours
rules:
- when: on_success
copytosmb:
stage: deploy
script:
- 'Move-Item -Path .\build\*.ova -Destination $SMB_PATH\$BUILD_NAME.ova'
tags:
- windows
rules:
- if: $SMB_PATH
when: on_success
- when: never