This repository was archived by the owner on May 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 15 files changed +293
-0
lines changed Expand file tree Collapse file tree 15 files changed +293
-0
lines changed Original file line number Diff line number Diff line change 1+ # github-actions
Original file line number Diff line number Diff line change 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" ]
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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" ]
Original file line number Diff line number Diff line change 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 }}
Original file line number Diff line number Diff line change 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)
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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" ]
Original file line number Diff line number Diff line change 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*"
You can’t perform that action at this time.
0 commit comments