How to use aws_account parameter from CircleCI in Github Actions - github-actions

I have this section in one of my CircleCI jobs:
parameters:
aws_account:
type: string
default: '111111111111'
folder:
default: ''
description: The folder the changes will be deployed in
type: string
stack:
default: int
description: Sets the stack the deployment triggers.
type: string
I'm wondering how to move this over to Github Actions because neither parameters or even aws_account on its own is an allowed property for gh actions.

Related

Porting a cloudformation template to terraform

I am following a direction on Hashicorp's site regarding wrapping a CF Template in Terraform. There's a fair amount to the whole code, but the CF Template works, so the issue is with the "wrapping"...
Terraform plan gives me this error output:
terraform plan
Error: aws_cloudformation_stack.Momma: "template_body" contains an invalid JSON: invalid character 'A' looking for beginning of object key string
Error: aws_cloudformation_stack.Momma: : invalid or unknown key: source
So it seems that the "AWSTemplateFormatVersion" line is what it does not like. Hence the'A' it is picking up, I guess.
This is the Hashicorp page I am following, I'm wondering if there are any escape characters that are appropriate or, if anyone can see any immediate formatting issues with my JSON?
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack
terraform {}
provider "aws" {
version = "= 2.61"
region = "ap-southeast-2"
}
resource "aws_cloudformation_stack" "Momma" {
source = "../../aws_modules/aws-db-event-subscription"
name = "Momma-Stack"
template_body = <<STACK
{
AWSTemplateFormatVersion: 2010-09-09
Description: Team Server
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: Deployment Options
Parameters:
- Environment
- KeyPairName
- VPCID
- Subnet1ID
- RemoteAccessCIDR
- Owner
ParameterLabels:
KeyPairName:
Default: Key Pair Name
RemoteAccessCIDR:
Default: External Access CIDR
VPCID:
Default: VPC ID
Owner:
Default: MommaTeam....
Thank you for any guidance offered.
There are at least two issues that are apparent:
source = "../../aws_modules/aws-db-event-subscription" is invalid. There is no attribute called source in aws_cloudformation_stack. You can remove it.
Your template_body should not begin with { in:
template_body = <<STACK
{
This is because you are using YAML for your template, not JSON.

How to create outputs on GitHub actions from bash scripts?

I have a GitHub action that essentially is a bash script. The javascript portion of my action executes a bash script:
const core = require("#actions/core");
const exec = require("#actions/exec");
async function run() {
try {
// Execute bash script
await exec.exec(`${__dirname}/my-action-script.sh`);
} catch (error) {
core.setFailed(error.message);
}
}
run();
For now, this action will communicate with other actions by leaving files on the file system. This is an "invisible" way of communication and I would like to fill my action.yml with outputs. How can I enable my-action-script.sh to return me outputs defined in my action.yml?
the output must first be added to the action.yml, ex:
name: some GitHub workflow yaml file
description: some workflow description
runs:
using: node12
main: dist/index.js
inputs:
some_input:
description: some input
required: false
outputs:
some_output:
description: some output
and create the output from the bash script, ex:
echo ::set-output name=some_output::"$SOME_OUTPUT"
then you can use it in your workflow yaml, ex:
${{ steps.<step id>.outputs.some_output }}
Not totally clear if this is an action in a repo, or something you want to publish to the marketplace. At any rate, creating the output is done in the same way as indicated by the other answer, although you can run directly the shell if you use:
name: some GitHub workflow yaml file
description: some workflow description
runs:
using: composite
main: my-action-script.sh
inputs:
some_input:
description: some input
required: false
outputs:
some_output:
description: some output
See this article on creating this kind of actions

Google payments, unexpected error for in-app purchase for Chrome Extension

I am developing a Chrome Extension and I would like to allow users to make in-app purchases.
My extension is already deployed on Chrome store and the "in-app" purchase will be available on the new version (The one I am working on).
Well, I am struggling with the purchase: The Google Payment page shows up but I want to purchase the option, I receive a "unexpected error" and no way to get more details about this error. :-(
Error I got when purchasing
What I've done so far:
https://developer.chrome.com/webstore/payments-iap
I've imported the buy.js and implemented all the needed functions.
I've set up a Google Merchant payment account (and even validated my account after receiving small amount of money sent by Google)
I've no idea of what's wrong... It seems it's really the very last part of the payment flow that fails, but no way to get more info about what's going on.
I've even activated Chrome debug logs but the data is not very useful (at least for me...)
Log covering the flow from the "Purchase button click", "Buy" button click, Error, and closing the window here:
[6668:6168:0112/001148:VERBOSE1:cross_device_promo.cc(180)] CrossDevicePromo::MaybeBrowsingSessionStarted; Ineligible for promo.
[6668:6168:0112/001148:VERBOSE1:cross_device_promo.cc(180)] CrossDevicePromo::MaybeBrowsingSessionStarted; Ineligible for promo.
[6668:6168:0112/001150:VERBOSE1:mutable_profile_oauth2_token_service_delegate.cc(216)] MutablePO2TS::RefreshTokenIsAvailable
[6624:7432:0112/001150:VERBOSE1:script_context.cc(111)] Created context:
extension id: nmmhkkegccagdldgiimedpiccmgmieda
frame: 5A2F7394
URL:
context_type: BLESSED_EXTENSION
effective extension id: nmmhkkegccagdldgiimedpiccmgmieda
effective context type: BLESSED_EXTENSION
[6624:7432:0112/001150:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 00000000
URL:
context_type: UNSPECIFIED
effective extension id: (none)
effective context type: UNSPECIFIED
[6624:7432:0112/001150:VERBOSE1:dispatcher.cc(395)] Num tracked contexts: 2
[2160:3460:0112/001150:VERBOSE1:gles2_cmd_decoder.cc(3205)] GL_OES_packed_depth_stencil supported.
[6624:7432:0112/001150:VERBOSE1:htmlpluginelement.cpp(514)] OBJECT id="browser-plugin-8" style="width: 100%; height: 100%;" Plugin URL: <null>
[6624:7432:0112/001150:VERBOSE1:htmlpluginelement.cpp(515)] Loaded URL: <null>
[2160:3460:0112/001150:VERBOSE1:gles2_cmd_decoder.cc(3205)] GL_OES_packed_depth_stencil supported.
[8032:536:0112/001150:INFO:systeminfo.cc(82)] Available number of cores: 4
[2160:3460:0112/001150:VERBOSE1:gles2_cmd_decoder.cc(3205)] GL_OES_packed_depth_stencil supported.
[2160:3460:0112/001150:VERBOSE1:gles2_cmd_decoder.cc(3205)] GL_OES_packed_depth_stencil supported.
[8032:536:0112/001150:VERBOSE1:script_context.cc(111)] Created context:
extension id: nmmhkkegccagdldgiimedpiccmgmieda
frame: 2CE619DC
URL:
context_type: CONTENT_SCRIPT
effective extension id: nmmhkkegccagdldgiimedpiccmgmieda
effective context type: CONTENT_SCRIPT
[8032:536:0112/001150:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 00000000
URL:
context_type: UNSPECIFIED
effective extension id: (none)
effective context type: UNSPECIFIED
[8032:536:0112/001150:VERBOSE1:dispatcher.cc(395)] Num tracked contexts: 1
[8032:536:0112/001150:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 2CE619DC
URL:
context_type: WEB_PAGE
effective extension id: (none)
effective context type: WEB_PAGE
[8032:536:0112/001150:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 00000000
URL:
context_type: UNSPECIFIED
effective extension id: (none)
effective context type: UNSPECIFIED
[8032:536:0112/001150:VERBOSE1:dispatcher.cc(395)] Num tracked contexts: 2
[6668:6168:0112/001150:INFO:CONSOLE(325)] "did exec once", source: chrome-extension://nmmhkkegccagdldgiimedpiccmgmieda/craw_window.js (325)
[6668:6168:0112/001151:INFO:CONSOLE(176)] "[object XMLHttpRequest]", source: chrome-extension://nmmhkkegccagdldgiimedpiccmgmieda/craw_window.js (176)
[6668:6168:0112/001151:INFO:CONSOLE(1)] "registered payment listener: 1484140311054", source: https://www.google.com/intl/en-US/chrome/blank.html (1)
[6668:6168:0112/001151:INFO:CONSOLE(1)] "finished loading, start payment: 1484140311057", source: https://www.google.com/intl/en-US/chrome/blank.html (1)
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[6668:6168:0112/001151:VERBOSE1:render_process_host_impl.cc(2402)] Blocked URL about:blank
[8032:536:0112/001151:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 2CE66704
URL:
context_type: WEB_PAGE
effective extension id: (none)
effective context type: WEB_PAGE
[8032:536:0112/001151:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 00000000
URL:
context_type: UNSPECIFIED
effective extension id: (none)
effective context type: UNSPECIFIED
[8032:536:0112/001151:VERBOSE1:dispatcher.cc(395)] Num tracked contexts: 3
[2160:3460:0112/001151:VERBOSE1:gles2_cmd_decoder.cc(3205)] GL_OES_packed_depth_stencil supported.
[6668:8968:0112/001151:VERBOSE1:mime_sniffing_resource_handler.cc(351)] To buffer: https://payments.google.com/payments/jslogs?message=1484140311084-hz693q2xx3xx-INFO-embedder%3Ano_id%3Aloading%20iframe%20with%20URL%20https%3A%2F%2Fpayments.google.com%2Fpayments%2Foauth%2Fembedded%2Fbuy_flow%3Fwst%3D1489999999999%26cst%3D1484140311072%26ipi%3Dhz693q2xx3xx%26hostOrigin%3DaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbQ..%26mm%3De%26style%3Dpc%253D%2523FF0000%253Bac%253D%25230000FF%26ait%3DGAIA%26cn%3D%2524p_kpocjpn7rrfr0-%5Bhttps%3A%2F%2Fwww.google.com%2Fintl%2Fen-US%2Fchrome%2Fblank.html%5D&zx=nm2hae7wm29o
[8032:536:0112/001151:VERBOSE1:dispatcher.cc(534)] Num tracked contexts: 2
[8032:536:0112/001151:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 2CE66704
URL:
context_type: WEB_PAGE
effective extension id: (none)
effective context type: WEB_PAGE
[8032:536:0112/001151:VERBOSE1:script_context.cc(111)] Created context:
extension id: (none)
frame: 00000000
URL:
context_type: UNSPECIFIED
effective extension id: (none)
effective context type: UNSPECIFIED
[8032:536:0112/001151:VERBOSE1:dispatcher.cc(395)] Num tracked contexts: 3
[8032:536:0112/001151:VERBOSE1:script_context.cc(120)] Destroyed context for extension
extension id:
effective extension id:
[8032:536:0112/001151:VERBOSE1:script_context.cc(120)] Destroyed context for extension
extension id:
effective extension id:
[6668:6168:0112/001153:INFO:CONSOLE(326)] "[object MessageEvent]", source: chrome-extension://nmmhkkegccagdldgiimedpiccmgmieda/craw_window.js (326)
[6668:6168:0112/001153:INFO:CONSOLE(326)] "[object MessageEvent]", source: chrome-extension://nmmhkkegccagdldgiimedpiccmgmieda/craw_window.js (326)
[6668:8968:0112/001153:VERBOSE1:mime_sniffing_resource_handler.cc(351)] To buffer: https://payments.google.com/payments/jslogs?message=1484140313421-hz693q2xx3xx-INFO-embedded%3Ano_id%3Aiframe%20ready%20message%20sent-%5Bhttps%3A%2F%2Fpayments.google.com%2Fpayments%2Foauth%2Fembedded%2Fbuy_flow%3Fwst%3D1489999999999%26cst%3D1484140311072%26ipi%3Dhz693q2xx3xx%26hostOrigin%3DaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbQ..%26mm%3De%26style%3Dpc%253D%2523FF0000%253Bac%253D%25230000FF%26ait%3DGAIA%26cn%3D%2524p_kpocjpn7rrfr0%5D&zx=3wrtmrrm4ztl
[6668:6168:0112/001153:INFO:CONSOLE(326)] "[object MessageEvent]", source: chrome-extension://nmmhkkegccagdldgiimedpiccmgmieda/craw_window.js (326)
[6668:8968:0112/001153:VERBOSE1:mime_sniffing_resource_handler.cc(351)] To buffer: https://payments.google.com/payments/jslogs?message=1484140313437-hz693q2xx3xx-INFO-embedder%3Ano_id%3Aiframe%20with%20URL%20https%3A%2F%2Fpayments.google.com%2Fpayments%2Foauth%2Fembedded%2Fbuy_flow%3Fwst%3D1489999999999%26cst%3D1484140311072%26ipi%3Dhz693q2xx3xx%26hostOrigin%3DaHR0cHM6Ly93d3cuZ29vZ2xlLmNvbQ..%26mm%3De%26style%3Dpc%253D%2523FF0000%253Bac%253D%25230000FF%26ait%3DGAIA%26cn%3D%2524p_kpocjpn7rrfr0%20is%20ready-%5Bhttps%3A%2F%2Fwww.google.com%2Fintl%2Fen-US%2Fchrome%2Fblank.html%5D&zx=r8gnj6edd97y
[8032:536:0112/001154:VERBOSE1:htmlpluginelement.cpp(514)] EMBED Plugin URL: "https://clients2.google.com/gr/GrDataFetcher.swf"
[8032:536:0112/001154:VERBOSE1:htmlpluginelement.cpp(515)] Loaded URL: "https://clients2.google.com/gr/GrDataFetcher.swf"
[6668:6168:0112/001156:INFO:CONSOLE(326)] "[object MessageEvent]", source: chrome-extension://nmmhkkegccagdldgiimedpiccmgmieda/craw_window.js (326)
[6668:6168:0112/001158:VERBOSE1:cross_device_promo.cc(180)] CrossDevicePromo::MaybeBrowsingSessionStarted; Ineligible for promo.
[6668:6168:0112/001158:VERBOSE1:cross_device_promo.cc(180)] CrossDevicePromo::MaybeBrowsingSessionStarted; Ineligible for promo.
[6668:6168:0112/001158:INFO:CONSOLE(52)] "onPurchaseFailed", source: chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/scripts/buy.js (52)
[6668:6168:0112/001158:INFO:CONSOLE(59)] "Purchase failed. PURCHASE_CANCELED", source: chrome-extension://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/scripts/buy.js (59)
[6624:7432:0112/001158:VERBOSE1:dispatcher.cc(534)] Num tracked contexts: 1
[6624:7432:0112/001158:VERBOSE1:script_context.cc(120)] Destroyed context for extension
extension id: nmmhkkegccagdldgiimedpiccmgmieda
effective extension id: nmmhkkegccagdldgiimedpiccmgmieda
[6624:7432:0112/001158:VERBOSE1:script_context.cc(120)] Destroyed context for extension
extension id:
effective extension id:
(I've changed some ids in the code to get rid of potential personal infos)
Do you have any clue what could be the problem? Any way to get more details about "backend" treatment that fails? Is there a more comprehensive documentation about what to configure and what to check?
Thanks in advance !
Finally, I think I understand what was the issue... A developer can't buy his own in-app stuff...
I had to create a new Google account and try with this one... That worked just fine...

Google Deployment Manager - Forwarding Rule (Error)

Help here would be much appreciated, this is something I have been struggling with for awhile. I am trying to deploy a VPN using the Google Deployment Manager. From what I understand I need the following:
VpnTargetGateway
ForwardingRules
VpnTunnels
ReservedIP
I am having trouble with the ForwardingRules. This is where I specify my already created reserved IP address and assign it to my target gateway. Here is my code:
resources:
- name: vmx-forwarding-rules
type: compute.v1.forwardingRule
properties:
region: us-central1
IPAddress: https://www.googleapis.com/compute/v1/projects/{{env["project"] }/regions/us-central1/addresses/vmx-ip
IPProtocol: "ESP"
target: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }/regions/us-central1/targetVpnGateways/vmx-vpn-gateway
Here is the error I receive:
message: u"Unexpected response from resource of type compute.v1.forwardingRule: 400 {statusMessage=Bad Request, errors=[{message=Invalid value for field 'resource': ''. A reserved IP should be specified for forwarding rule with target type TARGET_VPN_GATEWAY, domain=global, reason=invalid}]}">]>
Does anyone have any experience with this or know a better location to find help for Deployment Manager?
Thanks
Try this in your YAML configuration:
resources:
- name: vmx-ip
type: compute.v1.address
properties:
region: us-central1
- name: vmx-forwarding-rules
type: compute.v1.forwardingRule
properties:
region: us-central1
IPAddress: $(ref.vmx-ip.address)
IPProtocol: "ESP"
target: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/regions/us-central1/targetVpnGateways/vmx-vpn-gateway

Swagger UI 2.1 Stuck "fetching resource list"

I have a RESTful API that I have created recently and I won't remember how to use it in a few months. I decided to document my API using Swagger, however I'm going crazy.
I used http://editor.swagger.io/ to create the YAML file that I then convert into a JSON file Swagger can use. When I put file into Swagger UI it just gets stuck at fetching resource list: localhost/swagger.json and the console says Uncaught TypeError: Cannot read property '$ref' of undefined .
I'm using version 2.1.0-alpha.5 of Swagger UI.
Here is my spec file:
swagger: '2.0'
info:
title: TITLE
description: BLAH, BLAH, BLAH, ETC
version: "1.0b"
host: api.example.com
schemes:
- http
basePath: /v1
produces:
- application/json
paths:
/match.json:
get:
#summary: Match Data
description: Used for getting data about a match
parameters:
- name: id
in: query
description: The match ID of from a game
required: true
type: integer
format: int32
- name: key
in: query
description: API key used for authentication.
required: true
type: string
responses:
200:
description: Returns match data
schema:
type: array
items:
$ref: '#/definitions/MatchData'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'
definitions:
MatchData:
properties:
info:
type: integer
format: int64
description: General information about the match
time:
type: integer
format: int64
description: Information about the start/end time
stats:
type: array
format: int64
description: Stats about the match
Error:
required:
- errorID
- message
properties:
errorID:
type: string
description: Error ID.
message:
type: string
description: Information about the error.
I've tested your spec, and while I'm not getting the same error you do, the spec is indeed invalid.
If you look at #/definitions/MatchData/properties/stats, you'll see that you define the type: array but you don't provide an 'items' property next to it to say which array it is (and that's mandatory). You may have intended to use type: integer like the properties above it, which goes along with the format: int64.
Since I don't know what you intended to provide, it's difficult to give an accurate solution, but if you add a comment with what you intended to do, I could provide a more detailed answer.
Upon some additional testing, I discovered that there's a bug in the UI. After you make that modification and the spec loads, the operation itself will not expand unless you click on the Expand Operations link. I've opened an issue about it, feel free to follow it there.
This problem can be due to some indentation errors in the yaml file which actually did not show up in the Swagger editor. Check all your definitions and whether they are getting displayed as expected in the preview that you can see in Swagger editor (especially check MatchData).
You can also try giving:
responses:
200:
description: Returns match data
schema:
type: array
items:
schema:
$ref: '#/definitions/MatchData'
For our case, we used Swagger-php and we have:
* #SWG\Response(
* response=200,
* description="app response"
* #SWG\Schema(
* type="array"
* )
* ),
but we missed " * #SWG\Items(ref="#/definitions/pet")". After removing "#SWG\Schema(", it works e.g.
* #SWG\Response(
* response=200,
* description="app response"
* ),