Skip to content

Commit

Permalink
Fix .NET RHEL test deploy script (#939)
Browse files Browse the repository at this point in the history
* fix: Use centos 7 install for AL2

* chore: Add AL2 dotnet nonreg test
  • Loading branch information
rthorn-nr authored Jun 23, 2023
1 parent 7be5e6c commit 032a4a2
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 26 deletions.
59 changes: 59 additions & 0 deletions test/definitions/apm/dotNet/linux/linux2-aspnetcore5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"global_tags": {
"owning_team": "virtuoso",
"Environment": "development",
"Department": "product",
"Product": "virtuoso"
},
"resources": [
{
"id": "linux2host1",
"provider": "aws",
"type": "ec2",
"size": "t3.micro",
"ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2",
"user_name": "ec2-user"
}
],
"services": [
{
"id": "aspnetcore",
"destinations": [
"linux2host1"
],
"source_repository": "https://github.com/newrelic/open-install-library.git",
"deploy_script_path": "test/deploy/linux/dotNet/install/rhel/roles",
"port": 9999
},
{
"id": "apache1",
"destinations": [
"linux2host1"
],
"source_repository": "https://github.com/newrelic/open-install-library.git",
"deploy_script_path": "test/deploy/linux/apache/install/rhel/roles",
"port": 80
},
{
"id": "dotnet1",
"destinations": [
"linux2host1"
],
"source_repository": "https://github.com/newrelic/open-install-library.git",
"deploy_script_path": "test/deploy/linux/apache/deploy-application/dotNet/rhel/roles",
"port": 8080,
"params": {
"is_selfcontained": "true"
}
},
{
"id": "dotnet2",
"destinations": [
"linux2host1"
],
"source_repository": "https://github.com/newrelic/open-install-library.git",
"deploy_script_path": "test/deploy/linux/apache/deploy-application/dotNet/rhel/roles",
"port": 8081
}
]
}
34 changes: 9 additions & 25 deletions test/deploy/linux/dotNet/install/rhel/roles/prepare/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,16 @@
- debug:
msg: Install .NET

- name: Set default .NET version to install
set_fact:
dotnet_version: "5.0"
when: dotnet_version is undefined
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-centos#centos-linux-7

- name: Install .NET SDK (defaults to false)
set_fact:
install_sdk: "false"
when: install_sdk is undefined

- name: Download and prepare install script
shell: |
curl https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh -o ~/dotnet-install.sh
chmod 777 ~/dotnet-install.sh
become: true

- name: Install ASP.NET Core {{ dotnet_version }} Runtime
shell: ~/dotnet-install.sh -c {{ dotnet_version }} --runtime aspnetcore --install-dir /opt/dotnet
when: install_sdk|bool == False
become: true

- name: Install .NET {{ dotnet_version }} SDK
shell: ~/dotnet-install.sh -c {{ dotnet_version }} --install-dir /opt/dotnet
when: install_sdk|bool
- name: Install Centos 7 RPM
ansible.builtin.shell: rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
become: true

- name: Setup .NET path
shell: ln /opt/dotnet/dotnet /usr/local/bin/dotnet
- name: Install .NET SDK 7.0 and ASP.NET Core 7.0 runtime
ansible.builtin.yum:
name:
- dotnet-sdk-7.0
- aspnetcore-runtime-7.0
state: latest
become: true
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@
"port": 8081
}
]
}
}

0 comments on commit 032a4a2

Please sign in to comment.