diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 31e896e..697280b 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "cake.tool": { - "version": "2.0.0", + "version": "4.1.0", "commands": [ "dotnet-cake" ] diff --git a/LICENSE.md b/LICENSE.md index 0ae1671..6083bd3 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 99designs +Copyright (c) 2015 ByteNess Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index d68f093..673d83d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![GitHub latest release](https://img.shields.io/github/release/gusztavvargadr/aws-vault-chocolatey.svg)](https://github.com/gusztavvargadr/aws-vault-chocolatey/releases/latest/) [![Chocolatey downloads](https://img.shields.io/chocolatey/dt/aws-vault.svg)](https://chocolatey.org/packages/aws-vault/) -This repository contains the source of the [Chocolatey package] for [AWS Vault] by [99designs]. +This repository contains the source of the [Chocolatey package] for [AWS Vault] by [ByteNess]. ### Overview @@ -15,5 +15,5 @@ This repository contains the source of the [Chocolatey package] for [AWS Vault] For more information please see [the original repository][AWS Vault]. [Chocolatey package]: https://chocolatey.org/packages/aws-vault/ -[AWS Vault]: https://github.com/99designs/aws-vault/ -[99designs]: https://99designs.com/ +[AWS Vault]: https://github.com/ByteNess/aws-vault/ +[ByteNess]: https://github.com/ByteNess/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7a4179d..72be92b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,3 +1,9 @@ +parameters: + - name: release + displayName: Release + type: boolean + default: false + trigger: branches: include: @@ -6,8 +12,8 @@ pr: none variables: - group: pipeline - - name: branch - value: $[ replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), 'refs/tags/', '') ] + - name: isReleaseEnabled + value: ${{ parameters.release }} stages: - stage: commit @@ -30,7 +36,7 @@ stages: - stage: release displayName: Release - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + condition: eq(variables.isReleaseEnabled, true) variables: - group: stage-release diff --git a/build.cake b/build.cake index 2f093b4..71b9c53 100644 --- a/build.cake +++ b/build.cake @@ -3,15 +3,7 @@ Task("Build") .IsDependentOn("Version") .Does(() => { - var settings = new DockerComposeRunSettings { - Entrypoint = "powershell -File ./build/docker/chef-client.cookbook.run.ps1", - Environment = new [] { - $"CHOCOLATEY_PROJECT_VERSION={projectVersion}", - $"CHOCOLATEY_PACKAGE_VERSION={packageVersion}" - } - }; - var service = "chef-client"; - DockerComposeRun(settings, service); + StartProcess("docker", $"compose run --env \"CHOCOLATEY_PROJECT_VERSION={projectVersion}\" --env \"CHOCOLATEY_PACKAGE_VERSION={packageVersion}\" --entrypoint \"powershell -File ./build/docker/chef-client.cookbook.run.ps1\" chef-client"); }); Task("Test") @@ -44,11 +36,7 @@ Task("Test") Task("Package") .IsDependentOn("Test") .Does(() => { - var settings = new DockerComposeRunSettings { - Entrypoint = "powershell -File ./build/docker/chocolatey.package.pack.ps1", - }; - var service = "chocolatey"; - DockerComposeRun(settings, service); + StartProcess("docker", $"compose run --entrypoint \"powershell -File ./build/docker/chocolatey.package.pack.ps1\" chocolatey"); }); Task("Publish") diff --git a/build/azp/azure-pipelines.build.yml b/build/azp/azure-pipelines.build.yml index bb61ed3..c7a0eea 100644 --- a/build/azp/azure-pipelines.build.yml +++ b/build/azp/azure-pipelines.build.yml @@ -5,7 +5,7 @@ jobs: pool: name: Default demands: - - VSTS_AGENT_CAP_OS -equals windows + - Agent.OS -equals Windows_NT workspace: clean: all diff --git a/build/azp/azure-pipelines.core.yml b/build/azp/azure-pipelines.core.yml index 71a7b3f..dc2ac79 100644 --- a/build/azp/azure-pipelines.core.yml +++ b/build/azp/azure-pipelines.core.yml @@ -2,10 +2,6 @@ steps: - checkout: self submodules: recursive - - script: | - git checkout $(branch) - displayName: Init Git - - script: | dotnet --info diff --git a/build/azp/azure-pipelines.deploy.yml b/build/azp/azure-pipelines.deploy.yml index 878a55a..d444a0b 100644 --- a/build/azp/azure-pipelines.deploy.yml +++ b/build/azp/azure-pipelines.deploy.yml @@ -5,7 +5,7 @@ jobs: pool: name: Default demands: - - VSTS_AGENT_CAP_OS -equals windows + - Agent.OS -equals Windows_NT workspace: clean: all diff --git a/build/cake/core.cake b/build/cake/core.cake index 64994b1..9f1f307 100644 --- a/build/cake/core.cake +++ b/build/cake/core.cake @@ -1,12 +1,7 @@ -#addin nuget:?package=Cake.Docker&version=1.1.2 -#addin nuget:?package=Cake.SemVer&version=4.0.0 -#addin nuget:?package=semver&version=2.0.4 - var target = Argument("target", "Publish"); var packageName = "aws-vault"; -var sourceVersion = Argument("source-version", "7.2.0"); -Semver.SemVersion sourceSemVer; +var sourceVersion = Argument("source-version", "7.5.0"); var buildVersion = Argument("build-version", string.Empty); var projectVersion = Argument("project-version", string.Empty); var packageVersion = Argument("package-version", string.Empty); @@ -16,7 +11,7 @@ var chocolateyServer = EnvironmentVariable("CHOCOLATEY_SERVER", string.Empty); Task("Init") .Does(() => { StartProcess("docker", "--version"); - StartProcess("docker-compose", "--version"); + StartProcess("docker", "compose version"); StartProcess("docker", "system df"); StartProcess("docker", "container ls -a"); @@ -26,57 +21,22 @@ Task("Init") Task("Restore") .IsDependentOn("Init") .Does(() => { - var settings = new DockerComposeBuildSettings { - }; - var services = new [] { "chef-client", "chocolatey" }; - if (string.IsNullOrEmpty(sourceVersion)) { - services = (new [] { "gitversion" }).Concat(services).ToArray(); - } - DockerComposeBuild(settings, services); + StartProcess("docker", "compose build chef-client chocolatey"); }); Task("Version") .IsDependentOn("Restore") .Does((context) => { - if (string.IsNullOrEmpty(sourceVersion)) { - { - var settings = new DockerComposeUpSettings { - }; - var services = new [] { "gitversion" }; - DockerComposeUp(settings, services); - } - - { - var runner = new GenericDockerComposeRunner( - context.FileSystem, - context.Environment, - context.ProcessRunner, - context.Tools - ); - var settings = new DockerComposeLogsSettings { - NoColor = true - }; - var service = "gitversion"; - var output = runner.RunWithResult( - "logs", - settings, - (items) => items.Where(item => item.Contains('|')).ToArray(), - service - ).Last(); - - sourceVersion = output.Split('|')[1].Trim(); - } - } Information($"Source version: '{sourceVersion}'."); - sourceSemVer = ParseSemVer(sourceVersion); if (string.IsNullOrEmpty(buildVersion)) { buildVersion = $"{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}"; } Information($"Build version: '{buildVersion}'."); - if (string.IsNullOrEmpty(projectVersion)) { - projectVersion = new Semver.SemVersion(sourceSemVer.Major, sourceSemVer.Minor, sourceSemVer.Patch).ToString(); + if (string.IsNullOrEmpty(projectVersion)) + { + projectVersion = sourceVersion; } Information($"Project version: '{projectVersion}'."); @@ -91,11 +51,7 @@ Task("Clean") .Does(() => { StartProcess("docker", "container prune -f"); - var settings = new DockerComposeDownSettings { - Rmi = "local", - Volumes = true, - }; - DockerComposeDown(settings); + StartProcess("docker", "compose down --rmi local --volumes"); StartProcess("docker", "image prune -f"); StartProcess("docker", "builder prune -af"); diff --git a/build/docker/chef-client.Dockerfile b/build/docker/chef-client.Dockerfile index 7b13630..613d115 100644 --- a/build/docker/chef-client.Dockerfile +++ b/build/docker/chef-client.Dockerfile @@ -1 +1 @@ -FROM gusztavvargadr/chef-client:latest +FROM gusztavvargadr/chef-client:windows-servercore-ltsc2022 diff --git a/build/docker/chocolatey.Dockerfile b/build/docker/chocolatey.Dockerfile index 7c3eb36..a80b236 100644 --- a/build/docker/chocolatey.Dockerfile +++ b/build/docker/chocolatey.Dockerfile @@ -1,3 +1,3 @@ -FROM gusztavvargadr/chef-core:latest +FROM gusztavvargadr/chef-core:windows-servercore-ltsc2022 WORKDIR C:/opt/docker/work/ diff --git a/build/docker/gitversion.Dockerfile b/build/docker/gitversion.Dockerfile deleted file mode 100644 index 8054247..0000000 --- a/build/docker/gitversion.Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 - -USER ContainerAdministrator - -WORKDIR C:/opt/docker/work/ - -RUN dotnet tool install --global --version 5.12.0 gitversion.tool - -ENTRYPOINT %USERPROFILE%\.dotnet\tools\dotnet-gitversion.exe diff --git a/deploy.cake b/deploy.cake index 3afaf21..1d986e1 100644 --- a/deploy.cake +++ b/deploy.cake @@ -8,14 +8,7 @@ Task("Build") Task("Test") .IsDependentOn("Build") .Does(() => { - { - var settings = new DockerComposeRunSettings { - Entrypoint = "powershell -File ./build/docker/chocolatey.package.install.ps1", - }; - var service = "chocolatey"; - var command = $"{packageVersion}"; - DockerComposeRun(settings, service, command); - } + StartProcess("docker", $"compose run --entrypoint \"powershell -File ./build/docker/chocolatey.package.install.ps1\" chocolatey {packageVersion}"); }); Task("Package") @@ -30,12 +23,7 @@ Task("Publish") return; } - var settings = new DockerComposeRunSettings { - Entrypoint = "powershell -File ./build/docker/chocolatey.package.push.ps1", - }; - var service = "chocolatey"; - var command = $"{packageVersion}"; - DockerComposeRun(settings, service, command); + StartProcess("docker", $"compose run --entrypoint \"powershell -File ./build/docker/chocolatey.package.push.ps1\" chocolatey {packageVersion}"); }); RunTarget(target); diff --git a/docker-compose.yml b/docker-compose.yml index 81a5282..b1f1417 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,4 @@ -version: "3" - services: - gitversion: - build: - context: ./build/docker/ - dockerfile: ./gitversion.Dockerfile - - volumes: - - ${REPO_DIR}:C:/opt/docker/work/ - - command: /showvariable NuGetVersionV2 - chef-client: build: context: ./build/docker/ diff --git a/src/chef/cookbooks/chocolatey-package/attributes/default.rb b/src/chef/cookbooks/chocolatey-package/attributes/default.rb index 3f7ddee..c3376e2 100644 --- a/src/chef/cookbooks/chocolatey-package/attributes/default.rb +++ b/src/chef/cookbooks/chocolatey-package/attributes/default.rb @@ -1,7 +1,7 @@ default['chocolatey-package'] = { 'id' => 'aws-vault', 'title' => 'AWS Vault', - 'project-source-url' => 'https://github.com/99designs/aws-vault/', + 'project-source-url' => 'https://github.com/ByteNess/aws-vault/', 'project-version' => ENV['CHOCOLATEY_PROJECT_VERSION'], 'package-source-url' => 'https://github.com/gusztavvargadr/aws-vault-chocolatey/', 'package-version' => ENV['CHOCOLATEY_PACKAGE_VERSION'], diff --git a/src/chef/cookbooks/chocolatey-package/recipes/default.rb b/src/chef/cookbooks/chocolatey-package/recipes/default.rb index fbd7934..277c46a 100644 --- a/src/chef/cookbooks/chocolatey-package/recipes/default.rb +++ b/src/chef/cookbooks/chocolatey-package/recipes/default.rb @@ -6,7 +6,7 @@ package_version = node['chocolatey-package']['package-version'] directory_path = "#{node['chocolatey-package']['directory-path']}#{id}/" -project_download_url = "#{project_source_url}releases/download/v#{project_version}/#{id}-windows-386.exe" +project_download_url = "#{project_source_url}releases/download/v#{project_version}/#{id}-windows-amd64.exe" project_download_path = "#{directory_path}tools/#{id}.exe" project_download_hash_md5 = '' project_download_hash_sha256 = '' diff --git a/src/chef/cookbooks/chocolatey-package/templates/chocolatey-package.nuspec.erb b/src/chef/cookbooks/chocolatey-package/templates/chocolatey-package.nuspec.erb index 9edae8b..e822387 100644 --- a/src/chef/cookbooks/chocolatey-package/templates/chocolatey-package.nuspec.erb +++ b/src/chef/cookbooks/chocolatey-package/templates/chocolatey-package.nuspec.erb @@ -6,16 +6,16 @@ <%= @package_source_url %> Gusztav Varga <%= @title %> - 99designs - https://99designs.com.au/tech-blog/blog/2015/10/26/aws-vault/ - https://99designs.com/og-image.png - 2015 99designs + ByteNess + <%= @package_source_url %> + https://avatars.githubusercontent.com/u/212586818 + 2015 ByteNess <%= @project_license_url %> true <%= @project_source_url %> <%= @project_source_url %>blob/v<%= @project_version %>/README.md <%= @project_source_url %>issues/ - aws-vault 99designs aws + aws-vault ByteNess aws A tool to securely store and access AWS credentials in a development environment AWS Vault is a tool to securely store and access AWS credentials in a development environment. diff --git a/src/chef/cookbooks/chocolatey-package/templates/tools.LICENSE.txt.erb b/src/chef/cookbooks/chocolatey-package/templates/tools.LICENSE.txt.erb index 40a1f56..a68df6d 100644 --- a/src/chef/cookbooks/chocolatey-package/templates/tools.LICENSE.txt.erb +++ b/src/chef/cookbooks/chocolatey-package/templates/tools.LICENSE.txt.erb @@ -5,7 +5,7 @@ LICENSE The MIT License (MIT) -Copyright (c) 2015 99designs +Copyright (c) 2015 ByteNess Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal