-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'context-windows/master'
- Loading branch information
Showing
15 changed files
with
2,712 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: 'Type: Bug' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Description** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Details:** | ||
- Windows Version: [ e.g. Windows 10 ] | ||
- Context release version: [ e.g. 6.6.0 ] | ||
- OpenNebula version: [ e.g. 6.6.1 ] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. | ||
|
||
## Progress Status | ||
- [ ] Code committed | ||
- [ ] Testing - QA | ||
- [ ] Documentation (Release notes - resolved issues, compatibility, known issues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: 'Type: Feature' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Description** | ||
Brief description of the new functionality | ||
|
||
**Use case** | ||
How are you going to use this new feature? Why do you need it? | ||
|
||
**Additional Context** | ||
Please feel free to add any other context or screenshots about the feature request here. Or any other alternative you have considered to address this new feature. | ||
|
||
## Progress Status | ||
- [ ] Code committed | ||
- [ ] Testing - QA | ||
- [ ] Documentation (Release notes - resolved issues, compatibility, known issues) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Support Windows version | ||
about: Support a Windows version officially supported by Microsoft | ||
title: Support Windows <version> | ||
labels: 'Type: Feature' | ||
assignees: '' | ||
|
||
--- | ||
|
||
Progress | ||
- [ ] Image Built and operational | ||
- [ ] Testing - QA | ||
- [ ] [Platform notes](https://docs.opennebula.io/6.6/intro_release_notes/release_notes/platform_notes.html#windows-contextualization-packages) | ||
- [ ] [Windows KB](https://support.opennebula.pro/hc/en-us/articles/360042898271-How-to-Build-an-Image-for-Windows-Virtual-Machines) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: PowerShell Linting | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
# https://docs.github.com/en/actions/guides/building-and-testing-powershell#using-psscriptanalyzer-to-lint-code | ||
lint-with-PSScriptAnalyzer: | ||
name: Install and run PSScriptAnalyzer | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install PSScriptAnalyzer module | ||
shell: pwsh | ||
run: | | ||
Set-PSRepository PSGallery -InstallationPolicy Trusted | ||
Install-Module PSScriptAnalyzer -ErrorAction Stop | ||
- name: Lint with PSScriptAnalyzer | ||
shell: pwsh | ||
run: | | ||
Invoke-ScriptAnalyzer -Path src/*.ps1 -Recurse -Outvariable issues | ||
$errors = $issues.Where({$_.Severity -eq 'Error'}) | ||
$warnings = $issues.Where({$_.Severity -eq 'Warning'}) | ||
if ($errors) { | ||
Write-Error "There were $($errors.Count) errors and $($warnings.Count) warnings total." -ErrorAction Stop | ||
} else { | ||
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
build | ||
context | ||
context-linux/out/* | ||
context-windows/out/* | ||
context-windows/*.msi | ||
context-windows/rhsrvany.exe | ||
context-windows/*.un~ | ||
context-windows/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# OpenNebula Windows VM Contextualization | ||
|
||
## Description | ||
|
||
This addon provides contextualization package for the Windows | ||
guest virtual machines running in the OpenNebula cloud. Based | ||
on the provided contextualization parameters, the packages prepare the | ||
networking in the running guest virt. machine, set | ||
passwords, run custom start scripts, and many others. | ||
|
||
## Download | ||
|
||
Latest versions can be downloaded from the | ||
[release page](https://github.com/OpenNebula/addon-context-windows/releases). | ||
Check the supported OpenNebula versions for each release. | ||
|
||
## Install | ||
|
||
Documentation on packages installation and guest contextualization can | ||
be found in the latest stable | ||
[OpenNebula Operation Guide](http://docs.opennebula.org/stable/operation/vm_setup/context_overview.html). | ||
For beta releases, refer to the latest | ||
[development documentation](http://docs.opennebula.org/devel/operation/vm_setup/context_overview.html). | ||
|
||
## Build own package | ||
|
||
### Requirements | ||
|
||
* **Linux host** | ||
* latest [msitools](https://wiki.gnome.org/msitools) | ||
* binary [nssm.exe](https://nssm.cc/) [present] | ||
* binary [rhsrvany.exe](https://github.com/rwmjones/rhsrvany) [optional] | ||
* `mkisofs` | ||
|
||
The service manager **NSSM** is the preferred tool to manage services because | ||
it handles long running services better and more correctly (srvany/rhsrvany | ||
fails to terminate its child processes on stop). NSSM is in public domain and | ||
the binary is part of this repo. There are both 32bit and 64bit versions - | ||
currently 32bit version is used because it covers broader set of systems. | ||
|
||
If you wish to use rhsrvany instead then you must set the shell variable | ||
`SRV_MANAGER` to `rhsrvany` otherwise it will default to `nssm`. | ||
|
||
On RHEL (CentOS) and Fedora systems, the required binary | ||
[rhsrvany.exe](https://github.com/rwmjones/rhsrvany) is distributed as part | ||
of the package `virt-v2v` and placed into `/usr/share/virt-tools/rhsrvany.exe`. | ||
Please copy the EXE into your local repository clone before creating the MSI. | ||
|
||
### Steps | ||
|
||
Script `generate.sh` builds the MSI package. It's a wrapper around | ||
the `wixl` command from `msitools`. It reads the `package.wxs`, a package | ||
definition in the WiX-like XML format. Package name or version can be | ||
overridden by env. variables `NAME` and `VERSION`. For example: | ||
|
||
``` | ||
$ TARGET=msi ./generate.sh | ||
$ NAME=one-context TARGET=msi ./generate.sh | ||
$ VERSION=1.0.0 TARGET=msi ./generate.sh | ||
``` | ||
|
||
New package is created as `${NAME}-${VERSION}.msi`, | ||
e.g. `one-context-1.0.0.msi` in the `out/` directory. | ||
|
||
You can also built both the iso and msi targets like this: | ||
|
||
``` | ||
$ ./generate-all.sh | ||
``` | ||
|
||
Or with a different service manager and explicit version: | ||
|
||
``` | ||
$ env SRV_MANAGER=rhsrvany VERSION=5.13 ./generate-all.sh | ||
``` | ||
|
||
Please ignore following assertion on package build, which is caused | ||
by skipping the attribute `Start` in tag `ServiceControl`. The parameter | ||
is optional in WiX specification, but the `msitools` still counts with it. | ||
Despite that, the package is built. | ||
|
||
``` | ||
(wixl:22764): wixl-CRITICAL **: wixl_wix_builder_install_mode_to_event: assertion 'modeString != NULL' failed | ||
``` | ||
|
||
## Acknowledgements | ||
|
||
This addon is largely based upon the work by André Monteiro and Tiago Batista in the [DETI/IEETA Universidade de Aveiro](http://www.ua.pt/). The original guide is available here: [OpenNebula - IEETA](http://wiki.ieeta.pt/wiki/index.php/OpenNebula) | ||
|
||
## License | ||
|
||
Copyright 2002-2021, OpenNebula Project, OpenNebula Systems (formerly C12G Labs) | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
not use this file except in compliance with the License. You may obtain | ||
a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
export DATE=$(date +%Y%m%d) | ||
TARGETS='msi iso' | ||
|
||
for TARGET in $TARGETS; do | ||
TARGET="${TARGET}" ./generate.sh | ||
done | ||
|
||
echo | ||
echo "The packages are here:" | ||
echo "--------------------------------------------------------------------------------" | ||
find out -type f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env bash | ||
|
||
# -------------------------------------------------------------------------- # | ||
# Copyright 2002-2021, OpenNebula Project, OpenNebula Systems # | ||
# # | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may # | ||
# not use this file except in compliance with the License. You may obtain # | ||
# a copy of the License at # | ||
# # | ||
# http://www.apache.org/licenses/LICENSE-2.0 # | ||
# # | ||
# Unless required by applicable law or agreed to in writing, software # | ||
# distributed under the License is distributed on an "AS IS" BASIS, # | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # | ||
# See the License for the specific language governing permissions and # | ||
# limitations under the License. # | ||
#--------------------------------------------------------------------------- # | ||
|
||
if [ -z "${TARGET}" ]; then | ||
echo 'Error: env. variable TARGET not set' >&2 | ||
exit 1 | ||
fi | ||
|
||
### | ||
|
||
if [ -z "${RELEASE}" ]; then | ||
if git describe --contains $(git rev-parse HEAD) &>/dev/null; then | ||
RELEASE=1 | ||
else | ||
DATE=${DATE:-$(date +%Y%m%d)} | ||
GIT=$(git rev-parse --short HEAD) | ||
RELEASE="${DATE}git${GIT}" | ||
fi | ||
fi | ||
|
||
### | ||
|
||
NAME=${NAME:-one-context} | ||
VERSION=${VERSION:-6.6.1} | ||
RELEASE=${RELEASE:-1} | ||
LABEL="${NAME}-${VERSION}" | ||
SRV_MANAGER="${SRV_MANAGER:-nssm}" | ||
|
||
if [ "${RELEASE}" = '1' ]; then | ||
FILENAME=${FILENAME:-${NAME}-${VERSION}.${TARGET}} | ||
else | ||
FILENAME=${FILENAME:-${NAME}-${VERSION}-${RELEASE}.${TARGET}} | ||
fi | ||
|
||
# cleanup | ||
if [ -z "${OUT}" ]; then | ||
OUT="out/${FILENAME}" | ||
mkdir -p $(dirname "${OUT}") | ||
rm -rf "${OUT}" | ||
fi | ||
|
||
set -e | ||
|
||
if [ "${TARGET}" = 'msi' ]; then | ||
case "${SRV_MANAGER}" in | ||
nssm) | ||
_SRV_BINARY_NAME='nssm.exe' | ||
_SRV_BINARY_FILE='nssm/win32/nssm.exe' | ||
_SRV_BINARY_ARGS='' | ||
;; | ||
rhsrvany) | ||
_SRV_BINARY_NAME='rhsrvany.exe' | ||
_SRV_BINARY_FILE='rhsrvany.exe' | ||
_SRV_BINARY_ARGS='-s onecontext' | ||
|
||
# in the rhsrvany case we might be able to use some os package | ||
if [ ! -f rhsrvany.exe ]; then | ||
if [ -f /usr/share/virt-tools/rhsrvany.exe ]; then | ||
cp /usr/share/virt-tools/rhsrvany.exe . | ||
fi | ||
fi | ||
;; | ||
esac | ||
|
||
if [ ! -f "${_SRV_BINARY_FILE}" ] ; then | ||
echo "Error: The service binary is missing: ${_SRV_BINARY_FILE}" | ||
exit 1 | ||
else | ||
echo "Info: Using the binary: ${_SRV_BINARY_FILE}" | ||
fi >&2 | ||
|
||
wixl -D Version="${VERSION}" \ | ||
-D SrvBinaryName="${_SRV_BINARY_NAME}" \ | ||
-D SrvBinaryFile="${_SRV_BINARY_FILE}" \ | ||
-D SrvBinaryArgs="${_SRV_BINARY_ARGS}" \ | ||
-o "${OUT}" package.wxs | ||
|
||
elif [ "${TARGET}" = 'iso' ]; then | ||
mkisofs -J -R -input-charset utf8 \ | ||
-m '*.iso' \ | ||
-V "${LABEL}" \ | ||
-o "${OUT}" \ | ||
$(dirname "${OUT}") | ||
|
||
else | ||
echo "Error: Invalid target '${TARGET}'" >&2 | ||
exit 1 | ||
fi | ||
|
||
echo $(basename ${OUT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nssm-2.24 |
Oops, something went wrong.