Skip to content
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

Dotnet 2 #28

Merged
merged 3 commits into from
Aug 12, 2024
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- uses: actions/setup-go@v4
with:
go-version: '>=1.17.0'
Expand Down
22 changes: 22 additions & 0 deletions examples/dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
start pulumi in dotnet

install dotnet,
install nuget,
install aspnet

in example directory:

```sh
nuget add ../../../sdk/dotnet/bin/Debug/Pulumi.Outscale.0.0.1-alpha.1712846498.nupkg -Source .
PATH=$PATH:$GOPATH/bin pulumi up # this one will fail because ak/sk and region not configured
pulumi config set outscale:secretKeyId <SECRET_KEY> --secret
pulumi config set outscale:region eu-west-2
pulumi config set outscale:accessKeyId <ACCESS_KEY>
PATH=$PATH:$GOPATH/bin pulumi up
```

Note for dotnet:
PublicIp field in PublicIp resource is replace by MyPublicIp.
Tag field in Tag resource is replace by MyTag.

This is due to name conflict in dotnet.
28 changes: 28 additions & 0 deletions examples/dotnet/user/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Pulumi;
using Pulumi.Outscale;

return await Deployment.RunAsync(() =>
{
var group = new Pulumi.Outscale.SecurityGroup("webserver-secgrp", new SecurityGroupArgs
{
Description = "test"
});

var userData = @"
#!/bin/bash
echo ""Hello, World!"" > index.html
nohup python -m SimpleHTTPServer 80 &
";

var server = new Pulumi.Outscale.Vm("webserver-www", new VmArgs
{
// t2.micro is available in the AWS free tier
VmType = "t2.micro",
SecurityGroupIds = new[] {
group.Id
}, // reference the security group resource above
UserData = userData,
ImageId = "ami-cd8d714e",
});

});
7 changes: 7 additions & 0 deletions examples/dotnet/user/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: user
runtime: dotnet
description: Outscale csharp example
config:
pulumi:tags:
value:
pulumi:template: ""
15 changes: 15 additions & 0 deletions examples/dotnet/user/user.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pulumi" Version="3.*" />
<PackageReference Include="Pulumi.Random" Version="4.*" />
<PackageReference Include="Pulumi.Outscale" Version="0.0.1-alpha.*" />
</ItemGroup>

</Project>
31 changes: 30 additions & 1 deletion local_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export OSC_ACCESS_KEY=11112211111110000000

export OSC_USING_RICOCHET="oui"

export ROOT=$PWD

function pulumi_up_dowm() {
set -eE

Expand Down Expand Up @@ -75,7 +77,7 @@ if [ "$#" -eq 0 ]; then
fi

echo "BUILD provider and build_python"
make provider build_python build_nodejs
make provider build_python build_nodejs build_dotnet

echo "pulumi login --local"
pulumi login --local
Expand All @@ -92,6 +94,31 @@ pulumi_setup_local

pulumi_up_dowm "yaml"

echo "../dotnet/"
cd ../dotnet/


cd user/

# without that I have dependencies errors.
rm -rvf ~/.nuget

set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e


#nuget add $PWD/../../../sdk/dotnet/bin/Debug/Pulumi.Outscale*.nupkg -Source .
dotnet nuget add source $ROOT/sdk/dotnet/bin/Debug/

pulumi_setup_local

pulumi_up_dowm "dotnet"

cd .. # user dotnet out

echo "../python/"
cd ../python/

Expand All @@ -102,6 +129,7 @@ cd user/
python -m venv venv
source venv/bin/activate

pip install setuptools
pip install pulumi_cloudinit
pip install $GOPATH/sdk/python/

Expand All @@ -125,6 +153,7 @@ cd ../hello/
python -m venv venv
source venv/bin/activate

pip install setuptools
pip install pulumi_cloudinit
pip install $GOPATH/sdk/python/

Expand Down
Loading