Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit 857a869

Browse files
author
Radu Dobrinescu
committed
added actions
1 parent 1fcf11e commit 857a869

File tree

15 files changed

+293
-0
lines changed

15 files changed

+293
-0
lines changed

partners/actions/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# github-actions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM golang:1.13
2+
3+
LABEL "name"="create dummy image"
4+
LABEL "version"="1.0"
5+
6+
COPY marketplace_image.json /marketplace_image.json
7+
COPY entrypoint.sh /entrypoint.sh
8+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
apt-get update
3+
apt install -y jq unzip
4+
5+
#Installing Packer
6+
export VER="1.4.4"
7+
wget -q https://releases.hashicorp.com/packer/${VER}/packer_${VER}_linux_amd64.zip
8+
unzip packer_${VER}_linux_amd64.zip -d /usr/bin
9+
10+
#Set up environment
11+
echo "${TF_VAR_private_key}" > ${GITHUB_WORKSPACE}/oci.pem
12+
export TF_VAR_private_key_path=${GITHUB_WORKSPACE}/oci.pem
13+
14+
#Replace values with credentials for tenancy where image is being built
15+
echo "Use Packer to create OCI image with cleanup-script"
16+
jq '.builders[].user_ocid |= "'$TF_VAR_user_ocid'" |
17+
.builders[].tenancy_ocid |= "'$TF_VAR_tenancy_ocid'" |
18+
.builders[].fingerprint |= "'$TF_VAR_fingerprint'" |
19+
.builders[].key_file |= "'$TF_VAR_private_key_path'" |
20+
.builders[].compartment_ocid |= "'$TF_VAR_compartment_ocid'" |
21+
.builders[].image_name |= "'$(echo $GITHUB_REPOSITORY |cut -d'/' -f 2).$(date +"%Y%m%d_%H%M%S")'"' /marketplace_image.json > dummy_image.json
22+
packer build dummy_image.json
23+
cat manifest.json | jq -r .builds[0].artifact_id | cut -d':' -f2 > ${GITHUB_WORKSPACE}/ocid.txt
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
3+
"variables": {
4+
},
5+
"builders":[
6+
{
7+
"user_ocid": "user_ocid_placeholder",
8+
"tenancy_ocid": "tenancy_ocid_placeholder",
9+
"fingerprint": "fingerprint_placeholder",
10+
"key_file": "key_file_placeholder",
11+
"compartment_ocid": "compartment_ocid_placeholder",
12+
"availability_domain": "IYfK:US-ASHBURN-AD-1",
13+
"base_image_ocid": "ocid1.image.oc1.iad.aaaaaaaavxqdkuyamlnrdo3q7qa7q3tsd6vnyrxjy3nmdbpv7fs7um53zh5q",
14+
"image_name": "image_name_placeholder",
15+
"shape": "VM.Standard2.1",
16+
"ssh_username": "opc",
17+
"region": "us-ashburn-1",
18+
"subnet_ocid": "ocid1.subnet.oc1.iad.aaaaaaaadyszurgvm3sg4ap5zskhtymtnzpkmzlqmp44wao6vjxzjvfexoeq",
19+
"type": "oracle-oci"
20+
}
21+
],
22+
"provisioners": [
23+
{
24+
"type": "shell",
25+
"inline": [
26+
"#!/usr/bin/env bash",
27+
"sudo /usr/libexec/oci-image-cleanup -f"
28+
]
29+
30+
}
31+
],
32+
"post-processors": [
33+
[
34+
{
35+
"output": "manifest.json",
36+
"strip_path": true,
37+
"type": "manifest"
38+
}
39+
]
40+
]
41+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM golang:1.13
2+
3+
LABEL "name"="create marketplace-ready image"
4+
LABEL "version"="1.0"
5+
6+
COPY marketplace_image.json /marketplace_image.json
7+
COPY entrypoint.sh /entrypoint.sh
8+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: 'Partner Marketplace-ready Image'
2+
description: 'From a partner custom image creates a OCI image that is ready to be submitted to Marketplace'
3+
inputs:
4+
base-image: # id of input
5+
description: 'This is the OCID of the custom image that serves as a baseline.'
6+
required: true
7+
default: 'ocid1.image.oc1.iad.aaaaaaaavxqdkuyamlnrdo3q7qa7q3tsd6vnyrxjy3nmdbpv7fs7um53zh5q'
8+
outputs:
9+
image-ocid: # id of output
10+
description: 'The OCID of the output image'
11+
runs:
12+
using: 'docker'
13+
image: 'Dockerfile'
14+
args:
15+
- ${{ inputs.base-image }}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
apt-get update
3+
apt install -y jq unzip
4+
5+
#Installing Packer
6+
export VER="1.4.4"
7+
wget -q https://releases.hashicorp.com/packer/${VER}/packer_${VER}_linux_amd64.zip
8+
unzip packer_${VER}_linux_amd64.zip -d /usr/bin
9+
10+
#Set up environment
11+
echo "${TF_VAR_private_key}" > ${GITHUB_WORKSPACE}/oci.pem
12+
export TF_VAR_private_key_path=${GITHUB_WORKSPACE}/oci.pem
13+
14+
#Replace values with credentials for tenancy where image is being built
15+
echo "Use Packer to create OCI image with cleanup-script"
16+
jq '.builders[].user_ocid |= "'$TF_VAR_user_ocid'" |
17+
.builders[].tenancy_ocid |= "'$TF_VAR_tenancy_ocid'" |
18+
.builders[].fingerprint |= "'$TF_VAR_fingerprint'" |
19+
.builders[].key_file |= "'$TF_VAR_private_key_path'" |
20+
.builders[].compartment_ocid |= "'$TF_VAR_compartment_ocid'" |
21+
.builders[].base_image_ocid |= "'$1'" |
22+
.builders[].image_name |= "'$(echo $GITHUB_REPOSITORY |cut -d'/' -f 2).$(date +"%Y%m%d_%H%M%S")'"' /marketplace_image.json > dummy_image.json
23+
packer build dummy_image.json
24+
cat manifest.json | jq -r .builds[0].artifact_id | cut -d':' -f2 > ${GITHUB_WORKSPACE}/ocid.txt
25+
echo ::set-output name=image-ocid::$(cat manifest.json | jq -r .builds[0].artifact_id | cut -d':' -f2)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
3+
"variables": {
4+
},
5+
"builders":[
6+
{
7+
"user_ocid": "user_ocid_placeholder",
8+
"tenancy_ocid": "tenancy_ocid_placeholder",
9+
"fingerprint": "fingerprint_placeholder",
10+
"key_file": "key_file_placeholder",
11+
"compartment_ocid": "compartment_ocid_placeholder",
12+
"availability_domain": "IYfK:US-ASHBURN-AD-1",
13+
"base_image_ocid": "ocid1.image.oc1.iad.aaaaaaaavxqdkuyamlnrdo3q7qa7q3tsd6vnyrxjy3nmdbpv7fs7um53zh5q",
14+
"image_name": "image_name_placeholder",
15+
"shape": "VM.Standard2.1",
16+
"ssh_username": "opc",
17+
"region": "us-ashburn-1",
18+
"subnet_ocid": "ocid1.subnet.oc1.iad.aaaaaaaadyszurgvm3sg4ap5zskhtymtnzpkmzlqmp44wao6vjxzjvfexoeq",
19+
"type": "oracle-oci"
20+
}
21+
],
22+
"provisioners": [
23+
{
24+
"type": "shell",
25+
"inline": [
26+
"#!/usr/bin/env bash",
27+
"sudo /usr/libexec/oci-image-cleanup -f"
28+
]
29+
30+
}
31+
],
32+
"post-processors": [
33+
[
34+
{
35+
"output": "manifest.json",
36+
"strip_path": true,
37+
"type": "manifest"
38+
}
39+
]
40+
]
41+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM golang:1.13
2+
3+
LABEL "name"="create stack archive"
4+
LABEL "version"="1.0"
5+
6+
COPY entrypoint.sh /entrypoint.sh
7+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
apt-get update
3+
apt install -y build-essential zip
4+
5+
mkdir -p ${GITHUB_WORKSPACE}/upload
6+
cd ${GITHUB_WORKSPACE}/terraform
7+
export FILENAME=$(echo ${GITHUB_REPOSITORY} |cut -d'/' -f 2).$(date +"%Y%m%d_%H%M%S")
8+
zip -r ${GITHUB_WORKSPACE}/upload/$FILENAME.zip ./ -x ".terraform/*" -x "*tfstate*"

0 commit comments

Comments
 (0)